diff options
Diffstat (limited to 'codebase/data_connector.php')
-rw-r--r-- | codebase/data_connector.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/codebase/data_connector.php b/codebase/data_connector.php index c00e775..c7b33bd 100644 --- a/codebase/data_connector.php +++ b/codebase/data_connector.php @@ -368,6 +368,7 @@ class TreeCommonDataItem extends CommonDataItem{ class TreeDataConnector extends DataConnector{ protected $parent_name = 'parent'; + public $rootId = "0"; /*! constructor @@ -405,7 +406,10 @@ class TreeDataConnector extends DataConnector{ /*! renders self as xml, starting part */ protected function xml_start(){ - $attributes = " parent='".$this->request->get_relation()."' "; + $attributes = " "; + if (!$this->rootId || $this->rootId != $this->request->get_relation()) + $attributes = " parent='".$this->request->get_relation()."' "; + foreach($this->attributes as $k=>$v) $attributes .= " ".$k."='".$v."'"; @@ -428,7 +432,9 @@ class JSONTreeDataConnector extends TreeDataConnector{ if ($this->simple) return $result; $data = array(); - $data["parent"] = $this->request->get_relation(); + if (!$this->rootId || $this->rootId != $this->request->get_relation()) + $data["parent"] = $this->request->get_relation(); + $data["data"] = $result; $this->fill_collections(); |