summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/Output/JSONRenderStrategy.php
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/Dhtmlx/Connector/Output/JSONRenderStrategy.php')
-rw-r--r--codebase/Dhtmlx/Connector/Output/JSONRenderStrategy.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/codebase/Dhtmlx/Connector/Output/JSONRenderStrategy.php b/codebase/Dhtmlx/Connector/Output/JSONRenderStrategy.php
new file mode 100644
index 0000000..fddfd3d
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/Output/JSONRenderStrategy.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace DHTMLX\Connector\Output;
+
+class JSONRenderStrategy extends RenderStrategy {
+
+ /*! render from DB resultset
+ @param res
+ DB resultset
+ process commands, output requested data as json
+ */
+ public function render_set($res, $name, $dload, $sep, $config, $mix){
+ $output=array();
+ $index=0;
+ $conn = $this->conn;
+ $this->mix($config, $mix);
+ $conn->event->trigger("beforeRenderSet",$conn,$res,$config);
+ while ($data=$conn->sql->get_next($res)){
+ $data = $this->complex_mix($mix, $data);
+ $data = new $name($data,$config,$index);
+ if ($data->get_id()===false)
+ $data->set_id($conn->uuid());
+ $conn->event->trigger("beforeRender",$data);
+ $item = $data->to_xml();
+ if ($item !== false)
+ $output[]=$item;
+ $index++;
+ }
+ $this->unmix($config, $mix);
+ return $output;
+ }
+
+}