summaryrefslogtreecommitdiffstats
path: root/codebase/gantt_connector.php
diff options
context:
space:
mode:
authorEgor <egor.26.93@gmail.com>2015-06-18 17:02:14 +0300
committerEgor <egor.26.93@gmail.com>2015-06-18 17:02:14 +0300
commit2fac8546534e35607627e21323bcc477110b1978 (patch)
tree8bf871cca0cb97c32b27d2fd6c4102406ae91ae9 /codebase/gantt_connector.php
parent03c20c4347378e3279c46c8ecf105c771511c6b4 (diff)
downloadconnector-php-2fac8546534e35607627e21323bcc477110b1978.zip
connector-php-2fac8546534e35607627e21323bcc477110b1978.tar.gz
connector-php-2fac8546534e35607627e21323bcc477110b1978.tar.bz2
Updated gantt connector for xml data processing.
Diffstat (limited to 'codebase/gantt_connector.php')
-rw-r--r--codebase/gantt_connector.php129
1 files changed, 78 insertions, 51 deletions
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;