Back to PhocaDownloadOrdering class

Method getOrderingText

public static
getOrderingText
(mixed $ordering, mixed $type = 1)

Method getOrderingText - Source code

public static function getOrderingText($ordering, $type = 1)
{
    $pref = 'c';
    if ($type == 2) {
        $pref = 'cc';
    } else {
        if ($type == 3) {
            $pref = 'a';
        }
    }
    switch ((int) $ordering) {
        case 2:
            $orderingOutput = 'ordering DESC';
            break;
        case 3:
            $orderingOutput = 'title ASC';
            break;
        case 4:
            $orderingOutput = 'title DESC';
            break;
        case 5:
            $orderingOutput = 'date ASC';
            break;
        case 6:
            $orderingOutput = 'date DESC';
            break;
        case 7:
            $orderingOutput = 'id ASC';
            break;
        case 8:
            $orderingOutput = 'id DESC';
            break;
        case 9:
            $orderingOutput = 'hits ASC';
            break;
        case 10:
            $orderingOutput = 'hits DESC';
            break;
        case 11:
            $orderingOutput = 'filename ASC';
            break;
        case 12:
            $orderingOutput = 'filename DESC';
            break;
        case 13:
            $orderingOutput = 'average ASC';
            $pref = 'r';
            break;
        case 14:
            $orderingOutput = 'average DESC';
            $pref = 'r';
            break;
        case 15:
            $orderingOutput = 'count ASC';
            $pref = 'r';
            break;
        case 16:
            $orderingOutput = 'count DESC';
            $pref = 'r';
            break;
        case 17:
            $orderingOutput = 'publish_up ASC';
            break;
        case 18:
            $orderingOutput = 'publish_up DESC';
            break;
        case 19:
            $orderingOutput = 'publish_down ASC';
            break;
        case 20:
            $orderingOutput = 'publish_down DESC';
            break;
        case 1:
        default:
            $orderingOutput = 'ordering ASC';
            break;
    }
    return $pref . '.' . $orderingOutput;
}