You are here

function forena_parameter_form_submit in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 forena.common.inc \forena_parameter_form_submit()
  2. 7.5 forena.module \forena_parameter_form_submit()
  3. 7 forena.common.inc \forena_parameter_form_submit()
  4. 7.3 forena.module \forena_parameter_form_submit()
  5. 7.4 forena.module \forena_parameter_form_submit()

gets the values from the params form redirects to the report page with the values in the querystring.

File

./forena.common.inc, line 309
Common functions used throughout the project but loaded in this file to keep the module file lean.

Code

function forena_parameter_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  unset($values['submit']);
  foreach ($values['params'] as $key => $value) {
    if (is_array($value)) {
      foreach ($value as $k => $val) {
        if (!$val) {
          unset($values['params'][$key][$k]);
        }
      }
    }
    else {
      if (strpos($value, '|') !== FALSE) {
        $values['params'][$key] = explode('|', $value);
      }
    }
  }
  $form_state['redirect'] = array(
    $_GET['q'],
    array(
      'query' => $values['params'],
    ),
  );
}