JHtmlAccess/assetgroups

From Joomla! Documentation

Jump to: navigation, search

Contents

Description

Gets a list of the asset groups as an array of JHtml compatible options.

Syntax

static& JHtmlAccess::assetgroups($config=array())
Parameter Name Default Value Description
$config array() $config An array of options for the options

Returns

mixed An array or false if an error occurs

Defined in

libraries/joomla/html/html/access.php

Importing

jimport( 'joomla.html.html.access' );

Source Body

        public static function &assetgroups($config = array())
        {
                if (empty(JHtmlAccess::$asset_groups))
                {
                        $db             = &JFactory::getDbo();
                        $query  = new JQuery;
 
                        $query->select('a.id AS value, a.title AS text');
                        $query->from('#__viewlevels AS a');
                        $query->group('a.id');
                        $query->order('a.ordering ASC');
 
                        $db->setQuery($query);
                        JHtmlAccess::$asset_groups = $db->loadObjectList();
 
                        // Check for a database error.
                        if ($db->getErrorNum()) {
                                JError::raiseNotice(500, $db->getErrorMsg());
                                return false;
                        }
                }
 
                return JHtmlAccess::$asset_groups;
        }
Personal tools