You are here

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

Style option form.

Overrides views_plugin_style_list::options_form

File

./views_gantt_plugin_style_gantt.inc, line 50
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();
    }
  }
  $types = array();
  foreach (node_type_get_types() as $key => $value) {
    $key = str_replace('_', '-', $key);
    $types[$key] = $value->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['task_type'] = array(
    '#type' => 'select',
    '#title' => t('Task type'),
    '#options' => $types,
    '#default_value' => $this->options['task_type'],
    '#description' => t("Select the task node type."),
    '#required' => TRUE,
  );
  $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."),
  );
  $form['columns'] = array(
    '#type' => 'select',
    '#multiple' => TRUE,
    '#title' => t('Additional columns'),
    '#options' => $fields,
    '#default_value' => $this->options['columns'],
  );
  $form['add_task'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add Task'),
    '#default_value' => $this->options['add_task'],
    '#description' => t("Enable posibility 'Add Task' from Gantt chart."),
  );
  $form['edit_task'] = array(
    '#type' => 'checkbox',
    '#title' => t('Edit Task'),
    '#default_value' => $this->options['edit_task'],
    '#description' => t("Enable posibility 'Edit Task' from Gantt chart."),
  );
  $form['scale'] = array(
    '#type' => 'select',
    '#title' => t('Scale level'),
    '#options' => array(
      1 => 'Hours',
      2 => 'Days',
      3 => 'Months',
    ),
    '#default_value' => $this->options['scale'],
    '#description' => t("Select default scale level."),
  );
}