Example #1
0
 protected function fill_collections($list)
 {
     $names = explode(",", $list);
     $options = array();
     for ($i = 0; $i < sizeof($names); $i++) {
         $name = $this->resolve_parameter($names[$i]);
         if (!array_key_exists($name, $this->options)) {
             $this->options[$name] = new JSONDistinctOptionsConnector($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);
         }
         $option = "\"{$name}\":[";
         if (!is_string($this->options[$name])) {
             $option .= substr($this->options[$name]->render(), 0, -2);
         } else {
             $option .= $this->options[$name];
         }
         $option .= "]";
         $options[] = $option;
     }
     $this->extra_output .= implode(",", $options);
 }
Example #2
0
 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 .= "<coll_options for='{$names[$i]}'>";
         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>";
     }
 }
Example #3
0
 public function render_set($res, $name, $dload, $sep, $config, $mix)
 {
     $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);
         $data = new $name($data, $config, $index);
         $conn->event->trigger("beforeRender", $data);
         //there is no info about child elements,
         //if we are using dyn. loading - assume that it has,
         //in normal mode just exec sub-render routine
         if ($data->has_kids() === -1 && $dload) {
             $data->set_kids(true);
         }
         $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());
             $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;
             }
         }
         $output[] = $record;
         $index++;
     }
     $this->unmix($config, $mix);
     return $output;
 }