diff options
author | Dmitry <dmitry@dhtmlx.com> | 2012-05-08 14:58:11 +0200 |
---|---|---|
committer | Dmitry <dmitry@dhtmlx.com> | 2012-05-08 14:58:11 +0200 |
commit | 711583417091002845079cb20082a68152054640 (patch) | |
tree | 8e8debe51e30ee8f05832efdbf6e08ff09c27678 /codebase/treegrid_connector.php | |
parent | 78bc7500e7c9afb2be508c2ad1ee37f94bff70ef (diff) | |
download | connector-php-711583417091002845079cb20082a68152054640.zip connector-php-711583417091002845079cb20082a68152054640.tar.gz connector-php-711583417091002845079cb20082a68152054640.tar.bz2 |
implements RenderStrategy logic
Diffstat (limited to 'codebase/treegrid_connector.php')
-rw-r--r-- | codebase/treegrid_connector.php | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/codebase/treegrid_connector.php b/codebase/treegrid_connector.php index 308fcf4..f1270bf 100644 --- a/codebase/treegrid_connector.php +++ b/codebase/treegrid_connector.php @@ -66,10 +66,11 @@ class TreeGridConnector extends GridConnector{ @param data_type name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default. */ - public function __construct($res,$type=false,$item_type=false,$data_type=false){ + public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){ if (!$item_type) $item_type="TreeGridDataItem"; if (!$data_type) $data_type="TreeGridDataProcessor"; - parent::__construct($res,$type,$item_type,$data_type); + if (!$render_type) $render_type="TreeRenderStrategy"; + parent::__construct($res,$type,$item_type,$data_type,$render_type); $this->event->attach("afterInsert",array($this,"parent_id_correction_a")); $this->event->attach("beforeProcessing",array($this,"parent_id_correction_b")); @@ -106,32 +107,8 @@ class TreeGridConnector extends GridConnector{ $this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode } - - /*! process treegrid specific options in incoming request - */ - protected function render_set($res){ - $output=""; - $index=0; - while ($data=$this->sql->get_next($res)){ - $data = new $this->names["item_class"]($data,$this->config,$index); - $this->event->trigger("beforeRender",$data); - //there is no info about child elements, - //if we are using dyn. loading - assume that it has, - //in normal mode juse exec sub-render routine - if ($data->has_kids()===-1 && $this->dload) - $data->set_kids(true); - $output.=$data->to_xml_start(); - if ($data->has_kids()===-1 || ( $data->has_kids()==true && !$this->dload)){ - $sub_request = new DataRequestConfig($this->request); - $sub_request->set_relation($data->get_id()); - $output.=$this->render_set($this->sql->select($sub_request)); - } - $output.=$data->to_xml_end(); - $index++; - } - return $output; - } - + + /*! renders self as xml, starting part */ protected function xml_start(){ |