protected function _sort()
    {
        if (!isset($this->_sorts) || count($this->_sorts) === 0) {
            return;
        }

        $columns      = $this->_dataGrid->getActiveColumnsOrdered();
        $sorts        = $this->_sorts;
        $sortPosition = $this->_sortPositions;

        usort($this->_output, function ($a, $b) use ($columns, $sortPosition, $sorts) {
            foreach ($sortPosition as $colIndex) {
                $sort = $sorts[$colIndex];
                /** @var $sort\RBM\Datagrid\Data\Sort */
                /** @var $column\RBM\Datagrid\Column */
                $column = $columns[$colIndex];
                $valueA = $column->getSortData($a);
                $valueB = $column->getSortData($b);

                if ($valueA == $valueB) {
                    continue;
                }

                $arr = array($valueA, $valueB);

                $args = array_merge(array(&$arr), array($sort->getDirection(), $sort->getType()));
                call_user_func_array('array_multisort', $args);

                return ($arr[0] == $valueA) ? -1 : 1;
            }
            return 0;
        });
    }
protected function _sort()
    {
        if (!isset($this->_sorts) || count($this->_sorts) === 0) {
            return;
        }

        $columns      = $this->_dataGrid->getActiveColumnsOrdered();
        $sorts        = $this->_sorts;
        $sortPosition = $this->_sortPositions;

        usort($this->_output, function ($a, $b) use ($columns, $sortPosition, $sorts) {
            foreach ($sortPosition as $colIndex) {
                $sort = $sorts[$colIndex];
                /** @var $sort\RBM\Datagrid\Data\Sort */
                /** @var $column\RBM\Datagrid\Column */
                $column = $columns[$colIndex];
                $valueA = $column->getSortData($a);
                $valueB = $column->getSortData($b);

                if ($valueA == $valueB) {
                    continue;
                }

                $arr = array($valueA, $valueB);

                $args = array_merge(array(&$arr), array($sort->getDirection(), $sort->getType()));
                call_user_func_array('array_multisort', $args);

                return ($arr[0] == $valueA) ? -1 : 1;
            }
            return 0;
        });
    }
protected function _sort ( ) { if ( ! isset ( $ this -> _sorts ) || count ( $ this -> _sorts ) === 0 ) { return ; } $ columns = $ this -> _dataGrid -> getActiveColumnsOrdered ( ) ; $ sorts = $ this -> _sorts ; $ sortPosition = $ this -> _sortPositions ; usort ( $ this -> _output , function ( $ a , $ b ) use ( $ columns , $ sortPosition , $ sorts ) { foreach ( $ sortPosition as $ colIndex ) { $ sort = $ sorts [ $ colIndex ] ; /** @var $sort\RBM\Datagrid\Data\Sort */ /** @var $column\RBM\Datagrid\Column */ $ column = $ columns [ $ colIndex ] ; $ valueA = $ column -> getSortData ( $ a ) ; $ valueB = $ column -> getSortData ( $ b ) ; if ( $ valueA == $ valueB ) { continue ; } $ arr = array ( $ valueA , $ valueB ) ; $ args = array_merge ( array ( & $ arr ) , array ( $ sort -> getDirection ( ) , $ sort -> getType ( ) ) ) ; call_user_func_array ( 'array_multisort' , $ args ) ; return ( $ arr [ 0 ] == $ valueA ) ? - 1 : 1 ; } return 0 ; } ) ; }
Performs an array_multisort, based on the sorts defined
Performs an array_multisort based on the sorts defined