Пример #1
0
 /**
  * Displays a Select list of the available asset groups
  *
  * @param   string   $name	The name of the select element
  * @param   mixed    $selected	The selected asset group id
  * @param   string   $attribs	Optional attributes for the select field
  * @param   array    $config	An array of options for the control
  *
  * @return  mixed  An HTML string or null if an error occurs
  */
 public static function assetgrouplist($name, $selected, $attribs = null, $config = array())
 {
     static $count;
     $options = JHtmlAccess::assetgroups();
     if (isset($config['title'])) {
         array_unshift($options, JHtml::_('select.option', '', $config['title']));
     }
     return JHtml::_('select.genericlist', $options, $name, array('id' => isset($config['id']) ? $config['id'] : 'assetgroups_' . ++$count, 'list.attr' => is_null($attribs) ? 'class="inputbox" size="3"' : $attribs, 'list.select' => (int) $selected));
 }
Пример #2
0
 /**
  * Gets a list of the asset groups as an array of JHtml compatible options.
  *
  * @return  mixed  An array or false if an error occurs
  *
  * @since   11.1
  */
 public static function assetgroups()
 {
     if (empty(self::$asset_groups)) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('a.id AS value, a.title AS text');
         $query->from($db->quoteName('#__viewlevels') . ' AS a');
         $query->group('a.id, a.title, a.ordering');
         $query->order('a.ordering ASC');
         $db->setQuery($query);
         self::$asset_groups = $db->loadObjectList();
     }
     return self::$asset_groups;
 }