Exemple #1
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 protected function _getGroups()
 {
     // Get the attributes
     $menuType = (string) $this->_element->attributes()->menu_type;
     $published = (string) $this->_element->attributes()->published ? explode(',', (string) $this->_element->attributes()->published) : array();
     $disable = (string) $this->_element->attributes()->disable ? explode(',', (string) $this->_element->attributes()->disable) : array();
     // Get the com_menus helper
     require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
     // Get the items
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published);
     // Prepare return value
     $groups = array();
     // If a menu type was set
     if ($menuType) {
         $groups[$menuType] = array();
         // Loop over links
         foreach ($items as $link) {
             // Generate an option disabling it if it's the case
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Loop over types
         foreach ($items as $menu) {
             $groups[$menu->menutype] = array();
             // Loop over links
             foreach ($menu->links as $link) {
                 // Generate an option disabling it if it's the case
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional options in the XML definition.
     $groups = array_merge(parent::_getGroups(), $groups);
     return $groups;
 }
Exemple #2
0
 /**
  * Method to get the field input.
  *
  * @return	string		The field input.
  */
 protected function _getGroups()
 {
     $client = $this->_element->attributes('client');
     $client_id = $client == 'administrator' ? 1 : 0;
     $db = JFactory::getDBO();
     $query = new JQuery();
     $query->select($db->nameQuote('id'));
     $query->select($db->nameQuote('title'));
     $query->select($db->nameQuote('template'));
     $query->from($db->nameQuote('#__template_styles'));
     $query->where($db->nameQuote('client_id') . '=' . (int) $client_id);
     $query->order($db->nameQuote('template'));
     $query->order($db->nameQuote('title'));
     $db->setQuery($query);
     $styles = $db->loadObjectList();
     // Pre-process into groups.
     $last = null;
     $groups = array();
     foreach ($styles as $style) {
         if ($style->template != $last) {
             $last = $style->template;
             $groups[$last] = array();
         }
         $groups[$last][] = JHtml::_('select.option', $style->id, $style->title);
     }
     // Merge any additional options in the XML definition.
     $groups = array_merge(parent::_getGroups(), $groups);
     return $groups;
 }
Exemple #3
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 protected function _getGroups()
 {
     if (strlen($this->value) == 0) {
         $conf =& JFactory::getConfig();
         $value = $conf->getValue('config.offset');
     }
     $zones = DateTimeZone::listIdentifiers();
     foreach ($zones as $zone) {
         // 0 => Continent, 1 => City
         $zone = explode('/', $zone);
         // Only use "friendly" continent names
         if ($zone[0] == 'Africa' || $zone[0] == 'America' || $zone[0] == 'Antarctica' || $zone[0] == 'Arctic' || $zone[0] == 'Asia' || $zone[0] == 'Atlantic' || $zone[0] == 'Australia' || $zone[0] == 'Europe' || $zone[0] == 'Indian' || $zone[0] == 'Pacific') {
             if (isset($zone[1]) != '') {
                 // Creates array(DateTimeZone => 'Friendly name')
                 $groups[$zone[0]][$zone[0] . '/' . $zone[1]] = str_replace('_', ' ', $zone[1]);
             }
         }
     }
     // Sort the arrays
     ksort($groups);
     foreach ($groups as $zone => $location) {
         sort($location);
     }
     // Merge any additional options in the XML definition.
     $groups = array_merge(parent::_getGroups(), $groups);
     return $groups;
 }