Modified the grid search to support standard date formats, with a bit of a kludge by applying it to fields that end with _date or stamp.

git-svn-id: file:///svn-source/pmgr/branches/v0.3_work/site@1002 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2011-01-08 00:56:15 +00:00
parent 5b911c856b
commit 381d14a6f6

View File

@@ -948,6 +948,15 @@ class AppController extends Controller {
'value' => $params['filtValue']);
}
// Translate a user specified date into the SQL date format
foreach ($searches AS &$search) {
if (preg_match('/(_date|stamp)$/', $search['field']) &&
preg_match('%(\d{1,2})[-/](\d{1,2})[-/](\d{2,4})%', $search['value'], $matches)) {
$search['value'] = sprintf('%04d%02d%02d', $matches[3], $matches[2], $matches[1]);
}
}
unset($search);
$ops = array('eq' => array('op' => null, 'pre' => '', 'post' => ''),
'ne' => array('op' => '<>', 'pre' => '', 'post' => ''),
'lt' => array('op' => '<', 'pre' => '', 'post' => ''),