function userpoints_filter_cat_select in User Points 5.3
Same name and namespace in other branches
- 6 userpoints.module \userpoints_filter_cat_select()
3 string references to 'userpoints_filter_cat_select'
File
- ./
userpoints.module, line 1353
Code
function userpoints_filter_cat_select($path, $tid) {
$current_cat = url($path . $tid);
$form = array();
$formname = 'catselect';
$sql = "SELECT DISTINCT p.tid, t.name\n FROM {userpoints_txn} p \n LEFT JOIN {term_data} t on p.tid = t.tid";
$cats = userpoints_get_categories();
$options = array();
$options[url($path)] = t('Display all');
foreach ($cats as $key => $value) {
$options[url($path . $key)] = $value;
}
$form['catselect'] = array(
'#type' => 'select',
'#name' => $formname,
'#id' => $formname,
'#title' => t('Filter by category'),
'#default_value' => $current_cat,
'#options' => $options,
'#multiple' => false,
'#required' => false,
'#attributes' => array(
'onChange' => "top.location.href=document.getElementById('{$formname}').options[document.getElementById('{$formname}').selectedIndex].value",
),
);
return $form;
}