You are here

function forena_add_param_form in Forena Reports 7.3

Same name and namespace in other branches
  1. 6.2 forena.admin.inc \forena_add_param_form()
  2. 7.2 forena.admin.inc \forena_add_param_form()
1 string reference to 'forena_add_param_form'
forena_menu in ./forena.module
Implementation of hook_menu.

File

./forena.admin.inc, line 2340

Code

function forena_add_param_form($form, &$form_state, $report_name) {
  $desc = Frx::Menu()
    ->parseURL($report_name);
  $name = $desc['name'];
  $filename = $desc['filename'];
  $format = @$desc['format'];
  if ($desc['exists'] && $name) {
    $r = forena_get_report_editor($name);
    drupal_set_title($r->title);
    $form = array();
    $form['rpt_name'] = array(
      '#type' => 'value',
      '#value' => $name,
    );
    $form['return'] = array(
      '#type' => 'value',
      '#value' => $desc['link'] . '/edit/params',
    );
    $form['params'] = array(
      '#tree' => TRUE,
    );
    $form['params']['id'] = array(
      '#type' => 'textfield',
      '#title' => t('id'),
      '#required' => TRUE,
      '#description' => t('The name of the parameter to be filtered against.'),
    );
    $form['params']['label'] = array(
      '#type' => 'textfield',
      '#title' => t('label'),
      '#required' => FALSE,
      '#description' => t('A descriptive name of the parameter to be displayed on a form.'),
    );
    $form['params']['require'] = array(
      '#type' => 'radios',
      '#title' => t('require'),
      '#options' => array(
        "1" => t('Yes'),
        "0" => t('No'),
      ),
      '#description' => t('Requires a value for this parameter to display the report. If there is not a default value, the user will be prompted to enter a value.'),
    );
    $form['params']['value'] = array(
      '#type' => 'textfield',
      '#title' => 'default value',
      '#description' => t('The value of the parameter for the initial view of the report.'),
    );
    $form['params']['desc'] = array(
      '#type' => 'textfield',
      '#title' => t('description'),
      '#description' => t('Enter a helpful description about this parameter. This will display on the form when the user is prompted to enter a parameter.'),
    );
    $form['save'] = array(
      '#type' => 'submit',
      '#value' => 'Add',
      '#submit' => array(
        'forena_add_param_form_submit',
      ),
    );
    $form['cancel'] = array(
      '#type' => 'submit',
      '#value' => 'Cancel',
      '#submit' => array(
        'forena_add_cancel',
      ),
    );
  }
  return $form;
}