You are here

function forena_report_format_form in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 forena.report.inc \forena_report_format_form()
  2. 7.4 forena.report.inc \forena_report_format_form()
1 string reference to 'forena_report_format_form'
forena_menu in ./forena.module
Implementation of hook_menu.

File

./forena.report.inc, line 516

Code

function forena_report_format_form($formid, $form_state, $report_name) {
  $r = Frx::Editor($report_name);
  drupal_set_title($r->title);
  $form = array();
  $doclist = Frx::Menu()->doc_formats;
  $form['report_name'] = array(
    '#type' => 'value',
    '#value' => $report_name,
  );

  //begin checking doc generation options
  if ($r) {
    $nodes = $r->simplexml->head
      ->xpath('frx:docgen/frx:doc');
  }
  if ($doclist) {
    $form['docgen'] = array(
      '#tree' => TRUE,
      '#type' => 'fieldset',
      '#title' => t('Document Options'),
      '#description' => t('These are document transformation options. Options selected will display as links in your report view.'),
    );

    //build the options and default list
    $options = array();
    $default = array();
    foreach ($doclist as $value) {
      $options[$value] = strtoupper($value);
      $doc = isset($r) ? $r->simplexml->head
        ->xpath('frx:docgen/frx:doc[@type="' . $value . '"]') : '';
      if ($doc && array_search($value, $doclist) !== FALSE) {
        $default[$value] = $value;
      }
    }

    //display checkboxes
    $form['docgen']['docs'] = array(
      '#type' => 'checkboxes',
      '#description' => t('If no options are selected, the system will display all of the above as available for this report.'),
      '#options' => $options,
      '#default_value' => $default,
    );
    $form['update'] = array(
      '#type' => 'submit',
      '#value' => 'Update',
    );
    $form['cancel'] = array(
      '#type' => 'submit',
      '#value' => 'Cancel',
      '#submit' => array(
        'forena_update_cancel',
      ),
    );
  }
  return $form;
}