You are here

function views_gantt_plugin_style_gantt::check_date in Views Gantt 7

Same name and namespace in other branches
  1. 7.2 views_gantt_plugin_style_gantt.inc \views_gantt_plugin_style_gantt::check_date()
1 call to views_gantt_plugin_style_gantt::check_date()
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 225
Contains the list style plugin.

Class

views_gantt_plugin_style_gantt
Style plugin to render Gantt charts.

Code

function check_date($task, $parent_id = '') {
  if (isset($task['children'])) {
    foreach ($task['children'] as $child) {
      $this
        ->check_date($child, $task['id']);
    }
  }
  $time = $this
    ->get_time($this->tasks[$task['id']]['est']);
  $project_time = $this
    ->get_time($this->project['startdate']);
  if ($parent_id) {
    $end_time = $this
      ->get_time($this->tasks[$task['id']]['end_date']);
    $parent_time = $this
      ->get_time($this->tasks[$parent_id]['est']);
    $parent_end_time = $this
      ->get_time($this->tasks[$parent_id]['end_date']);
    if ($time && $time < $parent_time) {
      $this->tasks[$parent_id]['est'] = date('Y,n,j', $time);
      $this->tasks[$parent_id]['est_modified'] = TRUE;
    }
    if ($end_time > $parent_end_time) {
      $this->tasks[$parent_id]['end_date'] = date('Y,n,j', $end_time);
      $this->tasks[$parent_id]['duration_modified'] = TRUE;
    }
  }
  if ($time && $time < $project_time) {
    $this->project['startdate'] = $time;
    views_gantt_normalize_date_field($this->project['startdate']);
  }
}