summaryrefslogtreecommitdiffstats
path: root/codebase/Event/SortInterface.php
blob: 5e6aef453c52dddd0e30a115d04ec0fa00c410ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace DHTMLX\Connector\Event;

class SortInterface extends EventInterface{
    /*! constructor
        creates a new interface based on existing request
        @param request
            DataRequestConfig object
    */
    public function __construct($request){
        parent::__construct($request);
        $this->rules = &$request->get_sort_by_ref();
    }
    /*! add new sorting rule

        @param name
            name of field
        @param dir
            direction of sorting
    */
    public function add($name,$dir){
        if ($dir === false)
            $this->request->set_sort($name);
        else
            $this->request->set_sort($name,$dir);
    }
    public function store(){
        $this->request->set_sort_by($this->rules);
    }
}