fill_collections($_GET["dhx_colls"]); } protected function resolve_parameter($name){ if (intval($name).""==$name) return $this->config->text[intval($name)]["db_name"]; return $name; } /*! replace xml unsafe characters @param string string to be escaped @return escaped string */ protected function xmlentities($string) { return str_replace( array( '&', '"', "'", '<', '>', '’' ), array( '&' , '"', ''' , '<' , '>', ''' ), $string); } /*! 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.=""; $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=""){ $names=explode(",",$list); for ($i=0; $i < sizeof($names); $i++) { $name = $this->resolve_parameter($names[$i]); if (!array_key_exists($name,$this->options)){ $this->options[$name] = new DistinctOptionsConnector($this->get_connection(),$this->names["db_class"]); $c = new DataConfig($this->config); $r = new DataRequestConfig($this->request); $c->minimize($name); $this->options[$name]->render_connector($c,$r); } $this->extra_output.=""; if (!is_string($this->options[$name])) $this->extra_output.=$this->options[$name]->render(); else $this->extra_output.=$this->options[$name]; $this->extra_output.=""; } } /*! renders self as xml, starting part */ protected function xml_start(){ $attributes = ""; foreach($this->attributes as $k=>$v) $attributes .= " ".$k."='".$v."'"; if ($this->dload){ if ($pos=$this->request->get_start()) return ""; else return ""; } else return ""; } /*! renders self as xml, ending part */ protected function xml_end(){ return $this->extra_output.""; } public function set_config($config = false){ if (gettype($config) == 'boolean') $config = new GridConfiguration($config); $this->event->attach("beforeOutput", Array($config, "attachHeaderToXML")); $this->event->attach("onInit", Array($config, "defineOptions")); } }