diff options
author | Egor <egor.26.93@gmail.com> | 2015-06-18 16:02:50 +0300 |
---|---|---|
committer | Egor <egor.26.93@gmail.com> | 2015-06-18 16:02:50 +0300 |
commit | a0dc94dd471be520a280db2a9807ab7d40b7bbee (patch) | |
tree | 7696b369662853fba5979531928ce75831ce7a52 | |
parent | 4545f686b060fff791bca679f9fcc6512a666e60 (diff) | |
download | connector-php-a0dc94dd471be520a280db2a9807ab7d40b7bbee.zip connector-php-a0dc94dd471be520a280db2a9807ab7d40b7bbee.tar.gz connector-php-a0dc94dd471be520a280db2a9807ab7d40b7bbee.tar.bz2 |
Fixed bug with xml processing in gantt.
-rwxr-xr-x | codebase/Dhtmlx/Connector/Connector.php | 2 | ||||
-rw-r--r-- | codebase/Dhtmlx/Connector/Data/GanttLinksDataItem.php | 22 | ||||
-rwxr-xr-x | codebase/Dhtmlx/Connector/GanttConnector.php | 61 | ||||
-rw-r--r-- | codebase/Dhtmlx/Connector/GanttLinksConnector.php | 5 | ||||
-rwxr-xr-x | codebase/Dhtmlx/Connector/JSONGanttConnector.php | 58 |
5 files changed, 89 insertions, 59 deletions
diff --git a/codebase/Dhtmlx/Connector/Connector.php b/codebase/Dhtmlx/Connector/Connector.php index ec8ae9a..14521a2 100755 --- a/codebase/Dhtmlx/Connector/Connector.php +++ b/codebase/Dhtmlx/Connector/Connector.php @@ -71,7 +71,7 @@ class Connector { if (class_exists($dsnamespace.$type."DBDataWrapper",true)) $type.="DBDataWrapper"; if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\DataItem"; - if (!$data_type) $data_type="Dhtmlx\\Connector\\Data\\DataProcessor"; + if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\DataProcessor"; if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\RenderStrategy"; $this->names=array( diff --git a/codebase/Dhtmlx/Connector/Data/GanttLinksDataItem.php b/codebase/Dhtmlx/Connector/Data/GanttLinksDataItem.php new file mode 100644 index 0000000..0b53cf6 --- /dev/null +++ b/codebase/Dhtmlx/Connector/Data/GanttLinksDataItem.php @@ -0,0 +1,22 @@ +<?php +namespace Dhtmlx\Connector\Data; + +class GanttLinkDataItem extends DataItem { + + public function to_xml_start(){ + $str="<item id='".$this->xmlentities($this->get_id())."'"; + for ($i=0; $i < sizeof($this->config->data); $i++){ + $name=$this->config->data[$i]["name"]; + $db_name=$this->config->data[$i]["db_name"]; + $str.=" ".$name."='".$this->xmlentities($this->data[$name])."'"; + } + //output custom data + if ($this->userdata !== false) + foreach ($this->userdata as $key => $value){ + $str.=" ".$key."='".$this->xmlentities($value)."'"; + } + + return $str.">"; + } + +}
\ No newline at end of file diff --git a/codebase/Dhtmlx/Connector/GanttConnector.php b/codebase/Dhtmlx/Connector/GanttConnector.php index 84246cd..6017522 100755 --- a/codebase/Dhtmlx/Connector/GanttConnector.php +++ b/codebase/Dhtmlx/Connector/GanttConnector.php @@ -1,5 +1,12 @@ <?php namespace Dhtmlx\Connector; +use Dhtmlx\Connector\Tools\LogMaster; +use Dhtmlx\Connector\Tools\EventMaster; +use Dhtmlx\Connector\Event\SortInterface; +use Dhtmlx\Connector\Event\FilterInterface; +use Dhtmlx\Connector\DataStorage\ArrayDBDataWrapper; +use Dhtmlx\Connector\DataStorage\ArrayQueryWrapper; + /*! Connector class for dhtmlxGantt **/ @@ -93,4 +100,58 @@ class GanttConnector extends Connector { $links->render_table($table,$id,$fields,$extra); $this->set_options("links", $links); } + + /*! render self + process commands, output requested data as XML +*/ + public function render(){ + $this->event->trigger("onInit", $this); + EventMaster::trigger_static("connectorInit",$this); + + if (!$this->as_string) + $this->parse_request(); + $this->set_relation(); + + if ($this->live_update !== false && $this->updating!==false) { + $this->live_update->get_updates(); + } else { + if ($this->editing){ + if ($this->links_mode && isset($this->options["links"])) { + $this->options["links"]->save(); + } else { + $dp = new $this->names["data_class"]($this,$this->config,$this->request); + $dp->process($this->config,$this->request); + } + } else { + if (!$this->access->check("read")){ + LogMaster::log("Access control: read operation blocked"); + echo "Access denied"; + die(); + } + $wrap = new SortInterface($this->request); + $this->apply_sorts($wrap); + $this->event->trigger("beforeSort",$wrap); + $wrap->store(); + + $wrap = new FilterInterface($this->request); + $this->apply_filters($wrap); + $this->event->trigger("beforeFilter",$wrap); + $wrap->store(); + + if ($this->model && method_exists($this->model, "get")){ + $this->sql = new ArrayDBDataWrapper(); + $result = new ArrayQueryWrapper(call_user_func(array($this->model, "get"), $this->request)); + $out = $this->output_as_xml($result); + } else { + $out = $this->output_as_xml($this->get_resource()); + + if ($out !== null) return $out; + } + + } + } + $this->end_run(); + } + + }
\ No newline at end of file diff --git a/codebase/Dhtmlx/Connector/GanttLinksConnector.php b/codebase/Dhtmlx/Connector/GanttLinksConnector.php index 6dcf607..9790f69 100644 --- a/codebase/Dhtmlx/Connector/GanttLinksConnector.php +++ b/codebase/Dhtmlx/Connector/GanttLinksConnector.php @@ -2,6 +2,11 @@ namespace Dhtmlx\Connector; class GanttLinksConnector extends OptionsConnector { + public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){ + if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\GanttLinkDataItem"; + parent::__construct($res,$type,$item_type,$data_type,$render_type); + } + public function render(){ if (!$this->init_flag){ $this->init_flag=true; diff --git a/codebase/Dhtmlx/Connector/JSONGanttConnector.php b/codebase/Dhtmlx/Connector/JSONGanttConnector.php index 6d2b0f6..f708b6e 100755 --- a/codebase/Dhtmlx/Connector/JSONGanttConnector.php +++ b/codebase/Dhtmlx/Connector/JSONGanttConnector.php @@ -1,12 +1,6 @@ <?php namespace Dhtmlx\Connector; -use Dhtmlx\Connector\Tools\LogMaster; -use Dhtmlx\Connector\Tools\EventMaster; use Dhtmlx\Connector\Output\OutputWriter; -use Dhtmlx\Connector\Event\SortInterface; -use Dhtmlx\Connector\Event\FilterInterface; -use Dhtmlx\Connector\DataStorage\ArrayDBDataWrapper; -use Dhtmlx\Connector\DataStorage\ArrayQueryWrapper; class JSONGanttConnector extends GanttConnector { @@ -108,56 +102,4 @@ class JSONGanttConnector extends GanttConnector { $this->set_options("links", $links); } - - /*! render self - process commands, output requested data as XML - */ - public function render(){ - $this->event->trigger("onInit", $this); - EventMaster::trigger_static("connectorInit",$this); - - if (!$this->as_string) - $this->parse_request(); - $this->set_relation(); - - if ($this->live_update !== false && $this->updating!==false) { - $this->live_update->get_updates(); - } else { - if ($this->editing){ - if ($this->links_mode && isset($this->options["links"])) { - $this->options["links"]->save(); - } else { - $dp = new $this->names["data_class"]($this,$this->config,$this->request); - $dp->process($this->config,$this->request); - } - } else { - if (!$this->access->check("read")){ - LogMaster::log("Access control: read operation blocked"); - echo "Access denied"; - die(); - } - $wrap = new SortInterface($this->request); - $this->apply_sorts($wrap); - $this->event->trigger("beforeSort",$wrap); - $wrap->store(); - - $wrap = new FilterInterface($this->request); - $this->apply_filters($wrap); - $this->event->trigger("beforeFilter",$wrap); - $wrap->store(); - - if ($this->model && method_exists($this->model, "get")){ - $this->sql = new ArrayDBDataWrapper(); - $result = new ArrayQueryWrapper(call_user_func(array($this->model, "get"), $this->request)); - $out = $this->output_as_xml($result); - } else { - $out = $this->output_as_xml($this->get_resource()); - - if ($out !== null) return $out; - } - - } - } - $this->end_run(); - } }
\ No newline at end of file |