summaryrefslogtreecommitdiffstats
path: root/codebase/base_connector.php
diff options
context:
space:
mode:
authorDmitry <dmitry@dhtmlx.com>2012-05-22 16:50:46 +0200
committerDmitry <dmitry@dhtmlx.com>2012-05-22 16:50:46 +0200
commitdff9912b9ee40fbac29c54b4cf67591e11b5e4cb (patch)
tree0129bc7f77c5098874ebffb6c6f52f381eda28b3 /codebase/base_connector.php
parent2f3109a94c96af3cbaa8973407d27d072d489248 (diff)
downloadconnector-php-dff9912b9ee40fbac29c54b4cf67591e11b5e4cb.zip
connector-php-dff9912b9ee40fbac29c54b4cf67591e11b5e4cb.tar.gz
connector-php-dff9912b9ee40fbac29c54b4cf67591e11b5e4cb.tar.bz2
implements correct extending for fill_collections
Diffstat (limited to 'codebase/base_connector.php')
-rw-r--r--codebase/base_connector.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php
index 48039a6..8890a68 100644
--- a/codebase/base_connector.php
+++ b/codebase/base_connector.php
@@ -278,6 +278,7 @@ class Connector {
private $id_seed=0; //!< default value, used to generate auto-IDs
protected $live_update = false; // actions table name for autoupdating
+ protected $options=array();//!< hash of OptionsConnector
/*! constructor
@@ -649,9 +650,38 @@ class Connector {
/*! renders self as xml, ending part
*/
protected function xml_end(){
- return "</data>";
+ $this->fill_collections();
+ return $this->extra_output."</data>";
+ }
+
+ protected function fill_collections(){
+ foreach ($this->options as $k=>$v) {
+ $name = $k;
+ $this->extra_output.="<coll_options for='{$name}'>";
+ if (!is_string($this->options[$name]))
+ $this->extra_output.=$this->options[$name]->render();
+ else
+ $this->extra_output.=$this->options[$name];
+ $this->extra_output.="</coll_options>";
+ }
}
+ /*! 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;
+ }
public function insert($data) {
$action = new DataAction('inserted', false, $data);