1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | // Enregistrement de l'ordre |
---|
6 | if (isset($_POST['submitOrder']) and !is_adviser()) |
---|
7 | { |
---|
8 | asort($_POST['position'], SORT_NUMERIC); |
---|
9 | $pos = 1; |
---|
10 | foreach($_POST['position'] as $id => $old_pos) |
---|
11 | { |
---|
12 | $id_line = !empty($_POST['id_line'][$id]) ? '"'.$_POST['id_line'][$id].'"' : 'NULL'; |
---|
13 | $width = (!empty($_POST['width'][$id]) and is_numeric($_POST['width'][$id])) ? '"'.$_POST['width'][$id].'"' : 'NULL'; |
---|
14 | |
---|
15 | pwg_query(' |
---|
16 | UPDATE ' . STUFFS_TABLE . ' |
---|
17 | SET pos=' . $pos++ . ' , id_line='.$id_line.', width='.$width.' |
---|
18 | WHERE id=' . $id . ' LIMIT 1'); |
---|
19 | } |
---|
20 | |
---|
21 | pwg_query(' |
---|
22 | UPDATE ' . STUFFS_TABLE . ' |
---|
23 | SET datas = "'.addslashes(serialize(array('hide' => isset($_POST['hidemb'])))).'" |
---|
24 | WHERE id=0;'); |
---|
25 | |
---|
26 | array_push($page['infos'], l10n('stuffs_order_saved')); |
---|
27 | } |
---|
28 | |
---|
29 | // Affichage des modules et de leur position |
---|
30 | $q = 'SELECT id, name, descr, type, id_line, width, datas |
---|
31 | FROM ' . STUFFS_TABLE . ' |
---|
32 | ORDER BY pos ASC;'; |
---|
33 | $result = pwg_query($q); |
---|
34 | $num = 0; |
---|
35 | $pos = 1; |
---|
36 | $cat_mod = array('name' => l10n('Categories'), 'type' => '-', 'description' => ''); |
---|
37 | $id_line_options = array( |
---|
38 | '' => '-', |
---|
39 | 'A' => 'A', |
---|
40 | 'B' => 'B', |
---|
41 | 'C' => 'C', |
---|
42 | 'D' => 'D', |
---|
43 | 'E' => 'E', |
---|
44 | 'F' => 'F', |
---|
45 | 'G' => 'G', |
---|
46 | 'H' => 'H', |
---|
47 | 'I' => 'I', |
---|
48 | 'J' => 'J'); |
---|
49 | |
---|
50 | while ($module = mysql_fetch_assoc($result)) |
---|
51 | { |
---|
52 | $module['name'] = $module['type'] != 'MainBlock' ? $module['name'] : l10n('stuffs_main_block'); |
---|
53 | |
---|
54 | $template->append('modules', array( |
---|
55 | 'ID' => $module['id'], |
---|
56 | 'NAME' => trigger_event('render_stuffs_name', $module['name']), |
---|
57 | 'DESC' => $module['descr'], |
---|
58 | 'TYPE' => $module['type'], |
---|
59 | 'TYPE_NAME' => (isset($modules[$module['type']]['name']) ? $modules[$module['type']]['name'] : ''), |
---|
60 | 'POS' => 10 * $pos++, |
---|
61 | 'ID_LINE_OPTIONS' => $id_line_options, |
---|
62 | 'ID_LINE_SELECTED' => $module['id_line'], |
---|
63 | 'WIDTH' => $module['width'], |
---|
64 | 'ID' => $module['id'], |
---|
65 | 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadd_module.php&type=' . $module['type'] . '&edit=' . $module['id'], |
---|
66 | 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&del=' . $module['id'] : '', |
---|
67 | )); |
---|
68 | |
---|
69 | if ($module['type'] == 'MainBlock' and !empty($module['datas'])) |
---|
70 | { |
---|
71 | $datas = unserialize($module['datas']); |
---|
72 | $template->assign('HIDEMB', $datas['hide']); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/manage.tpl'); |
---|
77 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
78 | |
---|
79 | ?> |
---|