source: extensions/PWG_Stuffs/admin/functions.inc.php @ 7345

Last change on this file since 7345 was 6230, checked in by patdenice, 14 years ago

Corrections

File size: 1.5 KB
Line 
1<?php
2
3function get_stuffs_modules()
4{
5        $dir = opendir(STUFFS_PATH . 'modules/');
6    while ($file = readdir($dir)) {
7        if ($file != '.' and $file != '..' and $file != '.svn') {
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_' . strtolower($file)),
12                    'description' => l10n('module_desc_' . strtolower($file)));
13            }
14        }
15    }
16    closedir($dir);
17    uasort($modules, 'name_compare');
18    return $modules;
19}
20
21function 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      .'&nbsp;'. $group['name']
51      .'</label>'
52      ."\n"
53      ;
54  }
55  $output.= '</div>';
56
57  return $output;
58}
59
60
61function get_all_groups()
62{
63$query = '
64SELECT 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?>
Note: See TracBrowser for help on using the repository browser.