function views_gantt_plugin_style_gantt::load_missing_values in Views Gantt 7
Same name and namespace in other branches
- 7.2 views_gantt_plugin_style_gantt.inc \views_gantt_plugin_style_gantt::load_missing_values()
1 call to views_gantt_plugin_style_gantt::load_missing_values()
- 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 568 - Contains the list style plugin.
Class
- views_gantt_plugin_style_gantt
- Style plugin to render Gantt charts.
Code
function load_missing_values($id) {
$task =& $this->tasks[$id];
// If task has no start_date, try to get parent/project start_date and use it.
if (!$task['est']) {
$task['start_date_modified'] = TRUE;
if ($task['parent_id'] && $this->tasks[$task['parent_id']]['est']) {
$task['est'] = $this->tasks[$task['parent_id']]['est'];
}
else {
$task['est'] = $this->project['startdate'];
}
}
// If task has no end_date, try to get parent end_date and use it.
if (!$task['end_date'] || $task['end_date'] == $task['est']) {
$task['end_date_modified'] = TRUE;
if ($task['parent_id'] && $this->tasks[$task['parent_id']]['end_date']) {
$task['end_date'] = $this->tasks[$task['parent_id']]['end_date'];
}
}
// If task end_date <= task start_date,
// try to use node creation date as start_date.
$start_time = $this
->get_time($task['est']);
$end_time = $this
->get_time($task['end_date']);
if ($end_time <= $start_time) {
$node = node_load($id);
if ($node) {
$task['end_date'] = $task['est'];
$task['est'] = $node->created;
views_gantt_normalize_date_field($task['est']);
}
}
// If after all calculation we still have incorrect dates,
// try to add one day for end date.
$start_time = $this
->get_time($task['est']);
$end_time = $this
->get_time($task['end_date']);
if ($end_time <= $start_time) {
$task['end_date'] = $end_time + 3600 * 24;
views_gantt_normalize_date_field($task['end_date']);
}
}