1 | <?php |
---|
2 | |
---|
3 | function get_default_stuffs_modules($modules) |
---|
4 | { |
---|
5 | $dir = opendir(STUFFS_PATH . 'modules/'); |
---|
6 | while ($file = readdir($dir)) |
---|
7 | { |
---|
8 | if ($file != '.' and $file != '..' and $file != '.svn') |
---|
9 | { |
---|
10 | $path = STUFFS_PATH . 'modules/' . $file; |
---|
11 | if (is_dir($path) and !is_link($path)) |
---|
12 | { |
---|
13 | array_push($modules, array( |
---|
14 | 'path' => $path, |
---|
15 | 'name' => l10n('module_name_' . strtolower($file)), |
---|
16 | 'description' => l10n('module_desc_' . strtolower($file)), |
---|
17 | ) |
---|
18 | ); |
---|
19 | } |
---|
20 | } |
---|
21 | } |
---|
22 | closedir($dir); |
---|
23 | return $modules; |
---|
24 | } |
---|
25 | |
---|
26 | function get_html_groups_selection( |
---|
27 | $groups, |
---|
28 | $fieldname, |
---|
29 | $selecteds = array() |
---|
30 | ) |
---|
31 | { |
---|
32 | global $conf; |
---|
33 | if (count ($groups) == 0 ) |
---|
34 | { |
---|
35 | return ''; |
---|
36 | } |
---|
37 | $output = '<div id="'.$fieldname.'">'; |
---|
38 | $id = 1; |
---|
39 | foreach ($groups as $group) |
---|
40 | { |
---|
41 | $output.= |
---|
42 | |
---|
43 | '<input type="checkbox" name="'.$fieldname.'[]"' |
---|
44 | .' id="group_'.$id++.'"' |
---|
45 | .' value="'.$group['id'].'"' |
---|
46 | ; |
---|
47 | |
---|
48 | if (in_array($group['id'], $selecteds)) |
---|
49 | { |
---|
50 | $output.= ' checked="checked"'; |
---|
51 | } |
---|
52 | |
---|
53 | $output.= |
---|
54 | '><label>' |
---|
55 | .' '. $group['name'] |
---|
56 | .'</label>' |
---|
57 | ."\n" |
---|
58 | ; |
---|
59 | } |
---|
60 | $output.= '</div>'; |
---|
61 | |
---|
62 | return $output; |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | function get_all_groups() |
---|
67 | { |
---|
68 | $query = ' |
---|
69 | SELECT id, name |
---|
70 | FROM '.GROUPS_TABLE.' |
---|
71 | ORDER BY name ASC |
---|
72 | ;'; |
---|
73 | $result = pwg_query($query); |
---|
74 | |
---|
75 | $groups = array(); |
---|
76 | while ($row = mysql_fetch_assoc($result)) |
---|
77 | { |
---|
78 | array_push($groups, $row); |
---|
79 | } |
---|
80 | |
---|
81 | uasort($groups, 'name_compare'); |
---|
82 | return $groups; |
---|
83 | } |
---|
84 | |
---|
85 | ?> |
---|