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

Last change on this file since 3609 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

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