Source for file searchtools.php
Documentation is available at searchtools.php
* @package Joomla.Libraries
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @package Joomla.Libraries
* @var array Array containing information for loaded files
protected static $loaded =
array();
* Load the main Searchtools libraries
public static function main()
if (empty(static::$loaded[__METHOD__
]))
// Requires jQuery but allows to skip its loading
if ($loadJquery =
(!isset
($options['loadJquery']) ||
$options['loadJquery'] !=
0))
JHtml::_('jquery.framework');
// Load the jQuery plugin && CSS
JHtml::_('script', 'jui/jquery.searchtools.min.js', false, true);
JHtml::_('stylesheet', 'jui/jquery.searchtools.css', false, true);
static::$loaded[__METHOD__
] =
true;
* Load searchtools for a specific form
* @param mixed $selector Is debugging mode on? [optional]
* @param array $options Optional array of parameters for search tools
public static function form($selector =
'.js-stools-form', $options =
array())
if (!isset
(static::$loaded[__METHOD__
][$sig]))
// Include Bootstrap framework
// Add the form selector to the search tools options
$options['formSelector'] =
$selector;
// Generate options with default values
$options =
static::options2Jregistry($options);
$(document).ready(function() {
$('" .
$selector .
"').searchtools(
" .
$options->toString() .
"
$doc->addScriptDeclaration($script);
static::$loaded[__METHOD__
][$sig] =
true;
* Function to receive & pre-process javascript options
* @param mixed $options Associative array/JRegistry object with options
* @return JRegistry Options converted to JRegistry object
if (!($options instanceof
Jregistry))
* Method to sort a column in a grid
* @param string $title The link title
* @param string $order The order field for the column
* @param string $direction The current direction
* @param mixed $selected The selected ordering
* @param string $task An optional task override
* @param string $new_direction An optional direction for the new column
* @param string $tip An optional text shown as tooltip title instead of $title
* @param string $icon Icon to show
* @param string $formName Name of the form to submit
public static function sort($title, $order, $direction =
'asc', $selected =
0, $task =
null, $new_direction =
'asc', $tip =
'', $icon =
null, $formName =
'adminForm')
$orderIcons =
array('icon-arrow-up-3', 'icon-arrow-down-3');
$index = (int)
($direction ==
'desc');
$direction =
$new_direction;
$direction =
($direction ==
'desc') ?
'asc' :
'desc';
// Create an object to pass it to the layouts
$data->direction =
$direction;
$data->selected =
$selected;
$data->orderIcon =
$orderIcons[$index];
$data->formName =
$formName;
Documentation generated on Tue, 19 Nov 2013 15:12:47 +0100 by phpDocumentor 1.4.3