Source for file suggestions.php
Documentation is available at suggestions.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/indexer');
* Suggestions model class for the Finder package.
* Context string for the model type.
protected $context =
'com_finder.suggestions';
* Method to get an array of data items.
* @return array An array of data items.
// Convert them to a simple array.
foreach ($items as $k =>
$v)
* Method to build a database query to load the list data.
* @return JDatabaseQuery A database query
// Create a new query object.
$query =
$db->getQuery(true);
// Select required fields
->from($db->quoteName('#__finder_terms') .
' AS t')
->where('t.term LIKE ' .
$db->quote($db->escape($this->getState('input'), true) .
'%'))
->where('t.language IN (' .
$db->quote($db->escape($this->getState('language'), true)) .
', ' .
$db->quote('*') .
')')
->order('t.weight DESC');
* Method to get a store id based on model the configuration state.
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* @param string $id An identifier string to generate the store id. [optional]
* @return string A store id.
// Add the search query state.
$id .=
':' .
$this->getState('language');
$id .=
':' .
$this->getState('list.start');
$id .=
':' .
$this->getState('list.limit');
* Method to auto-populate the model state. Calling getState in this method will result in recursion.
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
protected function populateState($ordering =
null, $direction =
null)
// Get the configuration options.
$this->setState('input', $input->request->get('q', '', 'string'));
// Set the query language
$this->setState('user.id', (int)
$user->get('id'));
Documentation generated on Tue, 19 Nov 2013 15:14:44 +0100 by phpDocumentor 1.4.3