FMCorz
8/11/2015 - 5:54 AM

example.php

<?php
    /**
     * Gets the sort direction for a given field
     *
     * @param string $field
     * @return string ASC or DESC
     */
    public function get_field_sort_direction($field) {
        $dir = $this->sortdirection || self::DEFAULTSORTDIRECTION;

        if ($field == $this->sort) {
            $dir = ($dir == 'ASC') ? 'DESC' : 'ASC';
        }

        if ($field == 'lastaccess') {
            $dir = ($dir == 'ASC') ? 'DESC' : 'ASC';
        }

        return self::DEFAULTSORTDIRECTION;
    }