summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/Output/JSONMultitableTreeRenderStrategy.php
blob: 98c161b925a60d2baf2ef525f0a0d28d18c6407b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace Dhtmlx\Connector\Output;

class JSONMultitableTreeRenderStrategy extends RenderStrategy {

    public function render_set($res, $name, $dload, $sep, $config, $mix){
        $output=array();
        $index=0;
        $conn = $this->conn;
        $this->mix($config, $mix);
        while ($data=$conn->sql->get_next($res)){
            $data = $this->complex_mix($mix, $data);
            $data[$config->id['name']] = $this->level_id($data[$config->id['name']]);
            $data = new $name($data,$config,$index);
            $conn->event->trigger("beforeRender",$data);

            if ($this->is_max_level()) {
                $data->set_kids(false);
            } else {
                if ($data->has_kids()===-1)
                    $data->set_kids(true);
            }
            $record = $data->to_xml_start($output);
            $output[] = $record;
            $index++;
        }
        $this->unmix($config, $mix);
        return $output;
    }

}