getUserGroups(); // Build the form control. $html = array(); // Open the table. $html[] = ''; // The table heading. $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; // The table body. $html[] = ' '; foreach ($groups as $group) { if (!isset($this->value[$group->value])) { $this->value[$group->value] = array('filter_type' => 'BL', 'filter_tags' => '', 'filter_attributes' => ''); } $group_filter = $this->value[$group->value]; $group_filter['filter_tags'] = !empty($group_filter['filter_tags']) ? $group_filter['filter_tags'] : ''; $group_filter['filter_attributes'] = !empty($group_filter['filter_attributes']) ? $group_filter['filter_attributes'] : ''; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; } $html[] = ' '; // Close the table. $html[] = '
'; $html[] = ' ' . JText::_('JGLOBAL_FILTER_GROUPS_LABEL') . ''; $html[] = ' '; $html[] = ' ' . JText::_('JGLOBAL_FILTER_TYPE_LABEL') . ''; $html[] = ' '; $html[] = ' ' . JText::_('JGLOBAL_FILTER_TAGS_LABEL') . ''; $html[] = ' '; $html[] = ' ' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') . ''; $html[] = '
'; $html[] = ' ' . str_repeat('|—', $group->level) . $group->text; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = '
'; // Add notes $html[] = '
'; $html[] = '

' . JText::_('JGLOBAL_FILTER_TYPE_DESC') . '

'; $html[] = '

' . JText::_('JGLOBAL_FILTER_TAGS_DESC') . '

'; $html[] = '

' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_DESC') . '

'; $html[] = '
'; return implode("\n", $html); } /** * A helper to get the list of user groups. * * @return array * * @since 1.6 */ protected function getUserGroups() { // Get a database object. $db = JFactory::getDBO(); // Get the user groups from the database. $query = $db->getQuery(true); $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level'); $query->from('#__usergroups AS a'); $query->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt'); $query->group('a.id, a.title, a.lft'); $query->order('a.lft ASC'); $db->setQuery($query); $options = $db->loadObjectList(); return $options; } }