function views_gantt_plugin_style_gantt::add_task in Views Gantt 7
Same name and namespace in other branches
- 7.2 views_gantt_plugin_style_gantt.inc \views_gantt_plugin_style_gantt::add_task()
2 calls to views_gantt_plugin_style_gantt::add_task()
File
- ./
views_gantt_plugin_style_gantt.inc, line 620 - Contains the list style plugin.
Class
- views_gantt_plugin_style_gantt
- Style plugin to render Gantt charts.
Code
function add_task($data, $type = 'view') {
switch ($type) {
case 'view':
$method = 'views_gantt_get_field_value';
$task_id = $this
->{$method}($data, 'id_field');
break;
case 'node':
$method = 'views_gantt_get_node_field_value';
$task_id = $data->nid;
break;
default:
return;
}
$keys = array(
'name' => 'name_field',
'est' => 'date_field',
'end_date' => 'end_date_field',
'percentcompleted' => 'progress_field',
'predecessortasks' => 'predecessor_id_field',
'parent_id' => 'parent_id_field',
);
$task = array();
foreach ($keys as $key => $field) {
$task[$key] = $this
->{$method}($data, $field);
}
$this->tasks[$task_id] = $task + array(
'childtasks' => array(),
);
return $task_id;
}