summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/Event
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/Dhtmlx/Connector/Event')
-rw-r--r--codebase/Dhtmlx/Connector/Event/EventInterface.php37
-rw-r--r--codebase/Dhtmlx/Connector/Event/FilterInterface.php32
-rw-r--r--codebase/Dhtmlx/Connector/Event/SortInterface.php31
3 files changed, 100 insertions, 0 deletions
diff --git a/codebase/Dhtmlx/Connector/Event/EventInterface.php b/codebase/Dhtmlx/Connector/Event/EventInterface.php
new file mode 100644
index 0000000..645d89b
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Event/EventInterface.php
@@ -0,0 +1,37 @@
+<?php
+namespace DHTMLX\Connector\Event;
+
+class EventInterface{
+ protected $request; ////!< DataRequestConfig instance
+ public $rules=array(); //!< array of sorting rules
+
+ /*! constructor
+ creates a new interface based on existing request
+ @param request
+ DataRequestConfig object
+ */
+ public function __construct($request){
+ $this->request = $request;
+ }
+
+ /*! remove all elements from collection
+ */
+ public function clear(){
+ array_splice($rules,0);
+ }
+ /*! get index by name
+
+ @param name
+ name of field
+ @return
+ index of named field
+ */
+ public function index($name){
+ $len = sizeof($this->rules);
+ for ($i=0; $i < $len; $i++) {
+ if ($this->rules[$i]["name"]==$name)
+ return $i;
+ }
+ return false;
+ }
+}
diff --git a/codebase/Dhtmlx/Connector/Event/FilterInterface.php b/codebase/Dhtmlx/Connector/Event/FilterInterface.php
new file mode 100644
index 0000000..e37489d
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Event/FilterInterface.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace DHTMLX\Connector\Event;
+
+/*! Wrapper for collection of filtering rules
+**/
+class FilterInterface extends EventInterface{
+ /*! constructor
+ creates a new interface based on existing request
+ @param request
+ DataRequestConfig object
+ */
+ public function __construct($request){
+ $this->request = $request;
+ $this->rules = &$request->get_filters_ref();
+ }
+ /*! add new filatering rule
+
+ @param name
+ name of field
+ @param value
+ value to filter by
+ @param rule
+ filtering rule
+ */
+ public function add($name,$value,$rule){
+ $this->request->set_filter($name,$value,$rule);
+ }
+ public function store(){
+ $this->request->set_filters($this->rules);
+ }
+} \ No newline at end of file
diff --git a/codebase/Dhtmlx/Connector/Event/SortInterface.php b/codebase/Dhtmlx/Connector/Event/SortInterface.php
new file mode 100644
index 0000000..5e6aef4
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Event/SortInterface.php
@@ -0,0 +1,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);
+ }
+} \ No newline at end of file