You are here

function views_gantt_plugin_style_gantt::check_predecessor in Views Gantt 7

If predecessor task starts later then child task, we just remove predecessor-child relation.

1 call to views_gantt_plugin_style_gantt::check_predecessor()
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 320
Contains the list style plugin.

Class

views_gantt_plugin_style_gantt
Style plugin to render Gantt charts.

Code

function check_predecessor($id) {
  if (!empty($this->tasks[$id]['predecessortasks'])) {
    $predecessor = $this->tasks[$id]['predecessortasks'];
    $this
      ->check_predecessor($predecessor);
    if (isset($this->tasks[$predecessor])) {
      $start_time = $this
        ->get_time($this->tasks[$id]['est']);
      $pre_start_time = $this
        ->get_time($this->tasks[$predecessor]['est']);
      $pre_end_time = $this
        ->get_time($this->tasks[$predecessor]['end_date']);
      $remove = $pre_start_time >= $start_time || $pre_end_time > $start_time;
    }
    else {
      $remove = TRUE;
    }
    if ($remove) {
      $this->tasks[$id]['predecessortasks'] = '';
      $this->tasks[$id]['predecessor_modified'] = TRUE;
    }
  }
}