Update filter select elements after selecting a new year
[misc/kostenrechnung] / masks / sys_group_mask.php
1 <?php
2
3 $jscode[] = <<<EOC
4
5 Rico.moduleDependencies['checkboxDB'] = ['+LiveGrid', '../ricoTableColumnDB.js'];
6 Rico.loadModule('checkboxDB');
7
8 function select_group_calback(data)
9 {
10   grid_update(grid);
11 }
12
13 function select_group(obj)
14 {
15   if (!obj.options[obj.selectedIndex].value.length)
16     val = -1;
17   else
18     val = obj.options[obj.selectedIndex].value;
19
20   ajax_request('setvar','source=sys_group_mask&name=group&value='+val,select_group_calback);
21
22   if (obj.options[obj.selectedIndex].value.length)
23     info('Gruppe ' + obj.options[obj.selectedIndex].innerHTML + ' ausgewählt');
24   else
25     info('');
26 }
27 EOC;
28
29 if (empty($_SESSION['sys_group_mask.group'])) $_SESSION['sys_group_mask.group'] = 0;
30
31 $mask = array(
32               'table' => 'sys_mask',
33               'title' => 'Berechtigungen',
34               'select' => array(
35                                 'title' => 'Auswahl',
36                                 'options' => 'SELECT id,name AS text FROM sys_group ORDER BY name',
37                                 'default' => 'Gruppe wählen',
38                                 'selected' => $_SESSION['sys_group_mask.group'],
39                                 'onchange' => 'select_group(this)',
40                                 ),
41               'join' => array('sys_menu ON sys_mask.menu = sys_menu.id'),
42               'list' => array(
43                               'id' => array(
44                                             'name' => 'ID',
45                                             'sql' => 'sys_mask.id',
46                                             'visible' => false,
47                                             ),
48                               'menu' => array(
49                                             'name' => 'Menü',
50                                             'width' => 80,
51                                             'sql' => 'sys_menu.name',
52                                             ),
53                               'menutitle' => array(
54                                             'name' => 'Menüpunkt',
55                                             'width' => 150,
56                                             'sql' => 'sys_mask.menutitle',
57                                             ),
58                               'title' => array(
59                                             'name' => 'Beschreibung',
60                                             'width' => 150,
61                                             'sql' => 'sys_mask.title',
62                                             ),
63                               'edit' => array(
64                                             'name' => 'Edit',
65                                             'width' => 40,
66                                             'specs' => "ClassName: 'aligncenter', canSort: false",
67                                             'sql' => 'sys_mask.edit',
68                                             ),
69                               'option' => array(
70                                             'name' => 'Menü',
71                                             'width' => 40,
72                                             'sql' => '(SELECT count(*) FROM sys_group_mask WHERE gid = '
73                                                 . intval($_SESSION['sys_group_mask.group'])
74                                                 . ' AND mask = sys_mask.id)',
75                                             'control' => "new Rico.TableColumn.checkboxDB(0, 'ajax/ricoUpdateConnection.php')",
76                                             'specs' => "filterUI: 'c', ClassName: 'aligncenter', canSort: false",
77                                             'update' => array('table' => 'sys_group_mask',
78                                                               'basecol' => 'gid',
79                                                               'baseval' => $_SESSION['sys_group_mask.group'],
80                                                               'refcol' => 'mask',
81                                                               'reftable' => 'sys_mask',
82                                                               'refid' => 'id',
83                                                               ),
84                                             ),
85                               ),
86               'rows' => 20,
87               'variables' => array(
88                                    'group' => array(),
89                                    ),
90               );
91
92 ?>