Update filter select elements after selecting a new year
[misc/kostenrechnung] / masks / sys_mask.php
1 <?php
2
3 function discover_cmp($a, $b)
4 {
5   return strcmp($a['id'],$b['id']);
6 }
7
8 function discover_masks()
9 {
10   $info = array();
11
12   if (($d = opendir($_SESSION['sys']['basedir'].'masks')) === false)
13     return $info;
14
15   while (($file = readdir($d)) !== false)
16     if (substr($file,-4) == '.php') {
17       $fname = substr($file,0,-4);
18       $info[] = array('id' => $fname, 'text' => $fname);
19     }
20   closedir($d);
21
22   usort($info,discover_cmp);
23   return $info;
24 }
25
26 $mask = array(
27               'table' => 'sys_mask',
28               'title' => 'Liste der Menüpunkte',
29               'join' => array('sys_menu ON sys_mask.menu = sys_menu.id'),
30               'list' => array(
31                               'id' => array(
32                                             'name' => 'ID',
33                                             'visible' => false,
34                                             'sql' => 'sys_mask.id',
35                                             ),
36                               'fname' => array(
37                                             'name' => 'Dateiname',
38                                             'width' => 100,
39                                             ),
40                               'name' => array(
41                                             'name' => 'Name',
42                                             'width' => 150,
43                                             'sql' => 'sys_mask.name',
44                                             ),
45                               'menutitle' => array(
46                                             'name' => 'Menüpunkt',
47                                             'width' => 100,
48                                             ),
49                               'menu' => array(
50                                             'name' => 'Menü',
51                                             'sql' => 'sys_menu.name',
52                                             'width' => 100,
53                                             ),
54                               'edit' => array(
55                                             'name' => 'Edit',
56                                             'width' => 40,
57                                             'specs' => "ClassName: 'aligncenter', canSort: false",
58                                             ),
59                               'priority' => array(
60                                             'name' => 'Priorität',
61                                             'width' => 60,
62                                             'type' => 'number',
63                                             'specs' => "ClassName: 'alignright', canSort: false",
64                                             'sql' => 'sys_mask.priority',
65                                             ),
66                               ),
67               'rows' => 20,
68               'edit' => array(
69                               'fname' => array(
70                                             'name' => 'Dateiname',
71                                             'type' => 'select',
72                                             'options' => discover_masks(),
73                                             'options_string' => true,
74                                             ),
75                               'name' => array(
76                                             'name' => 'Name',
77                                             'type' => 'text',
78                                             'size' => 24,
79                                             ),
80                               'menutitle' => array(
81                                             'name' => 'Menüpunkt',
82                                             'type' => 'text',
83                                             'size' => 24,
84                                             ),
85                               'title' => array(
86                                             'name' => 'Beschreibung',
87                                             'type' => 'text',
88                                             'size' => 24,
89                                             'null' => true,
90                                             ),
91                               'menu' => array(
92                                             'name' => 'Menü',
93                                             'type' => 'select',
94                                             'options' => 'SELECT id,name AS text FROM sys_menu ORDER BY name',
95                                             'size' => 10,
96                                             ),
97                               'edit' => array(
98                                             'name' => 'Edit',
99                                             'type' => 'boolean',
100                                             ),
101                               'priority' => array(
102                                             'name' => 'Priorität',
103                                             'type' => 'number',
104                                             'size' => 10,
105                                             ),
106                               ),
107               );
108
109 ?>