You are here

function views_gantt_plugin_style_gantt::options_form 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::options_form()

Style option form.

Overrides views_plugin_style_list::options_form

File

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

Class

views_gantt_plugin_style_gantt
Style plugin to render Gantt charts.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $fields = array(
    '' => t('<None>'),
  );
  foreach ($this->display->handler
    ->get_handlers('field') as $field => $handler) {
    if ($label = $handler
      ->label()) {
      $fields[$field] = $label;
    }
    else {
      $fields[$field] = $handler
        ->ui_name();
    }
  }
  $form['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height of Gantt Chart'),
    '#default_value' => $this->options['height'],
    '#description' => t('Height of Gantt Chart (in px).'),
    '#size' => '5',
  );
  $form['id_field'] = array(
    '#type' => 'select',
    '#title' => t('ID field'),
    '#options' => $fields,
    '#default_value' => $this->options['id_field'],
    '#description' => t('Select the field that contains nid of each record.'),
    '#required' => TRUE,
  );
  $form['name_field'] = array(
    '#type' => 'select',
    '#title' => t('Name field'),
    '#options' => $fields,
    '#default_value' => $this->options['name_field'],
    '#description' => t('Select the field that contains name of each record.'),
    '#required' => TRUE,
  );
  $form['date_field'] = array(
    '#type' => 'select',
    '#title' => t('Date field'),
    '#options' => $fields,
    '#default_value' => $this->options['date_field'],
    '#description' => t('Select the field that contains the start date (timestamp or valid <a href="http://www.php.net/manual/en/datetime.formats.php" target="_blank">date format</a>) of the node in the selected row.'),
    '#required' => TRUE,
  );
  $form['end_date_field'] = array(
    '#type' => 'select',
    '#title' => t('End date field'),
    '#options' => $fields,
    '#default_value' => $this->options['end_date_field'],
    '#description' => t('Select the field that contains the end date (timestamp or valid <a href="http://www.php.net/manual/en/datetime.formats.php" target="_blank">date format</a>) of the node in the selected row.'),
    '#required' => TRUE,
  );
  $form['progress_field'] = array(
    '#type' => 'select',
    '#title' => t('Progress field'),
    '#options' => $fields,
    '#default_value' => $this->options['progress_field'],
    '#description' => t('Select the field that contains the progress of the node in percents.'),
    '#required' => TRUE,
  );
  $form['project_id_field'] = array(
    '#type' => 'select',
    '#title' => t('Project ID field'),
    '#options' => $fields,
    '#default_value' => $this->options['project_id_field'],
    '#description' => t("Select the field that contains nid of the record's project node."),
    '#required' => TRUE,
  );
  $form['project_node_type'] = array(
    '#type' => 'select',
    '#title' => t('Project node type'),
    '#options' => node_type_get_names(),
    '#default_value' => $this->options['project_node_type'],
    '#description' => t('Select type of project nodes.'),
  );
  $form['project_date_field'] = array(
    '#type' => 'select',
    '#title' => t('Project date field'),
    '#options' => $fields,
    '#default_value' => $this->options['project_date_field'],
    '#description' => t("Select the field that contains the date (timestamp or valid <a href='http://www.php.net/manual/en/datetime.formats.php' target='_blank'>date format</a>) of the record's project node. If not provided, date of the earliest task will be used as project start date."),
  );
  $form['parent_id_field'] = array(
    '#type' => 'select',
    '#title' => t('Parent ID field'),
    '#options' => $fields,
    '#default_value' => $this->options['parent_id_field'],
    '#description' => t("Select the field that contains nid of the record's parent node."),
  );
  $form['predecessor_id_field'] = array(
    '#type' => 'select',
    '#title' => t('Predecessor ID field'),
    '#options' => $fields,
    '#default_value' => $this->options['predecessor_id_field'],
    '#description' => t("Select the field that contains nid of the record's predecessor node."),
  );
}