Permalink
Browse files

more 2.0 changes

  • Loading branch information...
1 parent 8a96843 commit c0639a550230f7f842d48952a1456d6660b908d7 @rchavik committed Nov 8, 2011
@@ -1,6 +1,8 @@
<?php
// vim: set ts=4 sts=4 sw=4 si noet:
+App::import('Vendor', 'Cholesterol.utils');
+
/** Component to assist querying and generating JSON result set when working
* with jqGrid
*
@@ -44,8 +46,12 @@ function _extractFields($fields) {
function _mergeFilterConditions(&$conditions, $needFields, $filterMode) {
$ignoreList = array('ext', 'url', '_search', 'nd', 'page', 'rows', 'sidx', 'sord', 'doExport', 'exportOptions', 'filterMode', 'filters', 'gridId',);
- $url = $this->controller->params['url'];
+ $url = $this->controller->request->query;
+ $i = 0;
foreach ($url as $key => $val) {
+ if ($i == 0) {
+ $i++; continue;
+ }
if (in_array($key, $ignoreList)) {
continue;
}
@@ -199,7 +205,6 @@ function _exportToFile($modelName, $fields, $rows, $exportOptions) {
}
function _extractGetParams($url) {
- App::import('Vendor', 'Cholesterol.utils');
$page = array_key_value('page', $url);
$rows = array_key_value('rows', $url);
$sidx = array_key_value('sidx', $url);
@@ -234,10 +239,12 @@ function find($modelName, $options = array()) {
), $options);
extract($options);
- if ($this->controller->RequestHandler->isPost()) {
- extract($this->_extractGetParams($this->controller->params['form']));
+ if ($this->controller->request->isPost()) {
+ extract($this->_extractGetParams($this->controller->request->params['form']));
} else {
- extract($this->_extractGetParams($this->controller->params['url']));
+ $f = $this->_extractGetParams($this->controller->request->query);
+ extract($f
+ );
}
$exportOptions = json_decode(Cache::read('export_options_' . $gridId), true);
@@ -252,7 +259,7 @@ function find($modelName, $options = array()) {
$needFields = $this->_extractFields($fields);
} else {
// fallback using model schema fields
- $needFields = array($modelName => array_keys($model->_schema));
+ $needFields = array($modelName => array_keys($model->schema()));
for ($i = 0, $ii = count($needFields[$modelName]); $i < $ii; $i++) {
$fields[] = $modelName . '.' . $needFields[$modelName][$i];
@@ -278,7 +285,7 @@ function find($modelName, $options = array()) {
}
$this->controller->autoRender = false;
} else {
- $this->controller->view = 'Cholesterol.Json';
+ $this->controller->viewClass = 'Cholesterol.Json';
}
$findOptions = $options + array(
File renamed without changes.
@@ -3,7 +3,7 @@
class AutocompleteHelper extends AppHelper {
- var $helpers = array('Form', 'Javascript');
+ var $helpers = array('Form', 'Js');
// swiped from Form::label()
function _getLabel($fieldName) {
@@ -85,7 +85,7 @@ function(item) {
});
});
EOF;
- $this->Javascript->codeBlock($script, array('inline' => false));
+ $this->Js->codeBlock($script, array('inline' => false));
return $out;
}
}
@@ -1,15 +1,13 @@
<?php
// vim: set ft=php ts=4 sts=4 sw=4 si noet:
-App::import('Vendor', 'Cholesterol.Utils');
-
/** A very simple helper to generate html tags for use with jqGrid
* @author Rachman Chavik
* @license MIT
*/
class JqgridHelper extends AppHelper {
- var $helpers = array('Javascript');
+ var $helpers = array('Html');
var $modelName;
@@ -91,7 +89,7 @@ function _useModelSchema(&$gridOptions) {
$colModel =& $gridOptions['colModel'];
- foreach ($model->_schema as $fieldName => $fieldInfo) {
+ foreach ($model->schema() as $fieldName => $fieldInfo) {
$colModel[] = array(
'index' => $this->modelName . '.' . $fieldName,
'name' => $this->modelName . '.' . $fieldName,
@@ -255,7 +253,7 @@ function script($id, $gridOptions = array(), $navGridOptions = array()) {
});
EOF;
- return $this->Javascript->codeBlock($script);
+ return $this->Html->scriptBlock($script);
}
}

0 comments on commit c0639a5

Please sign in to comment.