summaryrefslogtreecommitdiffstats
path: root/codebase/connector/base_connector.php
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/connector/base_connector.php')
-rw-r--r--codebase/connector/base_connector.php58
1 files changed, 33 insertions, 25 deletions
diff --git a/codebase/connector/base_connector.php b/codebase/connector/base_connector.php
index 26f1f8b..cb44b15 100644
--- a/codebase/connector/base_connector.php
+++ b/codebase/connector/base_connector.php
@@ -282,38 +282,38 @@ class DataItem{
Can be used on its own to provide raw data.
**/
class Connector {
+
+ private $id_seed=0; //!< default value, used to generate auto-IDs
+ private $db; //!< db connection resource
+
protected $config;//DataConfig instance
protected $request;//DataRequestConfig instance
protected $names;//!< hash of names for used classes
protected $encoding="utf-8";//!< assigned encoding (UTF-8 by default)
protected $editing=false;//!< flag of edit mode ( response for dataprocessor )
+ protected $updating=false;//!< flag of update mode ( response for data-update )
+ protected $dload;//!< flag of dyn. loading mode
+ protected $data_separator = "\n";
+ protected $live_update = false; // actions table name for autoupdating
+ protected $live_update_data_type = "DataUpdate";
+ protected $extra_output="";//!< extra info which need to be sent to client side
+ protected $options=array();//!< hash of OptionsConnector
+ protected $as_string = false; // render() returns string, don't send result in response
+ protected $simple = false; // render only data without any other info
+ protected $filters;
+ protected $sorts;
+ protected $mix;
+ protected $order = false;
public static $filter_var="dhx_filter";
public static $sort_var="dhx_sort";
public static $kids_var="dhx_kids";
- public $model=false;
-
- private $updating=false;//!< flag of update mode ( response for data-update )
- private $db; //!< db connection resource
- protected $dload;//!< flag of dyn. loading mode
- public $access; //!< AccessMaster instance
- protected $data_separator = "\n";
-
- public $sql; //DataWrapper instance
- public $event; //EventMaster instance
- public $limit=false;
-
- private $id_seed=0; //!< default value, used to generate auto-IDs
- protected $live_update = false; // actions table name for autoupdating
- protected $extra_output="";//!< extra info which need to be sent to client side
- protected $options=array();//!< hash of OptionsConnector
- protected $as_string = false; // render() returns string, don't send result in response
- protected $simple = false; // render only data without any other info
- protected $filters;
- protected $sorts;
- protected $mix;
- protected $order = false;
+ public $model=false;
+ public $access; //!< AccessMaster instance
+ public $sql; //DataWrapper instance
+ public $event; //EventMaster instance
+ public $limit=false;
/*! constructor
@@ -419,7 +419,7 @@ class Connector {
$id = $info["key"];
}
$this->config->init($id,$fields,$extra,$relation_id);
- if (strpos(trim($table), " ")!==false)
+ if (is_string($table) && strpos(trim($table), " ")!==false)
$this->request->parse_sql($table);
else
$this->request->set_source($table);
@@ -700,6 +700,9 @@ class Connector {
*/
public function set_encoding($encoding){
$this->encoding=$encoding;
+ if ($this->live_update !== false) {
+ $this->live_update->set_encoding($this->encoding);
+ }
}
/*! enable or disable dynamic loading mode
@@ -810,6 +813,10 @@ class Connector {
$this->options[$name]=$options;
}
+ public function get_options() {
+ return $this->options;
+ }
+
public function insert($data) {
$action = new DataAction('inserted', false, $data);
@@ -850,9 +857,10 @@ class Connector {
@param url
url used for update notifications
*/
- public function enable_live_update($table, $url=false){
- $this->live_update = new DataUpdate($this->sql, $this->config, $this->request, $table,$url);
+ public function enable_live_update($table, $url=false, $origin_table = false){
+ $this->live_update = new $this->live_update_data_type($this->sql, $this->config, $this->request, $table,$url, array("connector" => $this, "table" => $origin_table));
$this->live_update->set_event($this->event,$this->names["item_class"]);
+ $this->live_update->set_encoding($this->encoding);
$this->event->attach("beforeOutput", Array($this->live_update, "version_output"));
$this->event->attach("beforeFiltering", Array($this->live_update, "get_updates"));
$this->event->attach("beforeProcessing", Array($this->live_update, "check_collision"));