[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/modules/mod_finder/ -> helper.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Site
   4   * @subpackage  mod_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  /**
  13   * Finder module helper.
  14   *
  15   * @package     Joomla.Site
  16   * @subpackage  mod_finder
  17   * @since       2.5
  18   */
  19  class ModFinderHelper
  20  {
  21      /**
  22       * Method to get hidden input fields for a get form so that control variables
  23       * are not lost upon form submission.
  24       *
  25       * @param   string  $route  The route to the page. [optional]
  26       *
  27       * @return  string  A string of hidden input form fields
  28       *
  29       * @since   2.5
  30       */
  31  	public static function getGetFields($route = null)
  32      {
  33          $fields = null;
  34          $uri = JURI::getInstance(JRoute::_($route));
  35          $uri->delVar('q');
  36  
  37          // Create hidden input elements for each part of the URI.
  38          // Add the current menu id if it doesn't have one
  39          $needId = true;
  40          foreach ($uri->getQuery(true) as $n => $v)
  41          {
  42              $fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
  43              if ($n == 'Itemid') {
  44                  $needId = false;
  45              }
  46          }
  47          if ($needId) {
  48              $fields .= '<input type="hidden" name="Itemid" value="' . JFactory::getApplication()->input->get('Itemid', '0', 'int') . '" />';
  49          }
  50          return $fields;
  51      }
  52  
  53      /**
  54       * Get Smart Search query object.
  55       *
  56       * @param   JRegistry object containing module parameters.
  57       *
  58       * @return  FinderIndexerQuery object
  59       *
  60       * @since   2.5
  61       */
  62  	public static function getQuery($params)
  63      {
  64          $app = JFactory::getApplication();
  65          $input = $app->input;
  66          $request = $input->request;
  67          $filter = JFilterInput::getInstance();
  68  
  69          // Get the static taxonomy filters.
  70          $options = array();
  71          $options['filter'] = !is_null($request->get('f')) ? $request->get('f', '', 'int') : $params->get('f');
  72          $options['filter'] = $filter->clean($options['filter'], 'int');
  73  
  74          // Get the dynamic taxonomy filters.
  75          $options['filters'] = !is_null($request->get('t')) ? $request->get('t', '', 'array') : $params->get('t');
  76          $options['filters'] = $filter->clean($options['filters'], 'array');
  77          JArrayHelper::toInteger($options['filters']);
  78  
  79          // Instantiate a query object.
  80          $query = new FinderIndexerQuery($options);
  81  
  82          return $query;
  83      }
  84  
  85  }


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