summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/Dhtmlx/Connector/TreeGridGroupConnector.php')
-rw-r--r--codebase/Dhtmlx/Connector/TreeGridGroupConnector.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php b/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php
new file mode 100644
index 0000000..771b579
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/TreeGridGroupConnector.php
@@ -0,0 +1,40 @@
+<?php
+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";
+ parent::__construct($res,$type,$item_type,$data_type,$render_type);
+ }
+
+ /*! if not isset $_GET[id] then it's top level
+ */
+ protected function set_relation() {
+ if (!isset($_GET[$this->parent_name])) $this->request->set_relation(false);
+ }
+
+ /*! if it's first level then distinct level
+ * else select by parent
+ */
+ protected function get_resource() {
+ $resource = null;
+ if (isset($_GET[$this->parent_name]))
+ $resource = $this->sql->select($this->request);
+ else
+ $resource = $this->sql->get_variants($this->config->relation_id['name'], $this->request);
+ return $resource;
+ }
+
+
+ /*! renders self as xml, starting part
+ */
+ protected function xml_start(){
+ if (isset($_GET[$this->parent_name])) {
+ return "<rows parent='".$_GET[$this->parent_name].$this->render->get_postfix()."'>";
+ } else {
+ return "<rows parent='0'>";
+ }
+ }
+
+} \ No newline at end of file