Source for file helper.php

Documentation is available at helper.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  mod_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.txt
  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. {
  20.     /**
  21.      * Method to get hidden input fields for a get form so that control variables
  22.      * are not lost upon form submission.
  23.      *
  24.      * @param   string   $route      The route to the page. [optional]
  25.      * @param   integer  $paramItem  The menu item ID. (@since 3.1) [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$paramItem 0)
  32.     {
  33.         $fields null;
  34.         $uri JUri::getInstance(JRoute::_($route));
  35.         $uri->delVar('q');
  36.         $elements $uri->getQuery(true);
  37.  
  38.         // Create hidden input elements for each part of the URI.
  39.         // Add the current menu id if it doesn't have one
  40.         foreach ($elements as $n => $v)
  41.         {
  42.             if ($n == 'Itemid')
  43.             {
  44.                 continue;
  45.             }
  46.             $fields .= '<input type="hidden" name="' $n '" value="' $v '" />';
  47.         }
  48.  
  49.         /*
  50.          * Figure out the Itemid value
  51.          * First, check if the param is set.  If not, fall back to the Itemid from the JInput object
  52.          */
  53.         $Itemid $paramItem $paramItem JFactory::getApplication()->input->getInt('Itemid');
  54.         $fields .= '<input type="hidden" name="Itemid" value="' $Itemid '" />';
  55.  
  56.         return $fields;
  57.     }
  58.  
  59.     /**
  60.      * Get Smart Search query object.
  61.      *
  62.      * @param   JRegistry  $params  Module parameters.
  63.      *
  64.      * @return  FinderIndexerQuery object
  65.      *
  66.      * @since   2.5
  67.      */
  68.     public static function getQuery($params)
  69.     {
  70.         $app JFactory::getApplication();
  71.         $input $app->input;
  72.         $request $input->request;
  73.         $filter JFilterInput::getInstance();
  74.  
  75.         // Get the static taxonomy filters.
  76.         $options array();
  77.         $options['filter'($request->get('f'0'int'!= 0$request->get('f''''int'$params->get('searchfilter');
  78.         $options['filter'$filter->clean($options['filter']'int');
  79.  
  80.         // Get the dynamic taxonomy filters.
  81.         $options['filters'$request->get('t''''array');
  82.         $options['filters'$filter->clean($options['filters']'array');
  83.         JArrayHelper::toInteger($options['filters']);
  84.  
  85.         // Instantiate a query object.
  86.         $query new FinderIndexerQuery($options);
  87.  
  88.         return $query;
  89.     }
  90. }

Documentation generated on Tue, 19 Nov 2013 15:04:16 +0100 by phpDocumentor 1.4.3