diff --git a/site/app_controller.php b/site/app_controller.php
index 2b3412a..fd73846 100644
--- a/site/app_controller.php
+++ b/site/app_controller.php
@@ -645,15 +645,12 @@ class AppController extends Controller {
// Grouping (which would not be typical)
$query['group'] = $this->gridDataCountGroup($params, $model);
- if ($params['debug'])
- $params['count_query'] = $query;
-
// Get the number of records prior to pagination
return $this->gridDataCountExecute($params, $model, $query);
}
function gridDataCountExecute(&$params, &$model, $query) {
- return $model->find('count', $query);
+ return $this->gridDataFind($params, $model, 'count', $query);
}
function gridDataCountTables(&$params, &$model) {
@@ -871,6 +868,9 @@ class AppController extends Controller {
$page = ($params['page'] <= 1) ? 1 : (($params['page'] > $total) ? $total : $params['page']);
$start = $limit * ($page - 1);
+ // Adjust the limit upward, if multiple pages were requested.
+ $limit *= empty($params['npage']) ? 1 : $params['npage'];
+
return compact('record_count', 'limit', 'page', 'start', 'total');
}
@@ -902,14 +902,11 @@ class AppController extends Controller {
isset($params['sidx']) ? $params['sidx'] : null,
isset($params['sord']) ? $params['sord'] : null);
- if ($params['debug'])
- $params['query'] = $query;
-
return $this->gridDataRecordsExecute($params, $model, $query);
}
function gridDataRecordsExecute(&$params, &$model, $query) {
- return $model->find('all', $query);
+ return $this->gridDataFind($params, $model, 'all', $query);
}
function gridDataTables(&$params, &$model) {
@@ -957,6 +954,7 @@ class AppController extends Controller {
'le' => array('op' => '<=', 'pre' => '', 'post' => ''),
'gt' => array('op' => '>', 'pre' => '', 'post' => ''),
'ge' => array('op' => '>=', 'pre' => '', 'post' => ''),
+ 'in' => array('op' => 'IN', 'pre' => '(', 'post' => ')'),
'bw' => array('op' => 'LIKE', 'pre' => '', 'post' => '%'),
'ew' => array('op' => 'LIKE', 'pre' => '%', 'post' => ''),
'cn' => array('op' => 'LIKE', 'pre' => '%', 'post' => '%'),
@@ -1006,6 +1004,13 @@ class AppController extends Controller {
return $start . ', ' . $limit;
}
+ function gridDataFind(&$params, &$model, $type, $query) {
+ if ($params['debug'])
+ $params['queries'][] = compact('type', 'query');
+
+ return $model->find($type, $query);
+ }
+
/**************************************************************************
**************************************************************************
@@ -1152,7 +1157,8 @@ class AppController extends Controller {
}
function gridDataOutputSummary(&$params, &$model, $pagination) {
- echo " \n";
+ if ($params['debug'])
+ echo " \n";
echo " {$pagination['page']}\n";
echo " {$pagination['total']}\n";
echo " {$pagination['record_count']}\n";
@@ -1193,7 +1199,7 @@ class AppController extends Controller {
function gridDataOutputRecordCell(&$params, &$model, &$record, $field, $data) {
// be sure to put text data in CDATA
- if (preg_match("/^\d*$/", $data))
+ if (preg_match("/^[\d.]*$/", $data))
echo " | $data | \n";
else
echo " | \n";