Last change
on this file since 3912 was
3609,
checked in by patdenice, 15 years ago
|
Convert all php and tpl files in Unix format for my plugins.
|
File size:
1.0 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | function get_html_groups_selection( |
---|
4 | $groups, |
---|
5 | $fieldname, |
---|
6 | $selecteds = array() |
---|
7 | ) |
---|
8 | { |
---|
9 | global $conf; |
---|
10 | if (count ($groups) == 0 ) |
---|
11 | { |
---|
12 | return ''; |
---|
13 | } |
---|
14 | $output = '<div id="'.$fieldname.'">'; |
---|
15 | $id = 1; |
---|
16 | foreach ($groups as $group) |
---|
17 | { |
---|
18 | $output.= |
---|
19 | |
---|
20 | '<input type="checkbox" name="'.$fieldname.'[]"' |
---|
21 | .' id="'.$id++.'"' |
---|
22 | .' value="'.$group['id'].'"' |
---|
23 | ; |
---|
24 | |
---|
25 | if (in_array($group['id'], $selecteds)) |
---|
26 | { |
---|
27 | $output.= ' checked="checked"'; |
---|
28 | } |
---|
29 | |
---|
30 | $output.= |
---|
31 | '><label>' |
---|
32 | .' '. $group['name'] |
---|
33 | .'</label>' |
---|
34 | ."\n" |
---|
35 | ; |
---|
36 | } |
---|
37 | $output.= '</div>'; |
---|
38 | |
---|
39 | return $output; |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | function get_all_groups() |
---|
44 | { |
---|
45 | $query = ' |
---|
46 | SELECT id, name |
---|
47 | FROM '.GROUPS_TABLE.' |
---|
48 | ORDER BY name ASC |
---|
49 | ;'; |
---|
50 | $result = pwg_query($query); |
---|
51 | |
---|
52 | $groups = array(); |
---|
53 | while ($row = mysql_fetch_assoc($result)) |
---|
54 | { |
---|
55 | array_push($groups, $row); |
---|
56 | } |
---|
57 | |
---|
58 | usort($groups, 'groups_name_compare'); |
---|
59 | |
---|
60 | return $groups; |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | function groups_name_compare($a, $b) |
---|
65 | { |
---|
66 | return strcmp(strtolower($a['name']), strtolower($b['name'])); |
---|
67 | } |
---|
68 | |
---|
69 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.