mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
MVC - unintended side affect from switching to pure json in bootgrids in 926a4c8e68
Since we extract the values in json ourselves, the super global $_REQUEST doesn't know about these values. This change overlays the received post values in $_REQUEST so we can still use the super global get() in Phalcon. Undo previous changes in UIModelGrid() requiring POST values as well.
This commit is contained in:
parent
7ac79e357b
commit
45b8bcd0c7
@ -128,6 +128,9 @@ class ApiControllerBase extends ControllerRoot
|
||||
return "Invalid JSON syntax";
|
||||
}
|
||||
$_POST = $jsonRawBody;
|
||||
foreach ($_POST as $key => $value) {
|
||||
$_REQUEST[$key] = $value;
|
||||
}
|
||||
break;
|
||||
case 'application/x-www-form-urlencoded':
|
||||
case 'application/x-www-form-urlencoded;charset=utf-8':
|
||||
|
||||
@ -64,19 +64,19 @@ class UIModelGrid
|
||||
$filter_funct = null,
|
||||
$sort_flags = SORT_NATURAL
|
||||
) {
|
||||
$itemsPerPage = $request->getPost('rowCount', 'int', -1);
|
||||
$currentPage = $request->getPost('current', 'int', 1);
|
||||
$itemsPerPage = $request->get('rowCount', 'int', -1);
|
||||
$currentPage = $request->get('current', 'int', 1);
|
||||
$sortBy = empty($defaultSort) ? array() : array($defaultSort);
|
||||
$sortDescending = false;
|
||||
|
||||
if ($request->hasPost('sort') && is_array($request->getPost("sort"))) {
|
||||
$sortBy = array_keys($request->getPost("sort"));
|
||||
if (!empty($sortBy) && $request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
if ($request->hasPost('sort') && is_array($request->get("sort"))) {
|
||||
$sortBy = array_keys($request->get("sort"));
|
||||
if (!empty($sortBy) && $request->get("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $request->getPost('searchPhrase', 'string', '');
|
||||
$searchPhrase = $request->get('searchPhrase', 'string', '');
|
||||
return $this->fetch(
|
||||
$fields,
|
||||
$itemsPerPage,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user