1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | global $template, $conf, $user; |
---|
4 | include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php'); |
---|
5 | load_language('plugin.lang', meta_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 | // +-----------------------------------------------------------------------+ |
---|
11 | check_status(ACCESS_ADMINISTRATOR); |
---|
12 | |
---|
13 | //-------------------------------------------------------- sections definitions |
---|
14 | |
---|
15 | // Gestion des onglets |
---|
16 | if (!isset($_GET['tab'])) |
---|
17 | $page['tab'] = 'gestion'; |
---|
18 | else |
---|
19 | $page['tab'] = $_GET['tab']; |
---|
20 | |
---|
21 | $tabsheet = new tabsheet(); |
---|
22 | $tabsheet->add('gestion', |
---|
23 | l10n('meta_onglet_gestion'), |
---|
24 | $my_base_url.'&tab=gestion'); |
---|
25 | $tabsheet->add('description', |
---|
26 | l10n('meta_onglet_description'), |
---|
27 | $my_base_url.'&tab=description'); |
---|
28 | $tabsheet->select($page['tab']); |
---|
29 | $tabsheet->assign(); |
---|
30 | |
---|
31 | // Onglet gestion des meta |
---|
32 | switch ($page['tab']) |
---|
33 | { |
---|
34 | case 'gestion': |
---|
35 | |
---|
36 | //charge la liste des meta |
---|
37 | $groups = array(); |
---|
38 | $query = ' |
---|
39 | select id,metaname |
---|
40 | FROM ' . meta_TABLE . ' |
---|
41 | ORDER BY metaname ASC;'; |
---|
42 | $result = pwg_query($query); |
---|
43 | |
---|
44 | while ($row = mysql_fetch_array($result)) |
---|
45 | { |
---|
46 | $groups[$row['id']] = $row['metaname']; |
---|
47 | } |
---|
48 | |
---|
49 | $selected = 0; |
---|
50 | $options[] = l10n('meta_select2'); |
---|
51 | $options['a'] = '----------------------'; |
---|
52 | |
---|
53 | |
---|
54 | foreach ($groups as $metalist => $metalist2) |
---|
55 | { |
---|
56 | $options[$metalist] = $metalist2; |
---|
57 | } |
---|
58 | $template->assign( |
---|
59 | 'gestionA', |
---|
60 | array( |
---|
61 | 'OPTIONS' => $options, |
---|
62 | 'SELECTED' => $selected |
---|
63 | )); |
---|
64 | |
---|
65 | |
---|
66 | //edit de meta |
---|
67 | if (isset($_POST['submitchoixmeta']) and is_numeric($_POST['metalist']) and (!$_POST['metalist'])==0 and !is_adviser()) |
---|
68 | { |
---|
69 | $lire=$_POST['metalist']; |
---|
70 | $query = ' |
---|
71 | select id,metaname,metaval |
---|
72 | FROM ' . meta_TABLE . ' |
---|
73 | WHERE id = \''.$lire.'\' |
---|
74 | ;'; |
---|
75 | $result = pwg_query($query); |
---|
76 | |
---|
77 | $row = mysql_fetch_array($result); |
---|
78 | $chname=$row['metaname']; |
---|
79 | $chval=$row['metaval']; |
---|
80 | |
---|
81 | $selected2 = ""; |
---|
82 | |
---|
83 | $template->assign( |
---|
84 | 'meta_edit', |
---|
85 | array( |
---|
86 | 'VALUE' => $chname, |
---|
87 | 'CONTENT' => $chval, |
---|
88 | 'SELECTED' => $selected2 |
---|
89 | )); |
---|
90 | } |
---|
91 | |
---|
92 | //insértion de meta dans la table |
---|
93 | if (isset($_POST['submitinsmeta']) and !is_adviser()) |
---|
94 | { |
---|
95 | $query = ' |
---|
96 | UPDATE ' . meta_TABLE . ' |
---|
97 | SET metaval= \''.$_POST['inser'].'\' |
---|
98 | WHERE metaname = \''.$_POST['invisible'].'\' |
---|
99 | ;'; |
---|
100 | $result = pwg_query($query); |
---|
101 | } |
---|
102 | |
---|
103 | break; |
---|
104 | |
---|
105 | // Onglet description |
---|
106 | case 'description': |
---|
107 | |
---|
108 | $blockdesc = 'description'; |
---|
109 | $template->assign( |
---|
110 | $blockdesc, |
---|
111 | array( |
---|
112 | 'meta'=>l10n('meta_name'), |
---|
113 | )); |
---|
114 | break; |
---|
115 | |
---|
116 | } |
---|
117 | |
---|
118 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
119 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
120 | ?> |
---|