<?php
// No direct access
defined('_JEXEC') or die;

class sortGrid extends JHtmlGrid
{
    public static function sort($title, $order, $direction = 'asc', $selected = '', $task = null, $new_direction = 'asc', $tip = '')
    {
        JHtml::_('behavior.core');
        // JHtml::_('bootstrap.tooltip');

        $direction = strtolower($direction);
        $icon = array('sort-up', 'sort-down');
        $index = (int) ($direction == 'desc');

        if ($order != $selected)
        {
            $direction = $new_direction;
        }
        else
        {
            $direction = ($direction == 'desc') ? 'asc' : 'desc';
        }

        $html = '<a href="#" onclick="Joomla.tableOrdering(\'' . $order . '\',\'' . $direction . '\',\'' . $task . '\');return false;"'
            . ' data-uk-tooltip title="' . JHtml::tooltipText(($tip ? $tip : $title), 'JGLOBAL_CLICK_TO_SORT_THIS_COLUMN') . '">';

        if (isset($title['0']) && $title['0'] == '<')
        {
            $html .= $title;
        }
        else
        {
            $html .= JText::_($title);
        }

        $html .= '</a>';

        if ($order == $selected)
        {
            $html .= ' <i class="uk-icon-' . $icon[$index] . '"></i>';
        }
		
		
        return $html;
    }
}