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


PHP FinderHelperLanguage::branchPlural方法代码示例

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


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

示例1: mapslist

 /**
  * Creates a list of maps.
  *
  * @return  array  An array containing the maps that can be selected.
  *
  * @since   2.5
  */
 public static function mapslist()
 {
     $lang = JFactory::getLanguage();
     // Load the finder types.
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('title AS text, id AS value');
     $query->from($db->quoteName('#__finder_taxonomy'));
     $query->where($db->quoteName('parent_id') . ' = 1');
     $query->order('ordering, title ASC');
     $db->setQuery($query);
     try {
         $rows = $db->loadObjectList();
     } catch (RuntimeException $e) {
         return;
     }
     // Compile the options.
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('COM_FINDER_MAPS_BRANCHES'));
     foreach ($rows as $row) {
         $key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text)) ? FinderHelperLanguage::branchPlural($row->text) : $row->text;
         $string = JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key));
         $options[] = JHtml::_('select.option', $row->value, $string);
     }
     return $options;
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:33,代码来源:finder.php

示例2: mapslist

 /**
  * Creates a list of maps.
  *
  * @return  array  An array containing the maps that can be selected.
  *
  * @since   2.5
  */
 public static function mapslist()
 {
     $lang = JFactory::getLanguage();
     // Load the finder types.
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select($db->quoteName('title', 'text'))->select($db->quoteName('id', 'value'))->from($db->quoteName('#__finder_taxonomy'))->where($db->quoteName('parent_id') . ' = 1');
     $db->setQuery($query);
     try {
         $branches = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $db->getMessage());
     }
     // Translate.
     foreach ($branches as $branch) {
         $key = FinderHelperLanguage::branchPlural($branch->text);
         $branch->translatedText = $lang->hasKey($key) ? JText::_($key) : $branch->text;
     }
     // Order by title.
     $branches = ArrayHelper::sortObjects($branches, 'translatedText', 1, true, true);
     // Compile the options.
     $options = array();
     $options[] = JHtml::_('select.option', '', JText::_('COM_FINDER_MAPS_SELECT_BRANCH'));
     // Convert the values to options.
     foreach ($branches as $branch) {
         $options[] = JHtml::_('select.option', $branch->value, $branch->translatedText);
     }
     return $options;
 }
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:35,代码来源:finder.php

