source: extensions/PWG_Stuffs/admin/manage.php @ 7690

Last change on this file since 7690 was 7540, checked in by patdenice, 13 years ago

Main block can be hidden according to user status or user group.

File size: 2.2 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5// Enregistrement de l'ordre
6if (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('
16UPDATE ' . STUFFS_TABLE . '
17SET pos=' . $pos++ . ' , id_line='.$id_line.', width='.$width.'
18WHERE id=' . $id . ' LIMIT 1');
19  }
20
21  array_push($page['infos'], l10n('stuffs_order_saved'));
22}
23
24// Affichage des modules et de leur position
25$q = 'SELECT id, name, descr, type, id_line, width
26FROM ' . STUFFS_TABLE . '
27ORDER BY pos ASC;';
28$result = pwg_query($q);
29$num = 0;
30$pos = 1;
31$cat_mod = array('name' => l10n('Categories'), 'type' => '-', 'description' => '');
32$id_line_options = array(
33    '' => '-',
34    'A' => 'A',
35    'B' => 'B',
36    'C' => 'C',
37    'D' => 'D',
38    'E' => 'E',
39    'F' => 'F',
40    'G' => 'G',
41    'H' => 'H',
42    'I' => 'I',
43    'J' => 'J');
44
45while ($module = mysql_fetch_assoc($result))
46{
47        $module['name'] = $module['type'] != 'MainBlock' ? $module['name'] : l10n('stuffs_main_block');
48
49  $template->append('modules', array(
50    'ID' => $module['id'],
51    'NAME' => trigger_event('render_stuffs_name', $module['name']),
52    'DESC' => $module['descr'],
53    'TYPE' => $module['type'],
54    'TYPE_NAME' => (isset($modules[$module['type']]['name']) ? $modules[$module['type']]['name'] : ''),
55    'POS' => 10 * $pos++,
56    'ID_LINE_OPTIONS' => $id_line_options,
57    'ID_LINE_SELECTED' => $module['id_line'],
58                'WIDTH' => $module['width'],
59                'ID' => $module['id'],
60    'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadd_module.php&amp;type=' . $module['type'] . '&amp;edit=' . $module['id'],
61    'U_DELETE' => !is_adviser() and $module['id'] != 0 ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&amp;del=' . $module['id'] : '',
62  ));
63}
64
65$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/manage.tpl');
66$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
67
68?>
Note: See TracBrowser for help on using the repository browser.