diff options
author | Egor <egor.26.93@gmail.com> | 2015-06-12 16:06:06 +0300 |
---|---|---|
committer | Egor <egor.26.93@gmail.com> | 2015-06-12 16:06:06 +0300 |
commit | 9abd184a386a2594398df9f5cd7bd6d5b9c240fc (patch) | |
tree | 6b237196dd4ae8bdee61093308f5c3dcdcc5c79e /codebase/Dhtmlx/Connector/TreeDataConnector.php | |
parent | 5fbd0adda5155853e86001fad4c571008f09f01b (diff) | |
download | connector-php-9abd184a386a2594398df9f5cd7bd6d5b9c240fc.zip connector-php-9abd184a386a2594398df9f5cd7bd6d5b9c240fc.tar.gz connector-php-9abd184a386a2594398df9f5cd7bd6d5b9c240fc.tar.bz2 |
Updated structure. Added connectors.
Diffstat (limited to 'codebase/Dhtmlx/Connector/TreeDataConnector.php')
-rw-r--r-- | codebase/Dhtmlx/Connector/TreeDataConnector.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/codebase/Dhtmlx/Connector/TreeDataConnector.php b/codebase/Dhtmlx/Connector/TreeDataConnector.php new file mode 100644 index 0000000..61c1384 --- /dev/null +++ b/codebase/Dhtmlx/Connector/TreeDataConnector.php @@ -0,0 +1,53 @@ +<?php +namespace Dhtmlx\Connector; + +class TreeDataConnector extends DataConnector { + protected $parent_name = 'parent'; + public $rootId = "0"; + + /*! constructor + + Here initilization of all Masters occurs, execution timer initialized + @param res + db connection resource + @param type + string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided + @param item_type + name of class, which will be used for item rendering, optional, DataItem will be used by default + @param data_type + name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default. + * @param render_type + * name of class which will provides data rendering + */ + public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){ + if (!$item_type) $item_type="TreeCommonDataItem"; + if (!$data_type) $data_type="CommonDataProcessor"; + if (!$render_type) $render_type="TreeRenderStrategy"; + parent::__construct($res,$type,$item_type,$data_type,$render_type); + } + + //parse GET scoope, all operations with incoming request must be done here + protected function parse_request(){ + parent::parse_request(); + + if (isset($_GET[$this->parent_name])) + $this->request->set_relation($_GET[$this->parent_name]); + else + $this->request->set_relation($this->rootId); + + $this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode + } + + /*! renders self as xml, starting part + */ + protected function xml_start(){ + $attributes = " "; + if (!$this->rootId || $this->rootId != $this->request->get_relation()) + $attributes = " parent='".$this->request->get_relation()."' "; + + foreach($this->attributes as $k=>$v) + $attributes .= " ".$k."='".$v."'"; + + return "<data".$attributes.">"; + } +}
\ No newline at end of file |