You are here

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

Class

views_gantt_plugin_style_gantt
Style plugin to render Gantt charts.

Code

function get_project() {
  $project_id = $this
    ->views_gantt_get_field_value($this->view->result[0], 'project_id_field');
  $node = node_load($project_id);
  if (!$node) {
    $this->project = NULL;
  }
  else {
    $project_date = $this
      ->views_gantt_get_field_value($this->view->result[0], 'project_date_field');
    $project_end_date = $this
      ->views_gantt_get_field_value($this->view->result[0], 'project_end_date_field');
    $id = $this
      ->add_task($node, 'node');
    $this->project = array(
      'id' => $id,
    ) + $this->tasks[$id];
    if (!$project_date) {
      $this->project['est'] = $this
        ->project_date('start');
      $this->tasks[$id]['est'] = $this->project['est'];
    }
    if (!$project_end_date) {
      $this->project['end_date'] = $this
        ->project_date('end');
      $this->tasks[$id]['end_date'] = $this->project['end_date'];
    }
    if (!$this->project['est'] || !$this->project['end_date']) {
      drupal_set_message(t('Gantt Chart requires filled project date.'), 'warning');
      $this->project = NULL;
    }
  }
  return $this->project;
}