当前位置: 首页>>代码示例>>PHP>>正文


PHP JFormFieldGroupedList::getGroups方法代码示例

本文整理汇总了PHP中JFormFieldGroupedList::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormFieldGroupedList::getGroups方法的具体用法?PHP JFormFieldGroupedList::getGroups怎么用?PHP JFormFieldGroupedList::getGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFormFieldGroupedList的用法示例。


在下文中一共展示了JFormFieldGroupedList::getGroups方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getGroups

 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   11.1
  */
 protected function getGroups()
 {
     // Initialize variables.
     $groups = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     $language = $this->element['language'] ? explode(',', (string) $this->element['language']) : array();
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published, $language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:41,代码来源:menuitem.php

示例2: getGroups

 protected function getGroups()
 {
     // Include engine
     require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php';
     // Initialize variables.
     $groups = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     // Get the menu items.
     $items = $this->getMenuLinks($menuType, 0, 0, $published);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:easyblogmenuitem.php

示例3: getGroups

 protected function getGroups()
 {
     // @task: Since most of the modules uses this element, we inject the beautifier codes here.
     JFactory::getDocument()->addStyleSheet(JURI::root() . 'administrator/components/com_easyblog/assets/css/module.css');
     // Initialize variables.
     $groups = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     // Get the menu items.
     $items = $this->getMenuLinks($menuType, 0, 0, $published);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:35,代码来源:easyblogmenuitem.php

示例4: getGroups

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getGroups()
 {
     // Two dimension array (1st dimension is group, 2nd dimension is option)
     $groups = array();
     $groups["default"] = array();
     // get components
     if ($this->getAttribute("components", "true") == "true") {
         $groups[JText::_("COM_JDEVELOPER_COMPONENTS")] = array();
         $components = array();
         foreach (JFolder::folders(JPATH_ROOT . "/administrator/components", "com_[a-z0-9_]*") as $component) {
             $groups[JText::_("COM_JDEVELOPER_COMPONENTS")][] = JHtml::_('select.option', "admin." . strtolower($component), ucfirst(str_replace("com_", "", $component)));
             $components[$component] = 1;
         }
         foreach (JFolder::folders(JPATH_ROOT . "/components", "com_[a-z0-9_]*") as $component) {
             if (!array_key_exists($component, $components)) {
                 $groups[JText::_("COM_JDEVELOPER_COMPONENTS")][] = JHtml::_('select.option', "admin." . strtolower($component), ucfirst(str_replace("com_", "", $component)));
             }
         }
     }
     // get modules
     if ($this->getAttribute("modules", "true") == "true") {
         $groups[JText::_("COM_JDEVELOPER_MODULES")] = array();
         foreach (JFolder::folders(JPATH_ROOT . "/administrator/modules", "mod_[a-z0-9_]*") as $module) {
             $groups[JText::_("COM_JDEVELOPER_MODULES")][] = JHtml::_('select.option', "admin." . strtolower($module), ucfirst(str_replace("mod_", "", $module)) . $this->styleClient("Backend"));
         }
         foreach (JFolder::folders(JPATH_ROOT . "/modules", "mod_[a-z0-9_]*") as $module) {
             $groups[JText::_("COM_JDEVELOPER_MODULES")][] = JHtml::_('select.option', "site." . strtolower($module), ucfirst(str_replace("mod_", "", $module)) . $this->styleClient("Frontend"));
         }
     }
     // get plugins
     if ($this->getAttribute("plugins", "true") == "true") {
         foreach (JFolder::folders(JPATH_ROOT . "/plugins") as $folder) {
             $groups[JText::_("COM_JDEVELOPER_PLUGINS") . " - " . $folder] = array();
             foreach (JFolder::folders(JPATH_ROOT . "/plugins/" . $folder) as $plugin) {
                 $groups[JText::_("COM_JDEVELOPER_PLUGINS") . " - " . $folder][] = JHtml::_('select.option', "site.plg_" . strtolower($folder) . "_" . strtolower($plugin), $plugin);
             }
         }
     }
     // get plugins
     if ($this->getAttribute("templates", "true") == "true") {
         $groups[JText::_("COM_JDEVELOPER_TEMPLATES")] = array();
         foreach (JFolder::folders(JPATH_ROOT . "/administrator/templates") as $template) {
             $groups[JText::_("COM_JDEVELOPER_TEMPLATES")][] = JHtml::_('select.option', "admin.tpl_" . strtolower($template), ucfirst($template) . $this->styleClient("Backend"));
         }
         foreach (JFolder::folders(JPATH_ROOT . "/templates") as $template) {
             $groups[JText::_("COM_JDEVELOPER_TEMPLATES")][] = JHtml::_('select.option', "site.tpl_" . strtolower($template), ucfirst($template) . $this->styleClient("Frontend"));
         }
     }
     return array_merge(parent::getGroups(), $groups);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:57,代码来源:extensions.php

示例5: getGroups

 /**
  * Method to get the list of template style options
  * grouped by template.
  * Use the client attribute to specify a specific client.
  * Use the template attribute to specify a specific template
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     // Initialize variables.
     $groups = array();
     $lang = JFactory::getLanguage();
     // Get the client and client_id.
     $clientName = $this->element['client'] ? (string) $this->element['client'] : 'site';
     $client = JApplicationHelper::getClientInfo($clientName, true);
     // Get the template.
     $template = (string) $this->element['template'];
     // Get the database object and a new query object.
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     // Build the query.
     $query->select('s.id, s.title, e.name as name, s.template');
     $query->from('#__template_styles as s');
     $query->where('s.client_id = ' . (int) $client->id);
     $query->order('template');
     $query->order('title');
     if ($template) {
         $query->where('s.template = ' . $db->quote($template));
     }
     $query->join('LEFT', '#__extensions as e on e.element=s.template');
     $query->where('e.enabled=1');
     $query->where($db->quoteName('e.type') . '=' . $db->quote('template'));
     // Set the query and load the styles.
     $db->setQuery($query);
     $styles = $db->loadObjectList();
     // Build the grouped list array.
     if ($styles) {
         foreach ($styles as $style) {
             $template = $style->template;
             $lang->load('tpl_' . $template . '.sys', $client->path, null, false, true) || $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, null, false, true);
             $name = JText::_($style->name);
             // Initialize the group if necessary.
             if (!isset($groups[$name])) {
                 $groups[$name] = array();
             }
             $groups[$name][] = JHtml::_('select.option', $style->id, $style->title);
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:jimyb3,项目名称:mathematicalteachingsite,代码行数:55,代码来源:templatestyle.php

示例6: getGroups

 /**
  * Method to get the list of content map options grouped by first level.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   3.6.0
  */
 protected function getGroups()
 {
     $groups = array();
     // Get the database object and a new query object.
     $db = JFactory::getDbo();
     // Levels subquery.
     $levelQuery = $db->getQuery(true);
     $levelQuery->select('title AS branch_title, 1 as level')->select($db->quoteName('id'))->from($db->quoteName('#__finder_taxonomy'))->where($db->quoteName('parent_id') . ' = 1');
     $levelQuery2 = $db->getQuery(true);
     $levelQuery2->select('b.title AS branch_title, 2 as level')->select($db->quoteName('a.id'))->from($db->quoteName('#__finder_taxonomy', 'a'))->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('a.parent_id') . ' = ' . $db->qn('b.id'))->where($db->quoteName('a.parent_id') . ' NOT IN (0, 1)');
     $levelQuery->union($levelQuery2);
     // Main query.
     $query = $db->getQuery(true)->select($db->quoteName('a.title', 'text'))->select($db->quoteName('a.id', 'value'))->select($db->quoteName('d.level'))->from($db->quoteName('#__finder_taxonomy', 'a'))->join('LEFT', '(' . $levelQuery . ') AS d ON ' . $db->qn('d.id') . ' = ' . $db->qn('a.id'))->where($db->quoteName('a.parent_id') . ' <> 0')->order('d.branch_title ASC, d.level ASC, a.title ASC');
     $db->setQuery($query);
     try {
         $contentMap = $db->loadObjectList();
     } catch (RuntimeException $e) {
         return;
     }
     // Build the grouped list array.
     if ($contentMap) {
         $lang = JFactory::getLanguage();
         foreach ($contentMap as $branch) {
             if ((int) $branch->level === 1) {
                 $name = $branch->text;
             } else {
                 $levelPrefix = str_repeat('- ', max(0, $branch->level - 1));
                 if (trim($name, '**') == 'Language') {
                     $text = FinderHelperLanguage::branchLanguageTitle($branch->text);
                 } else {
                     $key = FinderHelperLanguage::branchSingular($branch->text);
                     $text = $lang->hasKey($key) ? JText::_($key) : $branch->text;
                 }
                 // Initialize the group if necessary.
                 if (!isset($groups[$name])) {
                     $groups[$name] = array();
                 }
                 $groups[$name][] = JHtml::_('select.option', $branch->value, $levelPrefix . $text);
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:52,代码来源:contentmap.php

示例7: getGroups

 protected function getGroups()
 {
     // Initialize variables.
     $options = array();
     $groups = array();
     $joomlaImageFolder = JComponentHelper::getParams('com_media')->get('image_path', 'images');
     $groups["SmartIcons"] = array();
     $groups["SmartIcons"][] = JHtml::_('select.option', JPATH_ROOT . '/media/com_smarticons', 'SmartIcons media folder');
     $groups["Images"] = array();
     $groups["Images"][] = JHtml::_('select.option', JPATH_ROOT . $joomlaImageFolder, 'Joomla image folder');
     $groups["Images"] = array_merge($groups["Images"], $this->getFolders('images', '', 3));
     $rootFolders = $this->getFolders('', 'administrator|cache|cli|components|images|includes|language|libraries|logs|media|modules|plugins|templates|tmp');
     if (is_array($rootFolders) && 0 < count($rootFolders)) {
         $groups["Root folder"] = array();
         $groups["Root folder"] = $rootFolders;
     }
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:19,代码来源:imagefolderlist.php

示例8: getGroups

 protected function getGroups()
 {
     $groups = parent::getGroups();
     if (!self::isPluginEnabled()) {
         // this groupedlist is defined in config XML as two top-level
         // options ("no" and "count up from session start") and
         // a group with several countdown mode options. We have to
         // remove all options in this group if comanion plugin is
         // not enabled
         foreach ($groups as $label => $group) {
             if (!is_integer($label)) {
                 // non-integer label means a group title, so this is the
                 // group to remove. All options are elements of the group
                 // array, so unsetting the group will delete the options
                 unset($groups[$label]);
             }
         }
     }
     return $groups;
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:20,代码来源:sessiondeadline.php

示例9: getGroups

 /**
  * Method to get the time zone field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   11.1
  */
 protected function getGroups()
 {
     // Initialize variables.
     $groups = array();
     $keyField = $this->element['key_field'] ? (string) $this->element['key_field'] : 'id';
     $keyValue = $this->form->getValue($keyField);
     // If the timezone is not set use the server setting.
     if (strlen($this->value) == 0 && empty($keyValue)) {
         $this->value = JFactory::getConfig()->get('offset');
     }
     // Get the list of time zones from the server.
     $zones = DateTimeZone::listIdentifiers();
     // Build the group lists.
     foreach ($zones as $zone) {
         // Time zones not in a group we will ignore.
         if (strpos($zone, '/') === false) {
             continue;
         }
         // Get the group/locale from the timezone.
         list($group, $locale) = explode('/', $zone, 2);
         // Only use known groups.
         if (in_array($group, self::$zones)) {
             // Initialize the group if necessary.
             if (!isset($groups[$group])) {
                 $groups[$group] = array();
             }
             // Only add options where a locale exists.
             if (!empty($locale)) {
                 $groups[$group][$zone] = JHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
             }
         }
     }
     // Sort the group lists.
     ksort($groups);
     foreach ($groups as $zone => &$location) {
         sort($location);
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:jimyb3,项目名称:mathematicalteachingsite,代码行数:48,代码来源:timezone.php

示例10: getGroups

 protected function getGroups()
 {
     static $groups = array();
     static $nums = 0;
     if (empty($groups)) {
         $db = JFactory::getDBO();
         $query = "SELECT sp.id AS value,\n\t\t\t\t\t\t sp.name AS text,\n\t\t\t\t\t\t sp.group_id,\n\t\t\t\t\t\t g.name AS cat_title\n\t\t\t\t    FROM #__jcs_plans  AS sp\n\t\t\t   LEFT JOIN #__jcs_groups AS g ON g.id = sp.group_id\n\t\t\t   \t   WHERE sp.published = 1\n\t\t\t\tORDER BY g.id, sp.name";
         $db->setQuery($query);
         $plans = $db->loadObjectList();
         ArrayHelper::clean_r($plans);
         foreach ($plans as $plan) {
             $groups[$plan->cat_title][] = JHtml::_('select.option', $plan->value, $plan->text, 'value', 'text');
             $nums++;
         }
         $nums += count($groups);
         $groups = array_merge(parent::getGroups(), $groups);
     }
     $this->num = $nums;
     ArrayHelper::clean_r($groups);
     return $groups;
 }
开发者ID:AxelFG,项目名称:ckbran-inf,代码行数:21,代码来源:emeraldplans.php

示例11: getGroups

 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     $groups = array();
     $menuType = $this->menuType;
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $this->published, $this->language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $this->disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $this->disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:36,代码来源:menuitem.php

示例12: getGroups

 protected function getGroups()
 {
     // Initialise variables.
     $lang = JFactory::getLanguage();
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $groups = array();
     $langs = array();
     $name = null;
     // Prepare the query.
     $query->select('m.id, m.title, m.alias, m.link, m.parent_id, m.img, e.element');
     $query->from('#__menu AS m');
     // Filter on the enabled states.
     $query->leftJoin('#__extensions AS e ON m.component_id = e.extension_id');
     $query->where('m.client_id = 1');
     $query->where('e.enabled = 1');
     $query->where('m.id > 1');
     // Order by lft.
     $query->order('m.lft');
     $db->setQuery($query);
     // component list
     $components = $db->loadObjectList();
     // Parse the list of extensions.
     foreach ($components as &$component) {
         // Trim the menu link.
         $component->link = trim($component->link);
         if ($component->parent_id == 1) {
             // Only add this top level if it is authorised and enabled.
             if ($user->authorise('core.manage', $component->element)) {
                 // If the root menu link is empty, add it in.
                 if (empty($component->link)) {
                     $component->link = 'index.php?option=' . $component->element;
                 }
                 if (!empty($component->element)) {
                     // Load the core file then
                     // Load extension-local file.
                     $lang->load($component->element . '.sys', JPATH_BASE, null, false, false) || $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, null, false, false) || $lang->load($component->element . '.sys', JPATH_BASE, $lang->getDefault(), false, false) || $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, $lang->getDefault(), false, false);
                 }
                 $name = $lang->hasKey($component->title) ? JText::_($component->title) : $component->alias;
                 // Root level.
                 if (!isset($groups[$name])) {
                     $groups[$name] = array();
                 }
                 $groups[$name][] = JHtml::_('select.option', $component->link, $name);
             }
         } else {
             // Sub-menu level.
             if (isset($groups[$name])) {
                 // Add the submenu link if it is defined.
                 if (isset($groups[$name]) && !empty($component->link)) {
                     $component->name = $lang->hasKey($component->title) ? JText::_($component->title) : $component->alias;
                     if (!in_array(JHtml::_('select.option', $component->link, $component->name), $groups[$name])) {
                         $groups[$name][] = JHtml::_('select.option', $component->link, $component->name);
                     }
                 }
             }
         }
     }
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:62,代码来源:adminmenuitem.php

示例13: getGroups

 /**
  * Method to get the time zone field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  */
 protected function getGroups()
 {
     $settings = JemHelper::globalattribs();
     $globalTz = $settings->get('global_timezone');
     $groups = array();
     $keyField = !empty($this->keyField) ? $this->keyField : 'id';
     $keyValue = $this->form->getValue($keyField);
     $view = $this->element['view'];
     // If the timezone is not set use the server setting.
     if (strlen($this->value) == 0 && empty($keyValue)) {
         # we didn't select A timezone so we'll take a look at the server setting.
         # are we in settings-view?
         if ($view == 'venue') {
             # check if there is a setting filled
             if ($globalTz) {
                 $this->value = $globalTz;
             } else {
                 # there is no global value so check the the server setting
                 $serverTz = JFactory::getConfig()->get('offset');
                 # UTC is seen as Abidjan and that's not something we want
                 if ($serverTz == 'UTC') {
                     $serverTz = 'Europe/Berlin';
                     // for the moment it's been set to this
                 }
                 $this->value = $serverTz;
             }
         }
     }
     // Get the list of time zones from the server.
     $zones = DateTimeZone::listIdentifiers();
     // Build the group lists.
     foreach ($zones as $zone) {
         // Time zones not in a group we will ignore.
         if (strpos($zone, '/') === false) {
             continue;
         }
         // Get the group/locale from the timezone.
         list($group, $locale) = explode('/', $zone, 2);
         // Only use known groups.
         if (in_array($group, self::$zones)) {
             // Initialize the group if necessary.
             if (!isset($groups[$group])) {
                 $groups[$group] = array();
             }
             // Only add options where a locale exists.
             if (!empty($locale)) {
                 $groups[$group][$zone] = JHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
             }
         }
     }
     // Sort the group lists.
     ksort($groups);
     foreach ($groups as &$location) {
         sort($location);
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:64,代码来源:timezone.php

示例14: getGroups

 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     $groups = array();
     $menuType = $this->menuType;
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $this->published, $this->language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $levelPrefix = str_repeat('- ', max(0, $link->level - 1));
             // Displays language code if not set to All
             if ($link->language !== '*') {
                 $lang = ' (' . $link->language . ')';
             } else {
                 $lang = '';
             }
             $groups[$menuType][] = JHtml::_('select.option', $link->value, $levelPrefix . $link->text . $lang, 'value', 'text', in_array($link->type, $this->disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $levelPrefix = str_repeat('- ', $link->level - 1);
                 // Displays language code if not set to All
                 if ($link->language !== '*') {
                     $lang = ' (' . $link->language . ')';
                 } else {
                     $lang = '';
                 }
                 $groups[$menu->menutype][] = JHtml::_('select.option', $link->value, $levelPrefix . $link->text . $lang, 'value', 'text', in_array($link->type, $this->disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:50,代码来源:menuitem.php

示例15: getGroups

 /**
  * Method to get a list of options for a list input.
  *
  * @return  array    An array of JHtml options.
  */
 protected function getGroups()
 {
     // Remove '.ini' from values
     if (is_array($this->value)) {
         foreach ($this->value as $key => $val) {
             $this->value[$key] = substr($val, 0, -4);
         }
     }
     $package = (string) $this->element['package'];
     $groups = array('Site' => array(), 'Administrator' => array(), 'Installation' => array());
     foreach (array('Site', 'Administrator', 'Installation') as $client) {
         $path = constant('LOCALISEPATH_' . strtoupper($client)) . '/language';
         if (JFolder::exists($path)) {
             $tags = JFolder::folders($path, '.', false, false, array('overrides', '.svn', 'CVS', '.DS_Store', '__MACOSX'));
             if ($tags) {
                 foreach ($tags as $tag) {
                     $files = JFolder::files("{$path}/{$tag}", ".ini\$");
                     foreach ($files as $file) {
                         $basename = substr($file, strlen($tag) + 1);
                         if ($basename == 'ini') {
                             $key = 'joomla';
                             $value = JText::_('COM_LOCALISE_TEXT_TRANSLATIONS_JOOMLA');
                             $origin = LocaliseHelper::getOrigin('', strtolower($client));
                             $disabled = $origin != $package && $origin != '_thirdparty';
                         } else {
                             $key = substr($basename, 0, strlen($basename) - 4);
                             $value = $key;
                             $origin = LocaliseHelper::getOrigin($key, strtolower($client));
                             $disabled = $origin != $package && $origin != '_thirdparty';
                         }
                         $groups[$client][$key] = JHtml::_('select.option', strtolower($client) . '_' . $key, $value, 'value', 'text', false);
                     }
                 }
             }
         }
     }
     $scans = LocaliseHelper::getScans();
     foreach ($scans as $scan) {
         $prefix = $scan['prefix'];
         $suffix = $scan['suffix'];
         $type = $scan['type'];
         $client = ucfirst($scan['client']);
         $path = $scan['path'];
         $folder = $scan['folder'];
         $extensions = JFolder::folders($path);
         foreach ($extensions as $extension) {
             if (JFolder::exists("{$path}{$extension}{$folder}/language")) {
                 // scan extensions folder
                 $tags = JFolder::folders("{$path}{$extension}{$folder}/language");
                 foreach ($tags as $tag) {
                     $file = "{$path}{$extension}{$folder}/language/{$tag}/{$tag}.{$prefix}{$extension}{$suffix}.ini";
                     if (JFile::exists($file)) {
                         $origin = LocaliseHelper::getOrigin("{$prefix}{$extension}{$suffix}", strtolower($client));
                         $disabled = $origin != $package && $origin != '_thirdparty';
                         $groups[$client]["{$prefix}{$extension}{$suffix}"] = JHtml::_('select.option', strtolower($client) . '_' . "{$prefix}{$extension}{$suffix}", "{$prefix}{$extension}{$suffix}", 'value', 'text', $disabled);
                     }
                 }
             }
         }
     }
     foreach ($groups as $client => $extensions) {
         JArrayHelper::sortObjects($groups[$client], 'text');
     }
     // Merge any additional options in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
开发者ID:ForAEdesWeb,项目名称:AEW4,代码行数:72,代码来源:translations.php


注:本文中的JFormFieldGroupedList::getGroups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。