diff options
Diffstat (limited to 'codebase/base_connector.php')
-rw-r--r-- | codebase/base_connector.php | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php index ab11cb5..26f1f8b 100644 --- a/codebase/base_connector.php +++ b/codebase/base_connector.php @@ -288,6 +288,10 @@ class Connector { protected $encoding="utf-8";//!< assigned encoding (UTF-8 by default) protected $editing=false;//!< flag of edit mode ( response for dataprocessor ) + public static $filter_var="dhx_filter"; + public static $sort_var="dhx_sort"; + public static $kids_var="dhx_kids"; + public $model=false; private $updating=false;//!< flag of update mode ( response for data-update ) @@ -309,7 +313,8 @@ class Connector { protected $filters; protected $sorts; protected $mix; - + protected $order = false; + /*! constructor Here initilization of all Masters occurs, execution timer initialized @@ -590,22 +595,26 @@ class Connector { $this->request->set_user($_GET["dhx_user"]); } - if (isset($_GET["dhx_sort"])) - foreach($_GET["dhx_sort"] as $k => $v){ + if (isset($_GET[Connector::$sort_var])) + foreach($_GET[Connector::$sort_var] as $k => $v){ $k = $this->safe_field_name($k); $this->request->set_sort($this->resolve_parameter($k),$v); } - if (isset($_GET["dhx_filter"])) - foreach($_GET["dhx_filter"] as $k => $v){ + if (isset($_GET[Connector::$filter_var])) + foreach($_GET[Connector::$filter_var] as $k => $v){ $k = $this->safe_field_name($k); - $this->request->set_filter($this->resolve_parameter($k),$v); + if ($v !== "") + $this->request->set_filter($this->resolve_parameter($k),$v); } + $this->check_csrf(); + } + + protected function check_csrf(){ $key = ConnectorSecurity::checkCSRF($this->editing); if ($key !== "") - $this->add_top_attribute("dhx_security", $key); - + $this->add_top_attribute(ConnectorSecurity::$security_var, $key); } /*! convert incoming request name to the actual DB name @@ -701,7 +710,23 @@ class Connector { */ public function dynamic_loading($count){ $this->dload=$count; - } + } + + /*! enable or disable data reordering + + @param name + name of field, which will be used for order storing, optional + by default 'sortorder' field will be used + */ + public function enable_order($name = true){ + if ($name === true) + $name = "sortorder"; + + $this->sort($name); + $this->access->allow("order"); + $this->request->set_order($name); + $this->order = $name; + } /*! enable logging @@ -750,7 +775,10 @@ class Connector { */ protected function xml_end(){ $this->fill_collections(); - return $this->extra_output."</data>"; + if (isset($this->extra_output)) + return $this->extra_output."</data>"; + else + return "</data>"; } protected function fill_collections($list=""){ |