function views_gantt_plugin_style_gantt::build_tree in Views Gantt 7.2
Same name and namespace in other branches
- 7 views_gantt_plugin_style_gantt.inc \views_gantt_plugin_style_gantt::build_tree()
1 call to views_gantt_plugin_style_gantt::build_tree()
- views_gantt_plugin_style_gantt::render in ./
views_gantt_plugin_style_gantt.inc - Render the given style.
File
- ./
views_gantt_plugin_style_gantt.inc, line 250 - Contains the list style plugin.
Class
- views_gantt_plugin_style_gantt
- Style plugin to render Gantt charts.
Code
function build_tree($tasks, $parent_id = '', $level = 0) {
$branch = array();
foreach ($tasks as $key => $task) {
if (!$task['parent_id'] && $key != $this->project['id']) {
$task['parent_id'] = $this->project['id'];
}
if ($task['parent_id'] == $parent_id) {
$task['id'] = $key;
$task['level'] = $level;
$children = $this
->build_tree($tasks, $key, $level + 1);
if ($children) {
$task['children'] = $children;
}
$branch[$key] = $task;
}
}
return $branch;
}