public function getSecondaryColumnToSort(Row $row, $primaryColumnToSort)
    {
        $defaultSecondaryColumn = array(Metrics::INDEX_NB_VISITS, 'nb_visits');

        if (in_array($primaryColumnToSort, $defaultSecondaryColumn)) {
            // if sorted by visits, then sort by label as a secondary column
            $column = 'label';
            $value  = $row->hasColumn($column);
            if ($value !== false) {
                return $column;
            }

            return null;
        }

        if ($primaryColumnToSort !== 'label') {
            // we do not add this by default to make sure we do not sort by label as a first and secondary column
            $defaultSecondaryColumn[] = 'label';
        }

        foreach ($defaultSecondaryColumn as $column) {
            $value = $row->hasColumn($column);
            if ($value !== false) {
                return $column;
            }
        }
    }
public function getSecondaryColumnToSort(Row $row, $primaryColumnToSort)
    {
        $defaultSecondaryColumn = array(Metrics::INDEX_NB_VISITS, 'nb_visits');

        if (in_array($primaryColumnToSort, $defaultSecondaryColumn)) {
            // if sorted by visits, then sort by label as a secondary column
            $column = 'label';
            $value  = $row->hasColumn($column);
            if ($value !== false) {
                return $column;
            }

            return null;
        }

        if ($primaryColumnToSort !== 'label') {
            // we do not add this by default to make sure we do not sort by label as a first and secondary column
            $defaultSecondaryColumn[] = 'label';
        }

        foreach ($defaultSecondaryColumn as $column) {
            $value = $row->hasColumn($column);
            if ($value !== false) {
                return $column;
            }
        }
    }
public function getSecondaryColumnToSort ( Row $ row , $ primaryColumnToSort ) { $ defaultSecondaryColumn = array ( Metrics :: INDEX_NB_VISITS , 'nb_visits' ) ; if ( in_array ( $ primaryColumnToSort , $ defaultSecondaryColumn ) ) { // if sorted by visits, then sort by label as a secondary column $ column = 'label' ; $ value = $ row -> hasColumn ( $ column ) ; if ( $ value !== false ) { return $ column ; } return null ; } if ( $ primaryColumnToSort !== 'label' ) { // we do not add this by default to make sure we do not sort by label as a first and secondary column $ defaultSecondaryColumn [ ] = 'label' ; } foreach ( $ defaultSecondaryColumn as $ column ) { $ value = $ row -> hasColumn ( $ column ) ; if ( $ value !== false ) { return $ column ; } } }
Detect the secondary sort column to be used for sorting

@param Row $row
@param int|string $primaryColumnToSort
@return int
Detect the secondary sort column to be used for sorting