| 1 |
<?php |
<?php |
| 2 |
// $Id: stormattribute.admin.inc,v 1.3 2008/05/16 12:56:10 robertogerola Exp $ |
// $Id: stormattribute.admin.inc,v 1.4 2008/06/23 16:46:35 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 39 |
$where[] = "domain='". $_SESSION['stormattribute_list_filter']['domain'] ."'"; |
$where[] = "domain='". $_SESSION['stormattribute_list_filter']['domain'] ."'"; |
| 40 |
} |
} |
| 41 |
|
|
| 42 |
|
if ($_SESSION['stormattribute_list_filter']['akey']) { |
| 43 |
|
$where[] = "LOWER(akey) LIKE LOWER('". $_SESSION['stormattribute_list_filter']['akey'] ."')"; |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
if ($_SESSION['stormattribute_list_filter']['avalue']) { |
| 47 |
|
$where[] = "LOWER(avalue) LIKE LOWER('". $_SESSION['stormattribute_list_filter']['avalue'] ."')"; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
$itemsperpage = $_SESSION['stormattribute_list_filter']['itemsperpage']; |
$itemsperpage = $_SESSION['stormattribute_list_filter']['itemsperpage']; |
| 51 |
|
|
| 52 |
$tablesort = tablesort_sql($header); |
$tablesort = tablesort_sql($header); |
| 53 |
|
|
| 54 |
$s = db_rewrite_sql($s, 'stormattribute', 'aid'); |
$s = db_rewrite_sql($s, 'stormattribute', 'aid'); |
| 55 |
$s = stormtimetracking_access_sql($s, $where) . $tablesort; |
$s = storm_rewrite_sql($s, $where) . $tablesort; |
| 56 |
$r = pager_query($s, $itemsperpage, 0, NULL); |
$r = pager_query($s, $itemsperpage, 0, NULL); |
| 57 |
|
|
| 58 |
$attributes = array(); |
$attributes = array(); |
| 77 |
$domain = 0; |
$domain = 0; |
| 78 |
$_SESSION['stormattribute_list_filter']['domain'] = $domain; |
$_SESSION['stormattribute_list_filter']['domain'] = $domain; |
| 79 |
} |
} |
| 80 |
|
$akey = $_SESSION['stormattribute_list_filter']['akey']; |
| 81 |
|
$avalue = $_SESSION['stormattribute_list_filter']['avalue']; |
| 82 |
|
|
| 83 |
$itemsperpage = $_SESSION['stormattribute_list_filter']['itemsperpage']; |
$itemsperpage = $_SESSION['stormattribute_list_filter']['itemsperpage']; |
| 84 |
if (!$itemsperpage) { |
if (!$itemsperpage) { |
| 85 |
$itemsperpage = 10; |
$itemsperpage = 10; |
| 93 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 94 |
); |
); |
| 95 |
|
|
| 96 |
$form['filter']['domain'] = array( |
$form['filter']['group1'] = array( |
| 97 |
|
'#type' => 'markup', |
| 98 |
|
'#theme' => 'storm_form_group', |
| 99 |
|
); |
| 100 |
|
|
| 101 |
|
$form['filter']['group1']['domain'] = array( |
| 102 |
'#type' => 'select', |
'#type' => 'select', |
| 103 |
'#title' => t('Domain'), |
'#title' => t('Domain'), |
| 104 |
'#default_value' => $domain, |
'#default_value' => $domain, |
| 105 |
'#options' => array('0' => t('All')) + _stormattibute_domain_options(), |
'#options' => array('0' => t('All')) + _stormattibute_domain_options(), |
| 106 |
); |
); |
| 107 |
|
|
| 108 |
$form['filter']['group1'] = array( |
$form['filter']['group1']['akey'] = array( |
| 109 |
|
'#type' => 'textfield', |
| 110 |
|
'#title' => t('Key'), |
| 111 |
|
'#default_value' => $akey, |
| 112 |
|
'#size' => 20, |
| 113 |
|
); |
| 114 |
|
|
| 115 |
|
$form['filter']['group1']['avalue'] = array( |
| 116 |
|
'#type' => 'textfield', |
| 117 |
|
'#title' => t('Value'), |
| 118 |
|
'#default_value' => $avalue, |
| 119 |
|
'#size' => 20, |
| 120 |
|
); |
| 121 |
|
|
| 122 |
|
$form['filter']['group2'] = array( |
| 123 |
'#type' => 'markup', |
'#type' => 'markup', |
| 124 |
'#theme' => 'storm_form_group', |
'#theme' => 'storm_form_group', |
| 125 |
); |
); |
| 126 |
|
|
| 127 |
$form['filter']['group1']['submit'] = array( |
$form['filter']['group2']['submit'] = array( |
| 128 |
'#type' => 'submit', |
'#type' => 'submit', |
| 129 |
'#value' => t('Filter'), |
'#value' => t('Filter'), |
| 130 |
'#submit' => array('stormattribute_list_filter_filter'), |
'#submit' => array('stormattribute_list_filter_filter'), |
| 131 |
); |
); |
| 132 |
|
|
| 133 |
$form['filter']['group1']['reset'] = array( |
$form['filter']['group2']['reset'] = array( |
| 134 |
'#type' => 'submit', |
'#type' => 'submit', |
| 135 |
'#value' => t('Reset'), |
'#value' => t('Reset'), |
| 136 |
'#submit' => array('stormattribute_list_filter_reset'), |
'#submit' => array('stormattribute_list_filter_reset'), |
| 137 |
); |
); |
| 138 |
|
|
| 139 |
$form['filter']['group1']['itemsperpage'] = array( |
$form['filter']['group2']['itemsperpage'] = array( |
| 140 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 141 |
'#title' => t('Items'), |
'#title' => t('Items'), |
| 142 |
'#size' => 10, |
'#size' => 10, |
| 150 |
|
|
| 151 |
function stormattribute_list_filter_filter($form, &$form_state) { |
function stormattribute_list_filter_filter($form, &$form_state) { |
| 152 |
$_SESSION['stormattribute_list_filter']['domain'] = $form_state['values']['domain']; |
$_SESSION['stormattribute_list_filter']['domain'] = $form_state['values']['domain']; |
| 153 |
|
$_SESSION['stormattribute_list_filter']['akey'] = $form_state['values']['akey']; |
| 154 |
|
$_SESSION['stormattribute_list_filter']['avalue'] = $form_state['values']['avalue']; |
| 155 |
$_SESSION['stormattribute_list_filter']['itemsperpage'] = $form_state['values']['itemsperpage']; |
$_SESSION['stormattribute_list_filter']['itemsperpage'] = $form_state['values']['itemsperpage']; |
| 156 |
} |
} |
| 157 |
|
|