summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor <egor.26.93@gmail.com>2015-06-16 15:48:31 +0300
committerEgor <egor.26.93@gmail.com>2015-06-16 15:48:31 +0300
commit67129e12d10b77911d9250b38b42b42dd5b601b4 (patch)
tree1cb3555d8e8148a38a4e6701f2f8dddb3f68c21d
parent4081482ce6cf1a6c0894a8be02a57d21f3cdc7dd (diff)
downloadconnector-php-67129e12d10b77911d9250b38b42b42dd5b601b4.zip
connector-php-67129e12d10b77911d9250b38b42b42dd5b601b4.tar.gz
connector-php-67129e12d10b77911d9250b38b42b42dd5b601b4.tar.bz2
Added namespaces for dhtmlx components.3.0.0
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/ComboConnector.php2
-rw-r--r--codebase/Dhtmlx/Connector/Data/JSONTreeCommonDataItem.php32
-rwxr-xr-xcodebase/Dhtmlx/Connector/Data/TreeCommonDataItem.php33
-rw-r--r--codebase/Dhtmlx/Connector/DataProcessor/FormDataProcessor.php8
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/DataViewConnector.php4
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/FormConnector.php4
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/GanttConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/JSONOptionsConnector.php2
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/JSONSchedulerConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/JSONTreeDataConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/JSONTreeDataGroupConnector.php2
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/JSONTreeDataMultitableConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/KeyGridConnector.php4
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/OptionsConnector.php2
-rwxr-xr-xcodebase/Dhtmlx/Connector/Output/GroupRenderStrategy.php79
-rwxr-xr-xcodebase/Dhtmlx/Connector/Output/JSONMultitableTreeRenderStrategy.php31
-rwxr-xr-xcodebase/Dhtmlx/Connector/Output/MultitableTreeRenderStrategy.php116
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/SchedulerConnector.php8
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeDataConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeDataGroupConnector.php2
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeDataMultitableConnector.php4
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeGridConnector.php6
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeGridGroupConnector.php2
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeGridMultitableConnector.php4
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeGroupConnector.php2
-rwxr-xr-x[-rw-r--r--]codebase/Dhtmlx/Connector/TreeMultitableConnector.php4
27 files changed, 343 insertions, 44 deletions
diff --git a/codebase/Dhtmlx/Connector/ComboConnector.php b/codebase/Dhtmlx/Connector/ComboConnector.php
index 05962f4..2a5dac2 100644..100755
--- a/codebase/Dhtmlx/Connector/ComboConnector.php
+++ b/codebase/Dhtmlx/Connector/ComboConnector.php
@@ -21,7 +21,7 @@ class ComboConnector extends Connector {
name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false){
- if (!$item_type) $item_type="ComboDataItem";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\ComboDataItem";
parent::__construct($res,$type,$item_type,$data_type);
}
diff --git a/codebase/Dhtmlx/Connector/Data/JSONTreeCommonDataItem.php b/codebase/Dhtmlx/Connector/Data/JSONTreeCommonDataItem.php
new file mode 100644
index 0000000..3bae29a
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Data/JSONTreeCommonDataItem.php
@@ -0,0 +1,32 @@
+<?php
+namespace Dhtmlx\Connector\Data;
+
+class JSONTreeCommonDataItem extends TreeCommonDataItem {
+
+ /*! return self as XML string
+ */
+ function to_xml_start(){
+ if ($this->skip) return false;
+
+ $data = array( "id" => $this->get_id() );
+ for ($i=0; $i<sizeof($this->config->text); $i++){
+ $extra = $this->config->text[$i]["name"];
+ if (isset($this->data[$extra]))
+ $data[$extra]=$this->data[$extra];
+ }
+
+ if ($this->userdata !== false)
+ foreach ($this->userdata as $key => $value)
+ $data[$key]=$value;
+
+ if ($this->kids === true)
+ $data[Connector::$kids_var] = 1;
+
+ return $data;
+ }
+
+ function to_xml_end(){
+ return "";
+ }
+
+} \ No newline at end of file
diff --git a/codebase/Dhtmlx/Connector/Data/TreeCommonDataItem.php b/codebase/Dhtmlx/Connector/Data/TreeCommonDataItem.php
new file mode 100755
index 0000000..e43fbec
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Data/TreeCommonDataItem.php
@@ -0,0 +1,33 @@
+<?php
+namespace Dhtmlx\Connector\Data;
+
+class TreeCommonDataItem extends CommonDataItem {
+
+ protected $kids=-1;
+
+ function to_xml_start(){
+ $str="<item id='".$this->get_id()."' ";
+ for ($i=0; $i < sizeof($this->config->text); $i++){
+ $name=$this->config->text[$i]["name"];
+ $str.=" ".$name."='".$this->xmlentities($this->data[$name])."'";
+ }
+
+ if ($this->userdata !== false)
+ foreach ($this->userdata as $key => $value)
+ $str.=" ".$key."='".$this->xmlentities($value)."'";
+
+ if ($this->kids === true)
+ $str .=" ".Connector::$kids_var."='1'";
+
+ return $str.">";
+ }
+
+ function has_kids(){
+ return $this->kids;
+ }
+
+ function set_kids($value){
+ $this->kids=$value;
+ }
+
+} \ No newline at end of file
diff --git a/codebase/Dhtmlx/Connector/DataProcessor/FormDataProcessor.php b/codebase/Dhtmlx/Connector/DataProcessor/FormDataProcessor.php
new file mode 100644
index 0000000..9b9827f
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/DataProcessor/FormDataProcessor.php
@@ -0,0 +1,8 @@
+<?php
+namespace Dhtmlx\Connector\DataProcessor;
+
+/*! DataProcessor class for Form component
+**/
+class FormDataProcessor extends DataProcessor {
+
+} \ No newline at end of file
diff --git a/codebase/Dhtmlx/Connector/DataViewConnector.php b/codebase/Dhtmlx/Connector/DataViewConnector.php
index 167bd3b..b87ca18 100644..100755
--- a/codebase/Dhtmlx/Connector/DataViewConnector.php
+++ b/codebase/Dhtmlx/Connector/DataViewConnector.php
@@ -17,8 +17,8 @@ class DataViewConnector extends Connector {
name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false){
- if (!$item_type) $item_type="DataViewDataItem";
- if (!$data_type) $data_type="DataProcessor";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\DataViewDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\DataProcessor";
parent::__construct($res,$type,$item_type,$data_type);
}
diff --git a/codebase/Dhtmlx/Connector/FormConnector.php b/codebase/Dhtmlx/Connector/FormConnector.php
index 7580f48..82b8545 100644..100755
--- a/codebase/Dhtmlx/Connector/FormConnector.php
+++ b/codebase/Dhtmlx/Connector/FormConnector.php
@@ -19,8 +19,8 @@ class FormConnector extends Connector {
name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false){
- if (!$item_type) $item_type="FormDataItem";
- if (!$data_type) $data_type="FormDataProcessor";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\FormDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\FormDataProcessor";
parent::__construct($res,$type,$item_type,$data_type);
}
diff --git a/codebase/Dhtmlx/Connector/GanttConnector.php b/codebase/Dhtmlx/Connector/GanttConnector.php
index b27d453..84246cd 100644..100755
--- a/codebase/Dhtmlx/Connector/GanttConnector.php
+++ b/codebase/Dhtmlx/Connector/GanttConnector.php
@@ -43,9 +43,9 @@ class GanttConnector extends Connector {
name of class which will be used for rendering.
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="GanttDataItem";
- if (!$data_type) $data_type="GanttDataProcessor";
- if (!$render_type) $render_type="RenderStrategy";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\GanttDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\GanttDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\RenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
$this->event->attach("afterDelete", array($this, "delete_related_links"));
diff --git a/codebase/Dhtmlx/Connector/JSONOptionsConnector.php b/codebase/Dhtmlx/Connector/JSONOptionsConnector.php
index 8f8fb47..6911310 100644..100755
--- a/codebase/Dhtmlx/Connector/JSONOptionsConnector.php
+++ b/codebase/Dhtmlx/Connector/JSONOptionsConnector.php
@@ -6,7 +6,7 @@ namespace Dhtmlx\Connector;
class JSONOptionsConnector extends JSONDataConnector {
protected $init_flag=false;//!< used to prevent rendering while initialization
public function __construct($res,$type=false,$item_type=false,$data_type=false){
- if (!$item_type) $item_type="JSONCommonDataItem";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\JSONCommonDataItem";
if (!$data_type) $data_type=""; //has not sense, options not editable
parent::__construct($res,$type,$item_type,$data_type);
}
diff --git a/codebase/Dhtmlx/Connector/JSONSchedulerConnector.php b/codebase/Dhtmlx/Connector/JSONSchedulerConnector.php
index c946be7..a84bf68 100644..100755
--- a/codebase/Dhtmlx/Connector/JSONSchedulerConnector.php
+++ b/codebase/Dhtmlx/Connector/JSONSchedulerConnector.php
@@ -19,9 +19,9 @@ class JSONSchedulerConnector extends SchedulerConnector {
name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="JSONSchedulerDataItem";
- if (!$data_type) $data_type="SchedulerDataProcessor";
- if (!$render_type) $render_type="JSONRenderStrategy";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\JSONSchedulerDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\SchedulerDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\JSONRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/JSONTreeDataConnector.php b/codebase/Dhtmlx/Connector/JSONTreeDataConnector.php
index aee5aa2..bfdf2aa 100644..100755
--- a/codebase/Dhtmlx/Connector/JSONTreeDataConnector.php
+++ b/codebase/Dhtmlx/Connector/JSONTreeDataConnector.php
@@ -5,9 +5,9 @@ use Dhtmlx\Connector\Output\OutputWriter;
class JSONTreeDataConnector extends TreeDataConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="JSONTreeCommonDataItem";
- if (!$data_type) $data_type="CommonDataProcessor";
- if (!$render_type) $render_type="JSONTreeRenderStrategy";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\JSONTreeCommonDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\CommonDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\JSONTreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/JSONTreeDataGroupConnector.php b/codebase/Dhtmlx/Connector/JSONTreeDataGroupConnector.php
index a3f2eb3..76dd087 100644..100755
--- a/codebase/Dhtmlx/Connector/JSONTreeDataGroupConnector.php
+++ b/codebase/Dhtmlx/Connector/JSONTreeDataGroupConnector.php
@@ -4,7 +4,7 @@ namespace Dhtmlx\Connector;
class JSONTreeDataGroupConnector extends JSONTreeDataConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$render_type) $render_type="JSONGroupRenderStrategy";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\JSONGroupRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/JSONTreeDataMultitableConnector.php b/codebase/Dhtmlx/Connector/JSONTreeDataMultitableConnector.php
index a826b8e..17d0889 100644..100755
--- a/codebase/Dhtmlx/Connector/JSONTreeDataMultitableConnector.php
+++ b/codebase/Dhtmlx/Connector/JSONTreeDataMultitableConnector.php
@@ -5,9 +5,9 @@ use Dhtmlx\Connector\Output\OutputWriter;
class JSONTreeDataMultitableConnector extends TreeDataMultitableConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="JSONTreeCommonDataItem";
- if (!$data_type) $data_type="CommonDataProcessor";
- if (!$render_type) $render_type="JSONMultitableTreeRenderStrategy";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\JSONTreeCommonDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\CommonDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\JSONMultitableTreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/KeyGridConnector.php b/codebase/Dhtmlx/Connector/KeyGridConnector.php
index 001cae9..9862795 100644..100755
--- a/codebase/Dhtmlx/Connector/KeyGridConnector.php
+++ b/codebase/Dhtmlx/Connector/KeyGridConnector.php
@@ -3,8 +3,8 @@ namespace Dhtmlx\Connector;
class KeyGridConnector extends GridConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false){
- if (!$item_type) $item_type="GridDataItem";
- if (!$data_type) $data_type="KeyGridDataProcessor";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\GridDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\KeyGridDataProcessor";
parent::__construct($res,$type,$item_type,$data_type);
$this->event->attach("beforeProcessing",array($this,"before_check_key"));
diff --git a/codebase/Dhtmlx/Connector/OptionsConnector.php b/codebase/Dhtmlx/Connector/OptionsConnector.php
index f8fbea3..0fb1e4e 100644..100755
--- a/codebase/Dhtmlx/Connector/OptionsConnector.php
+++ b/codebase/Dhtmlx/Connector/OptionsConnector.php
@@ -6,7 +6,7 @@ namespace Dhtmlx\Connector;
class OptionsConnector extends Connector {
protected $init_flag=false;//!< used to prevent rendering while initialization
public function __construct($res,$type=false,$item_type=false,$data_type=false){
- if (!$item_type) $item_type="DataItem";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\DataItem";
if (!$data_type) $data_type=""; //has not sense, options not editable
parent::__construct($res,$type,$item_type,$data_type);
}
diff --git a/codebase/Dhtmlx/Connector/Output/GroupRenderStrategy.php b/codebase/Dhtmlx/Connector/Output/GroupRenderStrategy.php
new file mode 100755
index 0000000..ac6996f
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Output/GroupRenderStrategy.php
@@ -0,0 +1,79 @@
+<?php
+namespace Dhtmlx\Connector\Output;
+use Dhtmlx\Connector\Data\DataRequestConfig;
+
+class GroupRenderStrategy extends RenderStrategy {
+
+ protected $id_postfix = '__{group_param}';
+
+ public function __construct($conn) {
+ parent::__construct($conn);
+ $conn->event->attach("beforeProcessing", Array($this, 'check_id'));
+ $conn->event->attach("onInit", Array($this, 'replace_postfix'));
+ }
+
+ public function render_set($res, $name, $dload, $sep, $config, $mix, $usemix = false){
+ $output="";
+ $index=0;
+ $conn = $this->conn;
+ if ($usemix) $this->mix($config, $mix);
+ while ($data=$conn->sql->get_next($res)){
+ if (isset($data[$config->id['name']])) {
+ $this->simple_mix($mix, $data);
+ $has_kids = false;
+ } else {
+ $data[$config->id['name']] = $data['value'].$this->id_postfix;
+ $data[$config->text[0]['name']] = $data['value'];
+ $has_kids = true;
+ }
+ $data = new $name($data,$config,$index);
+ $conn->event->trigger("beforeRender",$data);
+ if ($has_kids === false) {
+ $data->set_kids(false);
+ }
+
+ if ($data->has_kids()===-1 && $dload)
+ $data->set_kids(true);
+ $output.=$data->to_xml_start();
+ if (($data->has_kids()===-1 || ( $data->has_kids()==true && !$dload))&&($has_kids == true)){
+ $sub_request = new DataRequestConfig($conn->get_request());
+ $sub_request->set_relation(str_replace($this->id_postfix, "", $data->get_id()));
+ $output.=$this->render_set($conn->sql->select($sub_request), $name, $dload, $sep, $config, $mix, true);
+ }
+ $output.=$data->to_xml_end();
+ $index++;
+ }
+ if ($usemix) $this->unmix($config, $mix);
+ return $output;
+ }
+
+ public function check_id($action) {
+ if (isset($_GET['editing'])) {
+ $config = $this->conn->get_config();
+ $id = $action->get_id();
+ $pid = $action->get_value($config->relation_id['name']);
+ $pid = str_replace($this->id_postfix, "", $pid);
+ $action->set_value($config->relation_id['name'], $pid);
+ if (!empty($pid)) {
+ return $action;
+ } else {
+ $action->error();
+ $action->set_response_text("This record can't be updated!");
+ return $action;
+ }
+ } else {
+ return $action;
+ }
+ }
+
+ public function replace_postfix() {
+ if (isset($_GET['id'])) {
+ $_GET['id'] = str_replace($this->id_postfix, "", $_GET['id']);
+ }
+ }
+
+ public function get_postfix() {
+ return $this->id_postfix;
+ }
+
+} \ No newline at end of file
diff --git a/codebase/Dhtmlx/Connector/Output/JSONMultitableTreeRenderStrategy.php b/codebase/Dhtmlx/Connector/Output/JSONMultitableTreeRenderStrategy.php
new file mode 100755
index 0000000..98c161b
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Output/JSONMultitableTreeRenderStrategy.php
@@ -0,0 +1,31 @@
+<?php
+namespace Dhtmlx\Connector\Output;
+
+class JSONMultitableTreeRenderStrategy extends RenderStrategy {
+
+ public function render_set($res, $name, $dload, $sep, $config, $mix){
+ $output=array();
+ $index=0;
+ $conn = $this->conn;
+ $this->mix($config, $mix);
+ while ($data=$conn->sql->get_next($res)){
+ $data = $this->complex_mix($mix, $data);
+ $data[$config->id['name']] = $this->level_id($data[$config->id['name']]);
+ $data = new $name($data,$config,$index);
+ $conn->event->trigger("beforeRender",$data);
+
+ if ($this->is_max_level()) {
+ $data->set_kids(false);
+ } else {
+ if ($data->has_kids()===-1)
+ $data->set_kids(true);
+ }
+ $record = $data->to_xml_start($output);
+ $output[] = $record;
+ $index++;
+ }
+ $this->unmix($config, $mix);
+ return $output;
+ }
+
+}
diff --git a/codebase/Dhtmlx/Connector/Output/MultitableTreeRenderStrategy.php b/codebase/Dhtmlx/Connector/Output/MultitableTreeRenderStrategy.php
new file mode 100755
index 0000000..bc35082
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Output/MultitableTreeRenderStrategy.php
@@ -0,0 +1,116 @@
+<?php
+namespace Dhtmlx\Connector\Output;
+
+class MultitableTreeRenderStrategy extends TreeRenderStrategy {
+
+ private $level = 0;
+ private $max_level = null;
+ protected $sep = "-@level@-";
+
+ public function __construct($conn) {
+ parent::__construct($conn);
+ $conn->event->attach("beforeProcessing", Array($this, 'id_translate_before'));
+ $conn->event->attach("afterProcessing", Array($this, 'id_translate_after'));
+ }
+
+ public function set_separator($sep) {
+ $this->sep = $sep;
+ }
+
+ public function render_set($res, $name, $dload, $sep, $config, $mix){
+ $output="";
+ $index=0;
+ $conn = $this->conn;
+ $this->mix($config, $mix);
+ while ($data=$conn->sql->get_next($res)){
+ $data = $this->simple_mix($mix, $data);
+ $data[$config->id['name']] = $this->level_id($data[$config->id['name']]);
+ $data = new $name($data,$config,$index);
+ $conn->event->trigger("beforeRender",$data);
+ if (($this->max_level !== null)&&($conn->get_level() == $this->max_level)) {
+ $data->set_kids(false);
+ } else {
+ if ($data->has_kids()===-1)
+ $data->set_kids(true);
+ }
+ $output.=$data->to_xml_start();
+ $output.=$data->to_xml_end();
+ $index++;
+ }
+ $this->unmix($config, $mix);
+ return $output;
+ }
+
+
+ public function level_id($id, $level = null) {
+ return ($level === null ? $this->level : $level).$this->sep.$id;
+ }
+
+
+ /*! remove level prefix from id, parent id and set new id before processing
+ @param action
+ DataAction object
+ */
+ public function id_translate_before($action) {
+ $id = $action->get_id();
+ $id = $this->parse_id($id, false);
+ $action->set_id($id);
+ $action->set_value('tr_id', $id);
+ $action->set_new_id($id);
+ $pid = $action->get_value($this->conn->get_config()->relation_id['db_name']);
+ $pid = $this->parse_id($pid, false);
+ $action->set_value($this->conn->get_config()->relation_id['db_name'], $pid);
+ }
+
+
+ /*! add level prefix in id and new id after processing
+ @param action
+ DataAction object
+ */
+ public function id_translate_after($action) {
+ $id = $action->get_id();
+ $action->set_id($this->level_id($id));
+ $id = $action->get_new_id();
+ $action->success($this->level_id($id));
+ }
+
+
+ public function get_level($parent_name) {
+ if ($this->level) return $this->level;
+ if (!isset($_GET[$parent_name])) {
+ if (isset($_POST['ids'])) {
+ $ids = explode(",",$_POST["ids"]);
+ $id = $this->parse_id($ids[0]);
+ $this->level--;
+ }
+ $this->conn->get_request()->set_relation(false);
+ } else {
+ $id = $this->parse_id($_GET[$parent_name]);
+ $_GET[$parent_name] = $id;
+ }
+ return $this->level;
+ }
+
+
+ public function is_max_level() {
+ if (($this->max_level !== null) && ($this->level >= $this->max_level))
+ return true;
+ return false;
+ }
+ public function set_max_level($max_level) {
+ $this->max_level = $max_level;
+ }
+ public function parse_id($id, $set_level = true) {
+ $parts = explode($this->sep, $id, 2);
+ if (count($parts) === 2) {
+ $level = $parts[0] + 1;
+ $id = $parts[1];
+ } else {
+ $level = 0;
+ $id = '';
+ }
+ if ($set_level) $this->level = $level;
+ return $id;
+ }
+
+} \ No newline at end of file
diff --git a/codebase/Dhtmlx/Connector/SchedulerConnector.php b/codebase/Dhtmlx/Connector/SchedulerConnector.php
index 7b2a1c4..d860d13 100644..100755
--- a/codebase/Dhtmlx/Connector/SchedulerConnector.php
+++ b/codebase/Dhtmlx/Connector/SchedulerConnector.php
@@ -41,10 +41,10 @@ class SchedulerConnector extends Connector {
* @param render_type
name of class which will be used for rendering.
*/
- public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="SchedulerDataItem";
- if (!$data_type) $data_type="SchedulerDataProcessor";
- if (!$render_type) $render_type="RenderStrategy";
+ public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false) {
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\SchedulerDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\SchedulerDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\RenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeConnector.php b/codebase/Dhtmlx/Connector/TreeConnector.php
index 886d68d..1b9a7cb 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeConnector.php
@@ -21,9 +21,9 @@ class TreeConnector extends Connector {
*/
public function __construct($res, $type = false, $item_type = false, $data_type = false, $render_type = false)
{
- if (!$item_type) $item_type = "TreeDataItem";
- if (!$data_type) $data_type = "TreeDataProcessor";
- if (!$render_type) $render_type = "TreeRenderStrategy";
+ if (!$item_type) $item_type = "Dhtmlx\\Connector\\Data\\TreeDataItem";
+ if (!$data_type) $data_type = "Dhtmlx\\Connector\\DataProcessor\\TreeDataProcessor";
+ if (!$render_type) $render_type = "Dhtmlx\\Connector\\Output\\TreeRenderStrategy";
parent::__construct($res, $type, $item_type, $data_type, $render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeDataConnector.php b/codebase/Dhtmlx/Connector/TreeDataConnector.php
index 61c1384..d23637b 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeDataConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeDataConnector.php
@@ -20,9 +20,9 @@ class TreeDataConnector extends DataConnector {
* name of class which will provides data rendering
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="TreeCommonDataItem";
- if (!$data_type) $data_type="CommonDataProcessor";
- if (!$render_type) $render_type="TreeRenderStrategy";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\TreeCommonDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\CommonDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\TreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeDataGroupConnector.php b/codebase/Dhtmlx/Connector/TreeDataGroupConnector.php
index d830fda..6418fd0 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeDataGroupConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeDataGroupConnector.php
@@ -4,7 +4,7 @@ namespace Dhtmlx\Connector;
class TreeDataGroupConnector extends TreeDataConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$render_type) $render_type="GroupRenderStrategy";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\GroupRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeDataMultitableConnector.php b/codebase/Dhtmlx/Connector/TreeDataMultitableConnector.php
index 0021e70..a9975c4 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeDataMultitableConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeDataMultitableConnector.php
@@ -6,8 +6,8 @@ class TreeDataMultitableConnector extends TreeDataConnector {
protected $parent_name = 'parent';
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$data_type) $data_type="TreeDataProcessor";
- if (!$render_type) $render_type="MultitableTreeRenderStrategy";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\TreeDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\MultitableTreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeGridConnector.php b/codebase/Dhtmlx/Connector/TreeGridConnector.php
index 38db3c4..f556449 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeGridConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeGridConnector.php
@@ -22,9 +22,9 @@ class TreeGridConnector extends GridConnector {
* name of class which will provides data rendering
*/
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$item_type) $item_type="TreeGridDataItem";
- if (!$data_type) $data_type="TreeGridDataProcessor";
- if (!$render_type) $render_type="TreeRenderStrategy";
+ if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\TreeGridDataItem";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\TreeGridDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\TreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php b/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php
index 771b579..8c970fb 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php
@@ -4,7 +4,7 @@ namespace Dhtmlx\Connector;
class TreeGridGroupConnector extends TreeGridConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$render_type) $render_type="GroupRenderStrategy";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\GroupRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeGridMultitableConnector.php b/codebase/Dhtmlx/Connector/TreeGridMultitableConnector.php
index 7816943..7e55e5e 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeGridMultitableConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeGridMultitableConnector.php
@@ -4,8 +4,8 @@ namespace Dhtmlx\Connector;
class TreeGridMultitableConnector extends TreeGridConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- $data_type="TreeGridMultitableDataProcessor";
- if (!$render_type) $render_type="MultitableTreeRenderStrategy";
+ $data_type="Dhtmlx\\Connector\\DataProcessor\\TreeGridMultitableDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\MultitableTreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeGroupConnector.php b/codebase/Dhtmlx/Connector/TreeGroupConnector.php
index ae836fd..c2dead7 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeGroupConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeGroupConnector.php
@@ -4,7 +4,7 @@ namespace Dhtmlx\Connector;
class TreeGroupConnector extends TreeConnector {
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$render_type) $render_type="GroupRenderStrategy";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\GroupRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}
diff --git a/codebase/Dhtmlx/Connector/TreeMultitableConnector.php b/codebase/Dhtmlx/Connector/TreeMultitableConnector.php
index 7cc0851..7a562cc 100644..100755
--- a/codebase/Dhtmlx/Connector/TreeMultitableConnector.php
+++ b/codebase/Dhtmlx/Connector/TreeMultitableConnector.php
@@ -6,8 +6,8 @@ class TreeMultitableConnector extends TreeConnector {
protected $parent_name = 'id';
public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){
- if (!$data_type) $data_type="TreeDataProcessor";
- if (!$render_type) $render_type="MultitableTreeRenderStrategy";
+ if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\TreeDataProcessor";
+ if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\MultitableTreeRenderStrategy";
parent::__construct($res,$type,$item_type,$data_type,$render_type);
}