function _forena_query_filter_ctl in Forena Reports 7.3
Recursively build query form.
Parameters
$data array of data where clause filters:
$ctl form control to modify:
unknown_type $fields:
1 call to _forena_query_filter_ctl()
File
- ./
forena_query.inc, line 441
Code
function _forena_query_filter_ctl(&$data, &$ctl, $fields) {
static $i = 0;
$i++;
$operators = array(
'=' => 'is',
'<>' => 'is not',
'>' => 'is greater than',
'<' => 'is less than',
'LIKE' => 'is like',
'IS NOT NULL' => 'is not null',
'IS NULL' => 'is null',
);
$ctl['op'] = array(
'#type' => 'select',
'#options' => array(
'AND' => 'all of',
'OR' => 'any of',
),
'#default_value' => $data['op'],
);
$ctl['filter'] = array(
'#type' => 'fieldset',
);
if ($i > 1) {
$ctl['filter']['ungroup'] = array(
'#type' => 'submit',
'#value' => t('Remove'),
'#name' => $i,
'#submit' => array(
'forena_query_remove_group',
),
'#weight' => 1,
);
}
$i++;
foreach ($data['filter'] as $k => $crit) {
$i++;
if (isset($crit['filter'])) {
$cnd = array();
_forena_query_filter_ctl($data['filter'][$k], $cnd, $fields);
}
else {
$cnd = array(
'#prefix' => '<div class="forena-filter">',
'#suffix' => '</div>',
);
$cnd['field'] = array(
'#type' => 'select',
'#options' => $fields,
'#default_value' => $crit['field'],
);
$cnd['op'] = array(
'#type' => 'select',
'#options' => $operators,
'#default_value' => $crit['op'],
);
$cnd['value'] = array(
'#type' => 'textfield',
'#default_value' => $crit['value'],
);
$cnd['group'] = array(
'#type' => 'submit',
'#value' => '( )',
'#submit' => array(
'forena_query_group_filter',
),
'#name' => $i,
);
$i++;
if ($k > 0) {
$cnd['remove_filter'] = array(
'#type' => 'submit',
'#value' => '-',
'#submit' => array(
'forena_query_remove_filter',
),
'#name' => $i,
);
}
$i++;
}
$ctl['filter'][] = $cnd;
}
$i++;
$ctl['filter']['add_filter'] = array(
'#type' => 'submit',
'#value' => '+',
'#submit' => array(
'forena_query_add_filter',
),
'#name' => $i,
);
}