source: extensions/add_head_element/admin.php @ 26033

Last change on this file since 26033 was 23583, checked in by plg, 11 years ago

ability to say if elements must be added on gallery, or admin, or both

File size: 2.0 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3global $template, $conf, $user;
4include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
5load_language('plugin.lang', AHE_PATH);
6$my_base_url = get_admin_plugin_menu_link(__FILE__);
7
8// +-----------------------------------------------------------------------+
9// | Check Access and exit when user status is not ok                      |
10// +-----------------------------------------------------------------------+
11check_status(ACCESS_ADMINISTRATOR);
12
13//-------------------------------------------------------- sections definitions
14
15$tabsheet = new tabsheet();
16$tabsheet->add('Management', l10n('Management'), '');
17$tabsheet->select('Management');
18$tabsheet->assign();
19
20if (isset($conf['add_head_element_apply_on']))
21{
22  $conf['add_head_element_apply_on'] = explode(',', $conf['add_head_element_apply_on']);
23}
24else
25{
26  $conf['add_head_element_apply_on'] = array('gallery', 'admin');
27}
28
29$template->assign(
30  array(
31    'AHEBASE' => $conf['add_head_element'],
32    'gallery' => in_array('gallery', $conf['add_head_element_apply_on']),
33    'admin' => in_array('admin', $conf['add_head_element_apply_on']),
34    )
35  );
36
37if (isset($_POST['submitahe']))
38{
39  conf_update_param('add_head_element', $_POST['ahe']);
40
41  $conf['add_head_element_apply_on'] = array();
42 
43  if (!empty($_POST['apply_on_gallery']))
44  {
45    $conf['add_head_element_apply_on'][] = 'gallery';
46  }
47 
48  if (!empty($_POST['apply_on_admin']))
49  {
50    $conf['add_head_element_apply_on'][] = 'admin';
51  }
52
53  conf_update_param('add_head_element_apply_on', implode(',', $conf['add_head_element_apply_on']));
54 
55  $template->assign(
56    array(
57      'AHEBASE' => stripslashes($_POST['ahe']),
58      'gallery' => in_array('gallery', $conf['add_head_element_apply_on']),
59      'admin' => in_array('admin', $conf['add_head_element_apply_on']),
60      )
61    );
62}
63
64$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
65$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
66?>
Note: See TracBrowser for help on using the repository browser.