You are here

function views_gantt_plugin_style_gantt::project_date in Views Gantt 7.2

Same name and namespace in other branches
  1. 7 views_gantt_plugin_style_gantt.inc \views_gantt_plugin_style_gantt::project_date()
1 call to views_gantt_plugin_style_gantt::project_date()
views_gantt_plugin_style_gantt::get_project in ./views_gantt_plugin_style_gantt.inc

File

./views_gantt_plugin_style_gantt.inc, line 531
Contains the list style plugin.

Class

views_gantt_plugin_style_gantt
Style plugin to render Gantt charts.

Code

function project_date($type = 'start') {
  $date = time();
  if ($this->view->result) {
    foreach ($this->view->result as $value) {
      $task_date = $this
        ->views_gantt_get_field_value($value, 'date_field');
      $task_date = strtotime(str_replace(',', '-', $task_date));
      switch ($type) {
        case 'start':
          $condition = $task_date && $task_date < $date;
          break;
        case 'end':
          $condition = $task_date && $task_date > $date;
          break;
      }
      if (!empty($condition)) {
        $date = $task_date;
      }
    }
    views_gantt_normalize_date_field($date);
    return $date;
  }
  return NULL;
}