1 <?php
2 3 4 5 6 7 8
9
10 defined('JPATH_PLATFORM') or die;
11
12 13 14 15 16
17 abstract class JHtmlUser
18 {
19 20 21 22 23 24 25 26 27
28 public static function groups($includeSuperAdmin = false)
29 {
30 $options = array_values(JHelperUsergroups::getInstance()->getAll());
31
32 for ($i = 0, $n = count($options); $i < $n; $i++)
33 {
34 $options[$i]->value = $options[$i]->id;
35 $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title;
36 $groups[] = JHtml::_('select.option', $options[$i]->value, $options[$i]->text);
37 }
38
39
40 if (!$includeSuperAdmin)
41 {
42 $filteredGroups = array();
43
44 foreach ($groups as $group)
45 {
46 if (!JAccess::checkGroup($group->value, 'core.admin'))
47 {
48 $filteredGroups[] = $group;
49 }
50 }
51
52 $groups = $filteredGroups;
53 }
54
55 return $groups;
56 }
57
58 59 60 61 62 63 64
65 public static function userlist()
66 {
67 $db = JFactory::getDbo();
68 $query = $db->getQuery(true)
69 ->select('a.id AS value, a.name AS text')
70 ->from('#__users AS a')
71 ->where('a.block = 0')
72 ->order('a.name');
73 $db->setQuery($query);
74
75 return $db->loadObjectList();
76 }
77 }
78