Source for file finder.php

Documentation is available at finder.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_finder
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 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.             ->select('DISTINCT t.title AS text, t.id AS value')
  38.             ->from($db->quoteName('#__finder_types'' AS t')
  39.             ->join('LEFT'$db->quoteName('#__finder_links'' AS l ON l.type_id = t.id')
  40.             ->order('t.title ASC');
  41.         $db->setQuery($query);
  42.  
  43.         try
  44.         {
  45.             $rows $db->loadObjectList();
  46.         }
  47.         catch (RuntimeException $e)
  48.         {
  49.             return;
  50.         }
  51.  
  52.         // Compile the options.
  53.         $options array();
  54.  
  55.         foreach ($rows as $row)
  56.         {
  57.             $key $lang->hasKey(FinderHelperLanguage::branchPlural($row->text))
  58.                     ? FinderHelperLanguage::branchPlural($row->text$row->text;
  59.             $string JText::sprintf('COM_FINDER_ITEM_X_ONLY'JText::_($key));
  60.             $options[JHtml::_('select.option'$row->value$string);
  61.         }
  62.  
  63.         return $options;
  64.     }
  65.  
  66.     /**
  67.      * Creates a list of maps.
  68.      *
  69.      * @return  array  An array containing the maps that can be selected.
  70.      *
  71.      * @since   2.5
  72.      */
  73.     public static function mapslist()
  74.     {
  75.         $lang JFactory::getLanguage();
  76.  
  77.         // Load the finder types.
  78.         $db JFactory::getDbo();
  79.         $query $db->getQuery(true)
  80.             ->select('title AS text, id AS value')
  81.             ->from($db->quoteName('#__finder_taxonomy'))
  82.             ->where($db->quoteName('parent_id'' = 1')
  83.             ->order('ordering, title ASC');
  84.         $db->setQuery($query);
  85.  
  86.         try
  87.         {
  88.             $rows $db->loadObjectList();
  89.         }
  90.         catch (RuntimeException $e)
  91.         {
  92.             return;
  93.         }
  94.  
  95.         // Compile the options.
  96.         $options array();
  97.         $options[JHtml::_('select.option''1'JText::_('COM_FINDER_MAPS_BRANCHES'));
  98.  
  99.         foreach ($rows as $row)
  100.         {
  101.             $key $lang->hasKey(FinderHelperLanguage::branchPlural($row->text))
  102.                     ? FinderHelperLanguage::branchPlural($row->text$row->text;
  103.             $string JText::sprintf('COM_FINDER_ITEM_X_ONLY'JText::_($key));
  104.             $options[JHtml::_('select.option'$row->value$string);
  105.         }
  106.  
  107.         return $options;
  108.     }
  109.  
  110.     /**
  111.      * Creates a list of published states.
  112.      *
  113.      * @return  array  An array containing the states that can be selected.
  114.      *
  115.      * @since   2.5
  116.      */
  117.     public static function statelist()
  118.     {
  119.         $options array();
  120.         $options[JHtml::_('select.option''1'JText::sprintf('COM_FINDER_ITEM_X_ONLY'JText::_('JPUBLISHED')));
  121.         $options[JHtml::_('select.option''0'JText::sprintf('COM_FINDER_ITEM_X_ONLY'JText::_('JUNPUBLISHED')));
  122.  
  123.         return $options;
  124.     }
  125. }

Documentation generated on Tue, 19 Nov 2013 15:03:22 +0100 by phpDocumentor 1.4.3