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