diff options
author | Stanislau Wolski <stanislau.wolski@gmail.com> | 2015-06-24 20:21:32 +0300 |
---|---|---|
committer | Stanislau Wolski <stanislau.wolski@gmail.com> | 2015-06-24 20:21:32 +0300 |
commit | c5b18861823757d2632a06f13edb2ed639cf4ecd (patch) | |
tree | ac65a416a273970fc565282f1097fa95c7027315 | |
parent | 7704800362fb043d21beca5d3d3ac1548921f1cd (diff) | |
parent | 4c65fb8cff4847804ced68b52d0c8d2a23de94c0 (diff) | |
download | connector-php-c5b18861823757d2632a06f13edb2ed639cf4ecd.zip connector-php-c5b18861823757d2632a06f13edb2ed639cf4ecd.tar.gz connector-php-c5b18861823757d2632a06f13edb2ed639cf4ecd.tar.bz2 |
Merge branch 'master' of github.com:DHTMLX/connector-php
-rwxr-xr-x[-rw-r--r--] | codebase/base_connector.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | codebase/db_phpci2.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | codebase/db_phpyii1.php | 2 | ||||
-rw-r--r-- | codebase/gantt_connector.php | 129 |
4 files changed, 81 insertions, 54 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php index 26f1f8b..05a885e 100644..100755 --- a/codebase/base_connector.php +++ b/codebase/base_connector.php @@ -419,7 +419,7 @@ class Connector { $id = $info["key"]; } $this->config->init($id,$fields,$extra,$relation_id); - if (strpos(trim($table), " ")!==false) + if (is_string($table) && strpos(trim($table), " ")!==false) $this->request->parse_sql($table); else $this->request->set_source($table); diff --git a/codebase/db_phpci2.php b/codebase/db_phpci2.php index 9d10d99..220a126 100644..100755 --- a/codebase/db_phpci2.php +++ b/codebase/db_phpci2.php @@ -9,7 +9,7 @@ require_once("db_common.php"); if you plan to use it for Oracle - use Oracle connection type instead
**/
-class PHPCIDBDataWrapper extends DBDataWrapper{
+class PHPCI2DBDataWrapper extends DBDataWrapper{
private $last_result;//!< store result or last operation
public function query($sql){
diff --git a/codebase/db_phpyii1.php b/codebase/db_phpyii1.php index 616d7f3..bbbd943 100644..100755 --- a/codebase/db_phpyii1.php +++ b/codebase/db_phpyii1.php @@ -6,7 +6,7 @@ require_once("db_common.php"); -class PHPYiiDBDataWrapper extends ArrayDBDataWrapper{ +class PHPYii1DBDataWrapper extends ArrayDBDataWrapper{ public function select($sql){ if (is_array($this->connection)) //result of findAll $res = $this->connection; diff --git a/codebase/gantt_connector.php b/codebase/gantt_connector.php index 3577835..f8c62cf 100644 --- a/codebase/gantt_connector.php +++ b/codebase/gantt_connector.php @@ -31,6 +31,25 @@ class GanttDataItem extends DataItem{ } } +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.">"; + } + +} /*! Connector class for dhtmlxGantt **/ @@ -124,6 +143,60 @@ 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(); + } + } /*! DataProcessor class for Gantt component @@ -271,62 +344,16 @@ 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; - } +class GanttLinksConnector extends OptionsConnector { - } - } - $this->end_run(); + public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){ + if (!$item_type) $item_type="GanttLinkDataItem"; + parent::__construct($res,$type,$item_type,$data_type,$render_type); } -} - -class GanttLinksConnector extends OptionsConnector { public function render(){ if (!$this->init_flag){ $this->init_flag=true; |