diff options
author | Maria Staskova <masha@dhtmlx.com> | 2014-05-20 14:53:56 +0300 |
---|---|---|
committer | Maria Staskova <masha@dhtmlx.com> | 2014-05-20 14:53:56 +0300 |
commit | 074750e6ee632990c5b9334473df0f8b4b65c000 (patch) | |
tree | a4a93727ffdae161b9df42e93066c03cff980088 /codebase/gantt_connector.php | |
parent | 8959cc7e4727f5e28f6d3d44b5124d364dab2253 (diff) | |
parent | d5d7611f58fdbd5c49df78336c3856d747585c4e (diff) | |
download | connector-php-074750e6ee632990c5b9334473df0f8b4b65c000.zip connector-php-074750e6ee632990c5b9334473df0f8b4b65c000.tar.gz connector-php-074750e6ee632990c5b9334473df0f8b4b65c000.tar.bz2 |
Merge branch 'master' of 192.168.3.251:connector-php
Diffstat (limited to 'codebase/gantt_connector.php')
-rw-r--r-- | codebase/gantt_connector.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/codebase/gantt_connector.php b/codebase/gantt_connector.php index 46c580b..74b8636 100644 --- a/codebase/gantt_connector.php +++ b/codebase/gantt_connector.php @@ -10,8 +10,6 @@ require_once("data_connector.php"); **/ class GanttDataItem extends DataItem{ - public static $open = null; - /*! return self as XML string */ function to_xml(){ @@ -28,8 +26,6 @@ class GanttDataItem extends DataItem{ if ($this->userdata !== false) foreach ($this->userdata as $key => $value) $str.="<".$key."><![CDATA[".$value."]]></".$key.">"; - if (GanttDataItem::$open !== null) - $str.="<open>".GanttDataItem::$open."</open>"; return $str."</task>"; } @@ -82,6 +78,9 @@ class GanttConnector extends Connector{ if (!$data_type) $data_type="GanttDataProcessor"; if (!$render_type) $render_type="RenderStrategy"; parent::__construct($res,$type,$item_type,$data_type,$render_type); + + $this->event->attach("afterDelete", array($this, "delete_related_links")); + $this->event->attach("afterOrder", array($this, "order_set_parent")); } //parse GET scoope, all operations with incoming request must be done here @@ -99,8 +98,25 @@ class GanttConnector extends Connector{ } } - public function openAll($mode = true) { - GanttDataItem::$open = $mode; + function order_set_parent($action){ + $value = $action->get_id(); + $parent = $action->get_value("parent"); + + $table = $this->request->get_source(); + $id = $this->config->id["db_name"]; + + $this->sql->query("UPDATE $table SET parent = $parent WHERE $id = $value"); + } + + function delete_related_links($action){ + if (isset($this->options["links"])){ + $links = $this->options["links"]; + $value = $this->sql->escape($action->get_new_id()); + $table = $links->get_request()->get_source(); + + $this->sql->query("DELETE FROM $table WHERE source = '$value'"); + $this->sql->query("DELETE FROM $table WHERE target = '$value'"); + } } public function render_links($table,$id="",$fields=false,$extra=false,$relation_id=false) { @@ -145,9 +161,7 @@ class JSONGanttDataItem extends GanttDataItem{ $extra = $this->config->text[$i]["name"]; $obj[$extra]=$this->data[$extra]; } - if (GanttDataItem::$open !== null) - $obj['open'] = GanttDataItem::$open; - + if ($this->userdata !== false) foreach ($this->userdata as $key => $value) $obj[$key]=$value; |