示例3: explained

 /**
  * Method to get the explained (human-readable) search query.
  *
  * @param   FinderIndexerQuery  $query  A FinderIndexerQuery object to explain.
  *
  * @return  mixed  String if there is data to explain, null otherwise.
  *
  * @since   2.5
  */
 public static function explained(FinderIndexerQuery $query)
 {
     $parts = array();
     // Process the required tokens.
     foreach ($query->included as $token) {
         if ($token->required && (!isset($token->derived) || $token->derived == false)) {
             $parts[] = '<span class="query-required">' . JText::sprintf('COM_FINDER_QUERY_TOKEN_REQUIRED', $token->term) . '</span>';
         }
     }
     // Process the optional tokens.
     foreach ($query->included as $token) {
         if (!$token->required && (!isset($token->derived) || $token->derived == false)) {
             $parts[] = '<span class="query-optional">' . JText::sprintf('COM_FINDER_QUERY_TOKEN_OPTIONAL', $token->term) . '</span>';
         }
     }
     // Process the excluded tokens.
     foreach ($query->excluded as $token) {
         if (!isset($token->derived) || $token->derived == false) {
             $parts[] = '<span class="query-excluded">' . JText::sprintf('COM_FINDER_QUERY_TOKEN_EXCLUDED', $token->term) . '</span>';
         }
     }
     // Process the start date.
     if ($query->date1) {
         $date = JFactory::getDate($query->date1)->format(JText::_('DATE_FORMAT_LC'));
         $parts[] = '<span class="query-start-date">' . JText::sprintf('COM_FINDER_QUERY_START_DATE', $query->when1, $date) . '</span>';
     }
     // Process the end date.
     if ($query->date2) {
         $date = JFactory::getDate($query->date2)->format(JText::_('DATE_FORMAT_LC'));
         $parts[] = '<span class="query-end-date">' . JText::sprintf('COM_FINDER_QUERY_END_DATE', $query->when2, $date) . '</span>';
     }
     // Process the taxonomy filters.
     if (!empty($query->filters)) {
         // Get the filters in the request.
         $t = JFactory::getApplication()->input->request->get('t', array(), 'array');
         // Process the taxonomy branches.
         foreach ($query->filters as $branch => $nodes) {
             // Process the taxonomy nodes.
             $lang = JFactory::getLanguage();
             foreach ($nodes as $title => $id) {
                 // Translate the title for Types
                 $key = FinderHelperLanguage::branchPlural($title);
                 if ($lang->hasKey($key)) {
                     $title = JText::_($key);
                 }
                 // Don't include the node if it is not in the request.
                 if (!in_array($id, $t)) {
                     continue;
                 }
                 // Add the node to the explanation.
                 $bv = JString::strtolower($branch);
                 $nv = JString::strtolower($title);
                 $parts[] = '<span class="query-taxonomy">' . JText::sprintf('COM_FINDER_QUERY_TAXONOMY_NODE', $title, JText::_(FinderHelperLanguage::branchSingular($branch))) . '</span>';
             }
         }
     }
     // Build the interpreted query.
     return count($parts) ? JText::sprintf('COM_FINDER_QUERY_TOKEN_INTERPRETED', implode(JText::_('COM_FINDER_QUERY_TOKEN_GLUE'), $parts)) : null;
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:68,代码来源:query.php

示例4: select

 /**
  * Method to generate filters using select box dropdown controls.
  *
  * @param   FinderIndexerQuery  $idxQuery  A FinderIndexerQuery object.
  * @param   array               $options   An array of options.
  *
  * @return  mixed  A rendered HTML widget on success, null otherwise.
  *
  * @since   2.5
  */
 public static function select($idxQuery, $options)
 {
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $filter = null;
     // Get the configuration options.
     $classSuffix = $options->get('class_suffix', null);
     $showDates = $options->get('show_date_filters', false);
     // Try to load the results from cache.
     $cache = JFactory::getCache('com_finder', '');
     $cacheId = 'filter_select_' . serialize(array($idxQuery->filter, $options, $groups, JFactory::getLanguage()->getTag()));
     // Check the cached results.
     if (!($branches = $cache->get($cacheId))) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         // Load the predefined filter if specified.
         if (!empty($idxQuery->filter)) {
             $query->select('f.data, ' . $db->quoteName('f.params'))->from($db->quoteName('#__finder_filters') . ' AS f')->where('f.filter_id = ' . (int) $idxQuery->filter);
             // Load the filter data.
             $db->setQuery($query);
             try {
                 $filter = $db->loadObject();
             } catch (RuntimeException $e) {
                 return null;
             }
             // Initialize the filter parameters.
             if ($filter) {
                 $registry = new Registry();
                 $registry->loadString($filter->params);
                 $filter->params = $registry;
             }
         }
         // Build the query to get the branch data and the number of child nodes.
         $query->clear()->select('t.*, count(c.id) AS children')->from($db->quoteName('#__finder_taxonomy') . ' AS t')->join('INNER', $db->quoteName('#__finder_taxonomy') . ' AS c ON c.parent_id = t.id')->where('t.parent_id = 1')->where('t.state = 1')->where('t.access IN (' . $groups . ')')->where('c.state = 1')->where('c.access IN (' . $groups . ')')->group($db->quoteName('t.id'))->order('t.ordering, t.title');
         // Limit the branch children to a predefined filter.
         if (!empty($filter->data)) {
             $query->where('c.id IN(' . $filter->data . ')');
         }
         // Load the branches.
         $db->setQuery($query);
         try {
             $branches = $db->loadObjectList('id');
         } catch (RuntimeException $e) {
             return null;
         }
         // Check that we have at least one branch.
         if (count($branches) === 0) {
             return null;
         }
         // Iterate through the branches and build the branch groups.
         foreach ($branches as $bk => $bv) {
             // If the multi-lang plugin is enabled then drop the language branch.
             if ($bv->title == 'Language' && JLanguageMultilang::isEnabled()) {
                 continue;
             }
             // Build the query to get the child nodes for this branch.
             $query->clear()->select('t.*')->from($db->quoteName('#__finder_taxonomy') . ' AS t')->where('t.parent_id = ' . (int) $bk)->where('t.state = 1')->where('t.access IN (' . $groups . ')')->order('t.ordering, t.title');
             // Self-join to get the parent title.
             $query->select('e.title AS parent_title')->join('LEFT', $db->quoteName('#__finder_taxonomy', 'e') . ' ON ' . $db->quoteName('e.id') . ' = ' . $db->quoteName('t.parent_id'));
             // Limit the nodes to a predefined filter.
             if (!empty($filter->data)) {
                 $query->where('t.id IN(' . $filter->data . ')');
             }
             // Load the branches.
             $db->setQuery($query);
             try {
                 $branches[$bk]->nodes = $db->loadObjectList('id');
             } catch (RuntimeException $e) {
                 return null;
             }
             // Translate branch nodes if possible.
             $language = JFactory::getLanguage();
             foreach ($branches[$bk]->nodes as $node_id => $node) {
                 if (trim($node->parent_title, '**') == 'Language') {
                     $title = FinderHelperLanguage::branchLanguageTitle($node->title);
                 } else {
                     $key = FinderHelperLanguage::branchPlural($node->title);
                     $title = $language->hasKey($key) ? JText::_($key) : $node->title;
                 }
                 $branches[$bk]->nodes[$node_id]->title = $title;
             }
             // Add the Search All option to the branch.
             array_unshift($branches[$bk]->nodes, array('id' => null, 'title' => JText::_('COM_FINDER_FILTER_SELECT_ALL_LABEL')));
         }
         // Store the data in cache.
         $cache->store($branches, $cacheId);
     }
     $html = '';
     // Add the dates if enabled.
     if ($showDates) {
//.........这里部分代码省略.........
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:101,代码来源:filter.php

示例5: select


//.........这里部分代码省略.........
         $sql->select('t.*, count(c.id) AS children');
         $sql->from($db->quoteName('#__finder_taxonomy') . ' AS t');
         $sql->join('INNER', $db->quoteName('#__finder_taxonomy') . ' AS c ON c.parent_id = t.id');
         $sql->where($db->quoteName('t') . '.' . $db->quoteName('parent_id') . ' = 1');
         $sql->where($db->quoteName('t') . '.' . $db->quoteName('state') . ' = 1');
         $sql->where($db->quoteName('t') . '.' . $db->quoteName('access') . ' IN (' . $groups . ')');
         $sql->where($db->quoteName('c') . '.' . $db->quoteName('state') . ' = 1');
         $sql->where($db->quoteName('t') . '.' . $db->quoteName('access') . ' IN (' . $groups . ')');
         $sql->group($db->quoteName('t') . '.' . $db->quoteName('id'));
         $sql->order('t.ordering, t.title');
         // Limit the branch children to a predefined filter.
         if (!empty($filter->data)) {
             $sql->where('c.id IN(' . $filter->data . ')');
         }
         // Load the branches.
         $db->setQuery($sql);
         $branches = $db->loadObjectList('id');
         // Check for an error.
         if ($db->getErrorNum()) {
             return null;
         }
         // Check that we have at least one branch.
         if (count($branches) === 0) {
             return null;
         }
         // Iterate through the branches and build the branch groups.
         foreach ($branches as $bk => $bv) {
             // If the multi-lang plug-in is enabled then drop the language branch.
             if ($bv->title == 'Language' && JLanguageMultilang::isEnabled()) {
                 continue;
             }
             // Build the query to get the child nodes for this branch.
             $sql->clear();
             $sql->select('t.*');
             $sql->from($db->quoteName('#__finder_taxonomy') . ' AS t');
             $sql->where($db->quoteName('t') . '.' . $db->quoteName('parent_id') . ' = ' . (int) $bk);
             $sql->where($db->quoteName('t') . '.' . $db->quoteName('state') . ' = 1');
             $sql->where($db->quoteName('t') . '.' . $db->quoteName('access') . ' IN (' . $groups . ')');
             $sql->order('t.ordering, t.title');
             // Limit the nodes to a predefined filter.
             if (!empty($filter->data)) {
                 $sql->where('t.id IN(' . $filter->data . ')');
             }
             // Load the branches.
             $db->setQuery($sql);
             $branches[$bk]->nodes = $db->loadObjectList('id');
             // Check for an error.
             if ($db->getErrorNum()) {
                 return null;
             }
             // Translate branch nodes if possible.
             $language = JFactory::getLanguage();
             foreach ($branches[$bk]->nodes as $node_id => $node) {
                 $key = FinderHelperLanguage::branchPlural($node->title);
                 if ($language->hasKey($key)) {
                     $branches[$bk]->nodes[$node_id]->title = JText::_($key);
                 }
             }
             // Add the Search All option to the branch.
             array_unshift($branches[$bk]->nodes, array('id' => null, 'title' => JText::_('COM_FINDER_FILTER_SELECT_ALL_LABEL')));
         }
         // Store the data in cache.
         $cache->store($branches, $cacheId);
     }
     $html = '';
     // Add the dates if enabled.
     if ($showDates) {
         $html .= JHtml::_('filter.dates', $query, $options);
     }
     $html .= '<ul id="finder-filter-select-list">';
     // Iterate through all branches and build code.
     foreach ($branches as $bk => $bv) {
         // If the multi-lang plug-in is enabled then drop the language branch.
         if ($bv->title == 'Language' && JLanguageMultilang::isEnabled()) {
             continue;
         }
         $active = null;
         // Check if the branch is in the filter.
         if (array_key_exists($bv->title, $query->filters)) {
             // Get the request filters.
             $temp = JFactory::getApplication()->input->request->get('t', array(), 'array');
             // Search for active nodes in the branch and get the active node.
             $active = array_intersect($temp, $query->filters[$bv->title]);
             $active = count($active) === 1 ? array_shift($active) : null;
         }
         $html .= '<li class="filter-branch' . $classSuffix . '">';
         $html .= '<label for="tax-' . JFilterOutput::stringUrlSafe($bv->title) . '">';
         $html .= JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL', JText::_(FinderHelperLanguage::branchSingular($bv->title)));
         $html .= '</label>';
         $html .= JHtml::_('select.genericlist', $branches[$bk]->nodes, 't[]', 'class="inputbox"', 'id', 'title', $active, 'tax-' . JFilterOutput::stringUrlSafe($bv->title));
         $html .= '</li>';
     }
     // Close the widget.
     $html .= '</ul>';
     // Load the CSS/JS resources.
     if ($loadMedia) {
         JHtml::stylesheet('com_finder/sliderfilter.css', false, true, false);
     }
     return $html;
 }
开发者ID:exntu,项目名称:joomla-cms,代码行数:101,代码来源:filter.php


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