summaryrefslogtreecommitdiffstats
path: root/codebase/base_connector.php
diff options
context:
space:
mode:
authorDmitry <dmitry@dhtmlx.com>2012-07-10 16:39:55 +0200
committerDmitry <dmitry@dhtmlx.com>2012-07-10 16:39:55 +0200
commitfb37b3dc462d73faead66b6c3d16cf5541bde57a (patch)
treea6e18055ddc1fb98fe6ceefece3decc888054b72 /codebase/base_connector.php
parent7a6710c4918b843d303694b4625fbdff2f1ba742 (diff)
downloadconnector-php-fb37b3dc462d73faead66b6c3d16cf5541bde57a.zip
connector-php-fb37b3dc462d73faead66b6c3d16cf5541bde57a.tar.gz
connector-php-fb37b3dc462d73faead66b6c3d16cf5541bde57a.tar.bz2
easy api for filtering
Diffstat (limited to 'codebase/base_connector.php')
-rw-r--r--codebase/base_connector.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php
index 8cf3625..9f0bb85 100644
--- a/codebase/base_connector.php
+++ b/codebase/base_connector.php
@@ -302,6 +302,7 @@ class Connector {
protected $extra_output="";//!< extra info which need to be sent to client side
protected $options=array();//!< hash of OptionsConnector
protected $as_string = false;
+ protected $filters;
/*! constructor
@@ -331,6 +332,7 @@ class Connector {
"render_class"=>$render_type
);
$this->attributes = array();
+ $this->filters = array();
$this->config = new DataConfig();
$this->request = new DataRequestConfig();
@@ -482,6 +484,7 @@ class Connector {
$wrap->store();
$wrap = new FilterInterface($this->request);
+ $this->apply_filters($wrap);
$this->event->trigger("beforeFilter",$wrap);
$wrap->store();
@@ -797,6 +800,17 @@ class Connector {
public function asString($as_string) {
$this->as_string = $as_string;
}
+
+ public function filter($name, $value = false, $operation = '=') {
+ $this->filters[] = array('name' => $name, 'value' => $value, 'operation' => $operation);
+ }
+
+ protected function apply_filters($wrap) {
+ for ($i = 0; $i < count($this->filters); $i++) {
+ $f = $this->filters[$i];
+ $wrap->add($f['name'], $f['value'], $f['operation']);
+ }
+ }
}