summaryrefslogtreecommitdiffstats
path: root/codebase
diff options
context:
space:
mode:
Diffstat (limited to 'codebase')
-rw-r--r--codebase/base_connector.php28
-rw-r--r--codebase/data_connector.php48
-rw-r--r--codebase/db_common.php32
-rw-r--r--codebase/db_excel.php4
-rw-r--r--codebase/db_filesystem.php4
-rw-r--r--codebase/db_mssql.php2
-rw-r--r--codebase/db_mysqli.php2
-rw-r--r--codebase/db_oracle.php2
-rw-r--r--codebase/db_pdo.php2
-rw-r--r--codebase/db_phpci.php2
-rw-r--r--codebase/db_phpyii.php9
-rw-r--r--codebase/db_postgre.php2
-rw-r--r--codebase/db_sasql.php2
-rw-r--r--codebase/db_sqlite.php2
-rw-r--r--codebase/db_sqlite3.php2
-rw-r--r--codebase/db_sqlsrv.php2
-rw-r--r--codebase/gantt_connector.php350
-rw-r--r--codebase/grid_connector.php3
-rw-r--r--codebase/scheduler_connector.php7
-rw-r--r--codebase/strategy.php9
-rw-r--r--codebase/tree_connector.php3
21 files changed, 478 insertions, 39 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php
index 5b4534f..ab11cb5 100644
--- a/codebase/base_connector.php
+++ b/codebase/base_connector.php
@@ -445,7 +445,7 @@ class Connector {
public function render_array($data, $id, $fields, $extra=false, $relation_id=false){
$this->configure("-",$id,$fields,$extra,$relation_id);
- $this->sql = new ArrayDBDataWrapper($data, null);
+ $this->sql = new ArrayDBDataWrapper($data, $this->config);
return $this->render();
}
@@ -475,7 +475,8 @@ class Connector {
$this->event->trigger("onInit", $this);
EventMaster::trigger_static("connectorInit",$this);
- $this->parse_request();
+ if (!$this->as_string)
+ $this->parse_request();
$this->set_relation();
if ($this->live_update !== false && $this->updating!==false) {
@@ -550,6 +551,13 @@ class Connector {
$this->limit = $limit;
}
+
+ public function limit($start, $count, $sort_field=false, $sort_dir=false){
+ $this->request->set_limit($start, $count);
+ if ($sort_field)
+ $this->request->set_sort($sort_field, $sort_dir);
+ }
+
protected function parse_request_mode(){
//detect edit mode
if (isset($_GET["editing"])){
@@ -567,10 +575,14 @@ class Connector {
protected function parse_request(){
//set default dyn. loading params, can be reset in child classes
if ($this->dload)
- $this->request->set_limit(0,$this->dload);
+ $this->request->set_limit(0,$this->dload);
else if ($this->limit)
$this->request->set_limit(0,$this->limit);
-
+
+ if (isset($_GET["posStart"]) && isset($_GET["count"])) {
+ $this->request->set_limit($_GET["posStart"],$_GET["count"]);
+ }
+
$this->parse_request_mode();
if ($this->live_update && ($this->updating || $this->editing)){
@@ -721,6 +733,14 @@ class Connector {
*/
protected function xml_start(){
$attributes = "";
+
+ if ($this->dload){
+ //info for dyn. loadin
+ if ($pos=$this->request->get_start())
+ $attributes .= " pos='".$pos."'";
+ else
+ $attributes .= " total_count='".$this->sql->get_size($this->request)."'";
+ }
foreach($this->attributes as $k=>$v)
$attributes .= " ".$k."='".$v."'";
diff --git a/codebase/data_connector.php b/codebase/data_connector.php
index e4e5e08..e6786b9 100644
--- a/codebase/data_connector.php
+++ b/codebase/data_connector.php
@@ -145,14 +145,11 @@ class DataConnector extends Connector{
$this->request->set_limit($_GET["start"],$_GET["count"]);
}
-
+
/*! renders self as xml, starting part
*/
protected function xml_start(){
- $start = "<data";
- foreach($this->attributes as $k=>$v)
- $start .= " ".$k."='".$v."'";
- $start.= ">";
+ $start = parent::xml_start();
foreach($this->sections as $k=>$v)
$start .= "<".$k.">".$v."</".$k.">\n";
@@ -418,6 +415,11 @@ class JSONTreeDataConnector extends TreeDataConnector{
$data = array();
$data["parent"] = $this->request->get_relation();
$data["data"] = $result;
+
+ $this->fill_collections();
+ if (!empty($this->options))
+ $data["collections"] = $this->options;
+
$data = json_encode($data);
// return as string
@@ -430,6 +432,42 @@ class JSONTreeDataConnector extends TreeDataConnector{
$out->output("", true, $this->encoding);
}
+ /*! assign options collection to the column
+
+ @param name
+ name of the column
+ @param options
+ array or connector object
+ */
+ public function set_options($name,$options){
+ if (is_array($options)){
+ $str=array();
+ foreach($options as $k => $v)
+ $str[]=Array("id"=>$this->xmlentities($k), "value"=>$this->xmlentities($v));//'{"id":"'.$this->xmlentities($k).'", "value":"'.$this->xmlentities($v).'"}';
+ $options=$str;
+ }
+ $this->options[$name]=$options;
+ }
+
+ /*! generates xml description for options collections
+
+ @param list
+ comma separated list of column names, for which options need to be generated
+ */
+ protected function fill_collections($list=""){
+ $options = array();
+ foreach ($this->options as $k=>$v) {
+ $name = $k;
+ if (!is_array($this->options[$name]))
+ $option=$this->options[$name]->render();
+ else
+ $option=$this->options[$name];
+ $options[$name] = $option;
+ }
+ $this->options = $options;
+ $this->extra_output .= "'collections':".json_encode($options);
+ }
+
}
diff --git a/codebase/db_common.php b/codebase/db_common.php
index 9f1a8cd..19365f3 100644
--- a/codebase/db_common.php
+++ b/codebase/db_common.php
@@ -667,6 +667,12 @@ abstract class DBDataWrapper extends DataWrapper{
return $this->query($this->select_query($select,$source->get_source(),$where,$sort,$source->get_start(),$source->get_count()));
}
+ public function queryOne($sql){
+ $res = $this->query($sql);
+ if ($res)
+ return $this->get_next($res);
+ return false;
+ }
public function get_size($source){
$count = new DataRequestConfig($source);
@@ -896,7 +902,7 @@ abstract class DBDataWrapper extends DataWrapper{
@return
sql result set
*/
- abstract protected function query($sql);
+ abstract public function query($sql);
/*! returns next record from result set
@param res
@@ -909,7 +915,7 @@ abstract class DBDataWrapper extends DataWrapper{
@return
new id value, for newly inserted row
*/
- abstract protected function get_new_id();
+ abstract public function get_new_id();
/*! escape data to prevent sql injections
@param data
unescaped data
@@ -956,7 +962,25 @@ class ArrayDBDataWrapper extends DBDataWrapper{
return $res->data[$res->index++];
}
public function select($sql){
- return new ArrayQueryWrapper($this->connection);
+ if ($this->config->relation_id["db_name"] == "") {
+ if ($sql->get_relation() == "0" || $sql->get_relation() == "") {
+ return new ArrayQueryWrapper($this->connection);
+ } else {
+ return new ArrayQueryWrapper(array());
+ }
+ }
+
+ $relation_id = $this->config->relation_id["db_name"];
+
+ for ($i = 0; $i < count($this->connection); $i++) {
+ $item = $this->connection[$i];
+ if (!isset($item[$relation_id])) continue;
+ if ($item[$relation_id] == $sql->get_relation())
+ $result[] = $item;
+
+ }
+
+ return new ArrayQueryWrapper($result);
}
public function query($sql){
throw new Exception("Not implemented");
@@ -994,7 +1018,7 @@ class MySQLDBDataWrapper extends DBDataWrapper{
return mysql_fetch_assoc($res);
}
- protected function get_new_id(){
+ public function get_new_id(){
return mysql_insert_id($this->connection);
}
diff --git a/codebase/db_excel.php b/codebase/db_excel.php
index 14050e1..6c0e347 100644
--- a/codebase/db_excel.php
+++ b/codebase/db_excel.php
@@ -96,10 +96,10 @@ class ExcelDBDataWrapper extends DBDataWrapper {
return $excRes;
}
- protected function query($sql) {
+ public function query($sql) {
}
- protected function get_new_id() {
+ public function get_new_id() {
}
public function escape($data) {
diff --git a/codebase/db_filesystem.php b/codebase/db_filesystem.php
index 7817be5..b3d16d2 100644
--- a/codebase/db_filesystem.php
+++ b/codebase/db_filesystem.php
@@ -134,10 +134,10 @@ class FileSystemDBDataWrapper extends DBDataWrapper {
return $result;
}
- protected function query($sql) {
+ public function query($sql) {
}
- protected function get_new_id() {
+ public function get_new_id() {
}
public function escape($data) {
diff --git a/codebase/db_mssql.php b/codebase/db_mssql.php
index 0bbcf63..0acab93 100644
--- a/codebase/db_mssql.php
+++ b/codebase/db_mssql.php
@@ -28,7 +28,7 @@ class MsSQLDBDataWrapper extends DBDataWrapper{
return mssql_fetch_assoc($res);
}
- protected function get_new_id(){
+ public function get_new_id(){
/*
MSSQL doesn't support identity or auto-increment fields
Insert SQL returns new ID value, which stored in last_id field
diff --git a/codebase/db_mysqli.php b/codebase/db_mysqli.php
index 806fcda..6740a3b 100644
--- a/codebase/db_mysqli.php
+++ b/codebase/db_mysqli.php
@@ -18,7 +18,7 @@ class MySQLiDBDataWrapper extends MySQLDBDataWrapper{
return $res->fetch_assoc();
}
- protected function get_new_id(){
+ public function get_new_id(){
return $this->connection->insert_id;
}
diff --git a/codebase/db_oracle.php b/codebase/db_oracle.php
index 55fe683..064d55a 100644
--- a/codebase/db_oracle.php
+++ b/codebase/db_oracle.php
@@ -40,7 +40,7 @@ class OracleDBDataWrapper extends DBDataWrapper{
return $data;
}
- protected function get_new_id(){
+ public function get_new_id(){
/*
Oracle doesn't support identity or auto-increment fields
Insert SQL returns new ID value, which stored in last_id field
diff --git a/codebase/db_pdo.php b/codebase/db_pdo.php
index c008adb..d1ad4d8 100644
--- a/codebase/db_pdo.php
+++ b/codebase/db_pdo.php
@@ -45,7 +45,7 @@ class PDODBDataWrapper extends DBDataWrapper{
return $data;
}
- protected function get_new_id(){
+ public function get_new_id(){
return $this->connection->lastInsertId();
}
diff --git a/codebase/db_phpci.php b/codebase/db_phpci.php
index 3f4221b..f5b317c 100644
--- a/codebase/db_phpci.php
+++ b/codebase/db_phpci.php
@@ -28,7 +28,7 @@ class PHPCIDBDataWrapper extends DBDataWrapper{
return $data;
}
- protected function get_new_id(){
+ public function get_new_id(){
return $this->connection->insert_id();
}
diff --git a/codebase/db_phpyii.php b/codebase/db_phpyii.php
index 41066ee..f71d61a 100644
--- a/codebase/db_phpyii.php
+++ b/codebase/db_phpyii.php
@@ -8,12 +8,15 @@ require_once("db_common.php");
class PHPYiiDBDataWrapper extends ArrayDBDataWrapper{
public function select($sql){
- $res = $this->connection->findAll();
+ if (is_array($this->connection)) //result of findAll
+ $res = $this->connection;
+ else
+ $res = $this->connection->findAll();
+
if (sizeof($res)){
- $name = get_class($this->connection);
$temp = array();
foreach ($res as $obj)
- $temp[]=&$obj->getAttributes();
+ $temp[]=$obj->getAttributes();
}
return new ArrayQueryWrapper($temp);
}
diff --git a/codebase/db_postgre.php b/codebase/db_postgre.php
index 011bd47..a7d1598 100644
--- a/codebase/db_postgre.php
+++ b/codebase/db_postgre.php
@@ -32,7 +32,7 @@ class PostgreDBDataWrapper extends DBDataWrapper{
return pg_fetch_assoc($res);
}
- protected function get_new_id(){
+ public function get_new_id(){
$res = pg_query( $this->connection, "SELECT LASTVAL() AS seq");
$data = pg_fetch_assoc($res);
pg_free_result($res);
diff --git a/codebase/db_sasql.php b/codebase/db_sasql.php
index 85959df..025f5ef 100644
--- a/codebase/db_sasql.php
+++ b/codebase/db_sasql.php
@@ -20,7 +20,7 @@ class SaSQLDBDataWrapper extends DBDataWrapper{
return sasql_fetch_assoc($res);
}
- protected function get_new_id(){
+ public function get_new_id(){
return sasql_insert_id($this->connection);
}
diff --git a/codebase/db_sqlite.php b/codebase/db_sqlite.php
index cd8de9d..04df7e5 100644
--- a/codebase/db_sqlite.php
+++ b/codebase/db_sqlite.php
@@ -23,7 +23,7 @@ class SQLiteDBDataWrapper extends DBDataWrapper{
return $data;
}
- protected function get_new_id(){
+ public function get_new_id(){
return sqlite_last_insert_rowid($this->connection);
}
diff --git a/codebase/db_sqlite3.php b/codebase/db_sqlite3.php
index de284cf..349490b 100644
--- a/codebase/db_sqlite3.php
+++ b/codebase/db_sqlite3.php
@@ -22,7 +22,7 @@ class SQLite3DBDataWrapper extends DBDataWrapper{
return $res->fetchArray();
}
- protected function get_new_id(){
+ public function get_new_id(){
return $this->connection->lastInsertRowID();
}
diff --git a/codebase/db_sqlsrv.php b/codebase/db_sqlsrv.php
index 1908e7b..1b27020 100644
--- a/codebase/db_sqlsrv.php
+++ b/codebase/db_sqlsrv.php
@@ -51,7 +51,7 @@ class SQLSrvDBDataWrapper extends DBDataWrapper{
return $data;
}
- protected function get_new_id(){
+ public function get_new_id(){
/*
MSSQL doesn't support identity or auto-increment fields
Insert SQL returns new ID value, which stored in last_id field
diff --git a/codebase/gantt_connector.php b/codebase/gantt_connector.php
new file mode 100644
index 0000000..46c580b
--- /dev/null
+++ b/codebase/gantt_connector.php
@@ -0,0 +1,350 @@
+<?php
+/*
+ @author dhtmlx.com
+ @license GPL, see license.txt
+*/
+require_once("base_connector.php");
+require_once("data_connector.php");
+
+/*! DataItem class for Gantt component
+**/
+class GanttDataItem extends DataItem{
+
+ public static $open = null;
+
+ /*! return self as XML string
+ */
+ function to_xml(){
+ if ($this->skip) return "";
+
+ $str="<task id='".$this->get_id()."' >";
+ $str.="<start_date><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]></start_date>";
+ $str.="<".$this->config->text[1]["name"]."><![CDATA[".$this->data[$this->config->text[1]["name"]]."]]></".$this->config->text[1]["name"].">";
+ $str.="<text><![CDATA[".$this->data[$this->config->text[2]["name"]]."]]></text>";
+ for ($i=3; $i<sizeof($this->config->text); $i++){
+ $extra = $this->config->text[$i]["name"];
+ $str.="<".$extra."><![CDATA[".$this->data[$extra]."]]></".$extra.">";
+ }
+ if ($this->userdata !== false)
+ foreach ($this->userdata as $key => $value)
+ $str.="<".$key."><![CDATA[".$value."]]></".$key.">";
+ if (GanttDataItem::$open !== null)
+ $str.="<open>".GanttDataItem::$open."</open>";
+
+ return $str."</task>";
+ }
+}
+
+
+/*! Connector class for dhtmlxGantt
+**/
+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
+
+ @param name
+ name of the column
+ @param options
+ array or connector object
+ */
+ public function set_options($name,$options){
+ if (is_array($options)){
+ $str="";
+ foreach($options as $k => $v)
+ $str.="<item value='".$this->xmlentities($k)."' label='".$this->xmlentities($v)."' />";
+ $options=$str;
+ }
+ $this->options[$name]=$options;
+ }
+
+
+ /*! constructor
+
+ Here initilization of all Masters occurs, execution timer initialized
+ @param res
+ db connection resource
+ @param type
+ string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided
+ @param item_type
+ name of class, which will be used for item rendering, optional, DataItem will be used by default
+ @param data_type
+ name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
+ * @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="GanttDataItem";
+ if (!$data_type) $data_type="GanttDataProcessor";
+ if (!$render_type) $render_type="RenderStrategy";
+ parent::__construct($res,$type,$item_type,$data_type,$render_type);
+ }
+
+ //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"],"<");
+ if (isset($_GET["from"]))
+ $this->request->set_filter($this->config->text[1]["name"],$_GET["from"],">");
+ }
+ }
+
+ public function openAll($mode = true) {
+ GanttDataItem::$open = $mode;
+ }
+
+ public function render_links($table,$id="",$fields=false,$extra=false,$relation_id=false) {
+ $links = new GanttLinksConnector($this->get_connection(),$this->names["db_class"]);
+ $links->render_table($table,$id,$fields,$extra);
+ $this->set_options("links", $links);
+ }
+}
+
+/*! DataProcessor class for Gantt component
+**/
+class GanttDataProcessor extends DataProcessor{
+ function name_data($data){
+ if ($data=="start_date")
+ return $this->config->text[0]["db_name"];
+ if ($data=="id")
+ return $this->config->id["db_name"];
+ if ($data=="duration" && $this->config->text[1]["name"] == "duration")
+ return $this->config->text[1]["db_name"];
+ if ($data=="end_date" && $this->config->text[1]["name"] == "end_date")
+ return $this->config->text[1]["db_name"];
+ if ($data=="text")
+ return $this->config->text[2]["db_name"];
+
+ return $data;
+ }
+}
+
+
+class JSONGanttDataItem extends GanttDataItem{
+ /*! return self as XML string
+ */
+ function to_xml(){
+ if ($this->skip) return "";
+
+ $obj = array();
+ $obj['id'] = $this->get_id();
+ $obj['start_date'] = $this->data[$this->config->text[0]["name"]];
+ $obj[$this->config->text[1]["name"]] = $this->data[$this->config->text[1]["name"]];
+ $obj['text'] = $this->data[$this->config->text[2]["name"]];
+ for ($i=3; $i<sizeof($this->config->text); $i++){
+ $extra = $this->config->text[$i]["name"];
+ $obj[$extra]=$this->data[$extra];
+ }
+ if (GanttDataItem::$open !== null)
+ $obj['open'] = GanttDataItem::$open;
+
+ if ($this->userdata !== false)
+ foreach ($this->userdata as $key => $value)
+ $obj[$key]=$value;
+
+ return $obj;
+ }
+}
+
+
+class JSONGanttConnector extends GanttConnector {
+
+ protected $data_separator = ",";
+
+ /*! constructor
+
+ Here initilization of all Masters occurs, execution timer initialized
+ @param res
+ db connection resource
+ @param type
+ string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided
+ @param item_type
+ name of class, which will be used for item rendering, optional, DataItem will be used by default
+ @param data_type
+ 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="JSONGanttDataItem";
+ if (!$data_type) $data_type="GanttDataProcessor";
+ if (!$render_type) $render_type="JSONRenderStrategy";
+ parent::__construct($res,$type,$item_type,$data_type,$render_type);
+ }
+
+ protected function xml_start() {
+ return '{ "data":';
+ }
+
+ protected function xml_end() {
+ $this->fill_collections();
+ $end = (!empty($this->extra_output)) ? ', "collections": {'.$this->extra_output.'}' : '';
+ foreach ($this->attributes as $k => $v)
+ $end.=", \"".$k."\":\"".$v."\"";
+ $end .= '}';
+ return $end;
+ }
+
+ /*! assign options collection to the column
+
+ @param name
+ name of the column
+ @param options
+ array or connector object
+ */
+ public function set_options($name,$options){
+ if (is_array($options)){
+ $str=array();
+ foreach($options as $k => $v)
+ $str[]='{"id":"'.$this->xmlentities($k).'", "value":"'.$this->xmlentities($v).'"}';
+ $options=implode(",",$str);
+ }
+ $this->options[$name]=$options;
+ }
+
+
+ /*! generates xml description for options collections
+
+ @param list
+ comma separated list of column names, for which options need to be generated
+ */
+ protected function fill_collections($list=""){
+ $options = array();
+ foreach ($this->options as $k=>$v) {
+ $name = $k;
+ $option="\"{$name}\":[";
+ if (!is_string($this->options[$name])){
+ $data = json_encode($this->options[$name]->render());
+ $option.=substr($data,1,-1);
+ } else
+ $option.=$this->options[$name];
+ $option.="]";
+ $options[] = $option;
+ }
+ $this->extra_output .= implode($this->data_separator, $options);
+ }
+
+
+ /*! output fetched data as XML
+ @param res
+ DB resultset
+ */
+ protected function output_as_xml($res){
+ $result = $this->render_set($res);
+ if ($this->simple) return $result;
+
+ $data=$this->xml_start().json_encode($result).$this->xml_end();
+
+ if ($this->as_string) return $data;
+
+ $out = new OutputWriter($data, "");
+ $out->set_type("json");
+ $this->event->trigger("beforeOutput", $this, $out);
+ $out->output("", true, $this->encoding);
+ }
+
+ public function render_links($table,$id="",$fields=false,$extra=false,$relation_id=false) {
+ $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
diff --git a/codebase/grid_connector.php b/codebase/grid_connector.php
index 1244e0b..9748dee 100644
--- a/codebase/grid_connector.php
+++ b/codebase/grid_connector.php
@@ -145,9 +145,6 @@ class GridConnector extends Connector{
if (isset($_GET["dhx_colls"]))
$this->fill_collections($_GET["dhx_colls"]);
-
- if (isset($_GET["posStart"]) && isset($_GET["count"]))
- $this->request->set_limit($_GET["posStart"],$_GET["count"]);
}
protected function resolve_parameter($name){
if (intval($name).""==$name)
diff --git a/codebase/scheduler_connector.php b/codebase/scheduler_connector.php
index b05f770..ee0cd20 100644
--- a/codebase/scheduler_connector.php
+++ b/codebase/scheduler_connector.php
@@ -197,9 +197,10 @@ class JSONSchedulerConnector extends SchedulerConnector {
foreach ($this->options as $k=>$v) {
$name = $k;
$option="\"{$name}\":[";
- if (!is_string($this->options[$name]))
- $option.=substr($this->options[$name]->render(),0,-2);
- else
+ if (!is_string($this->options[$name])){
+ $data = json_encode($this->options[$name]->render());
+ $option.=substr($data,1,-1);
+ } else
$option.=$this->options[$name];
$option.="]";
$options[] = $option;
diff --git a/codebase/strategy.php b/codebase/strategy.php
index e81e55a..47582a5 100644
--- a/codebase/strategy.php
+++ b/codebase/strategy.php
@@ -155,6 +155,7 @@ class TreeRenderStrategy extends RenderStrategy {
$output="";
$index=0;
$conn = $this->conn;
+ $config_copy = new DataConfig($config);
$this->mix($config, $mix);
while ($data=$conn->sql->get_next($res)){
$data = $this->simple_mix($mix, $data);
@@ -168,8 +169,9 @@ class TreeRenderStrategy extends RenderStrategy {
$output.=$data->to_xml_start();
if ($data->has_kids()===-1 || ( $data->has_kids()==true && !$dload)){
$sub_request = new DataRequestConfig($conn->get_request());
+ $sub_request->set_fieldset(implode(",",$config_copy->db_names_list($conn->sql)));
$sub_request->set_relation($data->get_id());
- $output.=$this->render_set($conn->sql->select($sub_request), $name, $dload, $sep, $config);
+ $output.=$this->render_set($conn->sql->select($sub_request), $name, $dload, $sep, $config_copy, $mix);
}
$output.=$data->to_xml_end();
$index++;
@@ -207,6 +209,7 @@ class JSONTreeRenderStrategy extends TreeRenderStrategy {
$output=array();
$index=0;
$conn = $this->conn;
+ $config_copy = new DataConfig($config);
$this->mix($config, $mix);
while ($data=$conn->sql->get_next($res)){
$data = $this->complex_mix($mix, $data);
@@ -220,8 +223,10 @@ class JSONTreeRenderStrategy extends TreeRenderStrategy {
$record = $data->to_xml_start();
if ($data->has_kids()===-1 || ( $data->has_kids()==true && !$dload)){
$sub_request = new DataRequestConfig($conn->get_request());
+ $sub_request->set_fieldset(implode(",",$config_copy->db_names_list($conn->sql)));
$sub_request->set_relation($data->get_id());
- $temp = $this->render_set($conn->sql->select($sub_request), $name, $dload, $sep, $config, $mix);
+ $sub_request->set_filters(array());
+ $temp = $this->render_set($conn->sql->select($sub_request), $name, $dload, $sep, $config_copy, $mix);
if (sizeof($temp))
$record["data"] = $temp;
}
diff --git a/codebase/tree_connector.php b/codebase/tree_connector.php
index d94206a..f8985e2 100644
--- a/codebase/tree_connector.php
+++ b/codebase/tree_connector.php
@@ -198,7 +198,8 @@ class TreeConnector extends Connector{
/*! renders self as xml, ending part
*/
public function xml_end(){
- return "</tree>";
+ $this->fill_collections();
+ return $this->extra_output."</tree>";
}
}