summaryrefslogtreecommitdiffstats
path: root/codebase/data_connector.php
diff options
context:
space:
mode:
authorStanislau Wolski <stanislau.wolski@gmail.com>2013-09-04 13:07:43 +0300
committerStanislau Wolski <stanislau.wolski@gmail.com>2013-09-04 13:07:43 +0300
commit394f114ab531f4a89555a3bd347a8cd3591364e6 (patch)
tree0dc788b72471d24e6fbade229853553ea5d2e525 /codebase/data_connector.php
parent3aa4511823e830d895c56ae1ca002d20ff9eb1bf (diff)
downloadconnector-php-394f114ab531f4a89555a3bd347a8cd3591364e6.zip
connector-php-394f114ab531f4a89555a3bd347a8cd3591364e6.tar.gz
connector-php-394f114ab531f4a89555a3bd347a8cd3591364e6.tar.bz2
[add] reordering for the gantt connector
Diffstat (limited to 'codebase/data_connector.php')
-rw-r--r--codebase/data_connector.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/codebase/data_connector.php b/codebase/data_connector.php
index caa5369..fe8cc82 100644
--- a/codebase/data_connector.php
+++ b/codebase/data_connector.php
@@ -113,6 +113,12 @@ class DataConnector extends Connector{
$this->sections[$name] = $string;
}
+ protected function parse_request_mode(){
+ if (isset($_GET['action']) && $_GET["action"] != "get")
+ $this->editing = true;
+ else
+ parent::parse_request_mode();
+ }
//parse GET scoope, all operations with incoming request must be done here
protected function parse_request(){
@@ -131,10 +137,10 @@ class DataConnector extends Connector{
//data saving
$this->editing = true;
}
+ parent::check_csrf();
} else {
if (isset($_GET['editing']) && isset($_POST['ids']))
$this->editing = true;
-
parent::parse_request();
}
@@ -146,7 +152,10 @@ class DataConnector extends Connector{
/*! renders self as xml, starting part
*/
protected function xml_start(){
- $start = parent::xml_start();
+ $start = "<data";
+ foreach($this->attributes as $k=>$v)
+ $start .= " ".$k."='".$v."'";
+ $start.= ">";
foreach($this->sections as $k=>$v)
$start .= "<".$k.">".$v."</".$k.">\n";
@@ -192,7 +201,7 @@ class JSONDataConnector extends DataConnector{
$name = $k;
$option="\"{$name}\":[";
if (!is_string($this->options[$name]))
- $option.=substr($this->options[$name]->render(),0,-2);
+ $option.=substr(json_encode($this->options[$name]->render()),1,-1);
else
$option.=$this->options[$name];
$option.="]";
@@ -391,7 +400,11 @@ class TreeDataConnector extends DataConnector{
/*! renders self as xml, starting part
*/
protected function xml_start(){
- return "<data parent='".$this->request->get_relation()."'>";
+ $attributes = " parent='".$this->request->get_relation()."' ";
+ foreach($this->attributes as $k=>$v)
+ $attributes .= " ".$k."='".$v."'";
+
+ return "<data".$attributes.">";
}
}
@@ -417,6 +430,10 @@ class JSONTreeDataConnector extends TreeDataConnector{
if (!empty($this->options))
$data["collections"] = $this->options;
+
+ foreach($this->attributes as $k=>$v)
+ $data[$k] = $v;
+
$data = json_encode($data);
// return as string