public static string
sort
(mixed $title, mixed $order, mixed $direction = 'asc', mixed $selected = 0, mixed $task = null, mixed $new_direction = 'asc', mixed $tip = '', mixed $form = '', mixed $suffix = '')
/**
* 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 string $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
*
* @return string
*
* @since 1.5
*/
/*
* GRID in frontend must be customized
* because Joomla! takes "adminForm" as the only one name of form ??????????????????????????????????????????
*
*/
public static function sort($title, $order, $direction = 'asc', $selected = 0, $task = null, $new_direction = 'asc', $tip = '', $form = '', $suffix = '')
{
$direction = strtolower($direction);
$icon = array('arrow-up-3', 'arrow-down-3');
$index = (int) ($direction == 'desc');
if ($order != $selected) {
$direction = $new_direction;
} else {
$direction = $direction == 'desc' ? 'asc' : 'desc';
}
$html = '<a href="#" onclick="Joomla.tableOrderingPhoca(\'' . $order . '\',\'' . $direction . '\',\'' . $task . '\',\'' . $form . '\',\'' . $suffix . '\');return false;"' . ' class="hasTooltip" title="' . HTMLHelper::tooltipText($tip ? $tip : $title, 'JGLOBAL_CLICK_TO_SORT_THIS_COLUMN') . '">';
if (isset($title['0']) && $title['0'] == '<') {
$html .= $title;
} else {
$html .= Text::_($title);
}
if ($order == $selected) {
$html .= ' <i class="icon-' . $icon[$index] . ' glyphicon glyphicon-' . $icon[$index] . '"></i>';
}
$html .= '</a>';
return $html;
}