[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_finder/helpers/html/ -> finder.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Administrator
   4   * @subpackage  com_finder
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   7   * @license     GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  defined('_JEXEC') or die;
  11  
  12  JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php');
  13  
  14  /**
  15   * HTML behavior class for Finder.
  16   *
  17   * @package     Joomla.Administrator
  18   * @subpackage  com_finder
  19   * @since       2.5
  20   */
  21  abstract class JHtmlFinder
  22  {
  23      /**
  24       * Creates a list of types to filter on.
  25       *
  26       * @return  array  An array containing the types that can be selected.
  27       *
  28       * @since   2.5
  29       */
  30  	public static function typeslist()
  31      {
  32          $lang = JFactory::getLanguage();
  33  
  34          // Load the finder types.
  35          $db = JFactory::getDBO();
  36          $query = $db->getQuery(true);
  37          $query->select('DISTINCT t.title AS text, t.id AS value');
  38          $query->from($db->quoteName('#__finder_types') . ' AS t');
  39          $query->join('LEFT', $db->quoteName('#__finder_links') . ' AS l ON l.type_id = t.id');
  40          $query->order('t.title ASC');
  41          $db->setQuery($query);
  42          $rows = $db->loadObjectList();
  43  
  44          // Check for database errors.
  45          if ($db->getErrorNum())
  46          {
  47              return;
  48          }
  49  
  50          // Compile the options.
  51          $options = array();
  52  
  53          foreach ($rows as $row)
  54          {
  55              $key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text))
  56                      ? FinderHelperLanguage::branchPlural($row->text) : $row->text;
  57              $string = JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key));
  58              $options[] = JHtml::_('select.option', $row->value, $string);
  59          }
  60  
  61          return $options;
  62      }
  63  
  64      /**
  65       * Creates a list of maps.
  66       *
  67       * @return  array  An array containing the maps that can be selected.
  68       *
  69       * @since   2.5
  70       */
  71  	public static function mapslist()
  72      {
  73          $lang = JFactory::getLanguage();
  74  
  75          // Load the finder types.
  76          $db = JFactory::getDBO();
  77          $query = $db->getQuery(true);
  78          $query->select('title AS text, id AS value');
  79          $query->from($db->quoteName('#__finder_taxonomy'));
  80          $query->where($db->quoteName('parent_id') . ' = 1');
  81          $query->order('ordering, title ASC');
  82          $db->setQuery($query);
  83          $rows = $db->loadObjectList();
  84  
  85          // Check for database errors.
  86          if ($db->getErrorNum())
  87          {
  88              return;
  89          }
  90  
  91          // Compile the options.
  92          $options = array();
  93          $options[] = JHtml::_('select.option', '1', JText::_('COM_FINDER_MAPS_BRANCHES'));
  94  
  95          foreach ($rows as $row)
  96          {
  97              $key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text))
  98                      ? FinderHelperLanguage::branchPlural($row->text) : $row->text;
  99              $string = JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key));
 100              $options[] = JHtml::_('select.option', $row->value, $string);
 101          }
 102  
 103          return $options;
 104      }
 105  
 106      /**
 107       * Creates a list of published states.
 108       *
 109       * @return  array  An array containing the states that can be selected.
 110       *
 111       * @since   2.5
 112       */
 113  	public static function statelist()
 114      {
 115          $options = array();
 116          $options[] = JHtml::_('select.option', '1', JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_('JPUBLISHED')));
 117          $options[] = JHtml::_('select.option', '0', JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_('JUNPUBLISHED')));
 118  
 119          return $options;
 120      }
 121  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1