summaryrefslogtreecommitdiffstats
path: root/codebase/gantt_connector.php
diff options
context:
space:
mode:
authordmitry-radyno <dmitry.radyno@gmail.com>2013-04-29 18:24:08 +0200
committerdmitry-radyno <dmitry.radyno@gmail.com>2013-04-29 18:24:08 +0200
commita94ab5d96729943bd03b0905bce2dd7a29acfb0c (patch)
tree91cb7ea9bed44279fc06bf35b2749f5974d389c0 /codebase/gantt_connector.php
parent002f75053be67889797ced1d6a95d8dd5ba4a513 (diff)
downloadconnector-php-a94ab5d96729943bd03b0905bce2dd7a29acfb0c.zip
connector-php-a94ab5d96729943bd03b0905bce2dd7a29acfb0c.tar.gz
connector-php-a94ab5d96729943bd03b0905bce2dd7a29acfb0c.tar.bz2
saving gantt links
Diffstat (limited to 'codebase/gantt_connector.php')
-rw-r--r--codebase/gantt_connector.php99
1 files changed, 97 insertions, 2 deletions
diff --git a/codebase/gantt_connector.php b/codebase/gantt_connector.php
index 9cdc41f..46c580b 100644
--- a/codebase/gantt_connector.php
+++ b/codebase/gantt_connector.php
@@ -42,6 +42,7 @@ class GanttConnector extends Connector{
protected $extra_output="";//!< extra info which need to be sent to client side
protected $options=array();//!< hash of OptionsConnector
+ protected $links_mode = false;
/*! assign options collection to the column
@@ -86,6 +87,10 @@ class GanttConnector extends Connector{
//parse GET scoope, all operations with incoming request must be done here
function parse_request(){
parent::parse_request();
+
+ if (isset($_GET["gantt_mode"]) && $_GET["gantt_mode"] == "links")
+ $this->links_mode = true;
+
if (count($this->config->text)){
if (isset($_GET["to"]))
$this->request->set_filter($this->config->text[0]["name"],$_GET["to"],"<");
@@ -99,7 +104,7 @@ class GanttConnector extends Connector{
}
public function render_links($table,$id="",$fields=false,$extra=false,$relation_id=false) {
- $links = new OptionsConnector($this->get_connection(),$this->names["db_class"]);
+ $links = new GanttLinksConnector($this->get_connection(),$this->names["db_class"]);
$links->render_table($table,$id,$fields,$extra);
$this->set_options("links", $links);
}
@@ -247,9 +252,99 @@ class JSONGanttConnector extends GanttConnector {
}
public function render_links($table,$id="",$fields=false,$extra=false,$relation_id=false) {
- $links = new JSONOptionsConnector($this->get_connection(),$this->names["db_class"]);
+ $links = new JSONGanttLinksConnector($this->get_connection(),$this->names["db_class"]);
$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();
+ }
}
+
+
+class GanttLinksConnector extends OptionsConnector {
+ public function render(){
+ if (!$this->init_flag){
+ $this->init_flag=true;
+ return "";
+ }
+
+ $res = $this->sql->select($this->request);
+ return $this->render_set($res);
+ }
+
+ public function save() {
+ $dp = new $this->names["data_class"]($this,$this->config,$this->request);
+ $dp->process($this->config,$this->request);
+ }
+}
+
+
+class JSONGanttLinksConnector extends JSONOptionsConnector {
+ public function render(){
+ if (!$this->init_flag){
+ $this->init_flag=true;
+ return "";
+ }
+
+ $res = $this->sql->select($this->request);
+ return $this->render_set($res);
+ }
+
+ public function save() {
+ $dp = new $this->names["data_class"]($this,$this->config,$this->request);
+ $dp->process($this->config,$this->request);
+ }
+}
+
?> \ No newline at end of file