function forena_parameter_form_submit in Forena Reports 7.4
Same name and namespace in other branches
- 6.2 forena.common.inc \forena_parameter_form_submit()
- 7.5 forena.module \forena_parameter_form_submit()
- 7 forena.common.inc \forena_parameter_form_submit()
- 7.2 forena.common.inc \forena_parameter_form_submit()
- 7.3 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.module, line 893
Code
function forena_parameter_form_submit($form, &$form_state) {
$values = $form_state['values'];
unset($values['params']['submit']);
if (isset($values['params'])) {
foreach ($values['params'] as $key => $value) {
$ctl = $form['params'][$key];
switch ($ctl['#type']) {
case 'date_popup':
case 'date_select':
case 'date_text':
$datetime = @strtotime($value);
if ($datetime) {
$value = $values['params'][$key] = date($ctl['#forena_date_format'], $datetime);
}
break;
}
if (is_array($value)) {
$values['params'][$key] = array();
foreach ($value as $k => $val) {
if ($val) {
$values['params'][$key][] = $val;
}
}
}
else {
if (strpos($value, '|') !== FALSE) {
$values['params'][$key] = explode('|', $value);
}
elseif ($value === '' || $value === NULL) {
unset($values['params'][$key]);
}
}
}
}
$desc = $form_state['storage']['desc'];
if ($desc['always_redirect']) {
$path = $desc['link'];
}
else {
$path = isset($desc['q']) ? $desc['q'] : '';
}
if (!$path) {
$path = $_GET['q'];
}
if ($path) {
$form_state['redirect'] = array(
$path,
array(
'query' => @$values['params'],
),
);
}
}