mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
(mvc applications) refactor model search
This commit is contained in:
parent
8a309525e7
commit
d61fb7f9b5
@ -210,30 +210,13 @@ class ServiceController extends ApiControllerBase
|
||||
*/
|
||||
public function searchTemplatesAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("name");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array("name", "fileid");
|
||||
$mdlCP = new CaptivePortal();
|
||||
$grid = new UIModelGrid($mdlCP->templates->template);
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$this->sessionClose();
|
||||
$mdlCP = new CaptivePortal();
|
||||
$grid = new UIModelGrid($mdlCP->templates->template);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("name", "fileid"),
|
||||
"name"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,30 +195,13 @@ class SettingsController extends ApiControllerBase
|
||||
*/
|
||||
public function searchZonesAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("number");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array("enabled", "description", "zoneid");
|
||||
$mdlCP = new CaptivePortal();
|
||||
$grid = new UIModelGrid($mdlCP->zones->zone);
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$this->sessionClose();
|
||||
$mdlCP = new CaptivePortal();
|
||||
$grid = new UIModelGrid($mdlCP->zones->zone);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled", "description", "zoneid"),
|
||||
"description"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,42 +202,25 @@ class SettingsController extends ApiControllerBase
|
||||
*/
|
||||
public function searchJobsAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("description");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array(
|
||||
"enabled",
|
||||
"minutes",
|
||||
"hours",
|
||||
"days",
|
||||
"months",
|
||||
"weekdays",
|
||||
"description",
|
||||
"command",
|
||||
"origin",
|
||||
"cronPermissions"
|
||||
);
|
||||
$mdlCron = new Cron();
|
||||
$grid = new UIModelGrid($mdlCron->jobs->job);
|
||||
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$this->sessionClose();
|
||||
$fields = array(
|
||||
"enabled",
|
||||
"minutes",
|
||||
"hours",
|
||||
"days",
|
||||
"months",
|
||||
"weekdays",
|
||||
"description",
|
||||
"command",
|
||||
"origin",
|
||||
"cronPermissions"
|
||||
);
|
||||
$mdlCron = new Cron();
|
||||
$grid = new UIModelGrid($mdlCron->jobs->job);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
$fields,
|
||||
"description"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,31 +495,14 @@ class SettingsController extends ApiControllerBase
|
||||
*/
|
||||
public function searchFingerprintAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("number");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array("enabled", "action", "description", "fingerprint");
|
||||
$mdlIDS = $this->getModel();
|
||||
$grid = new UIModelGrid($mdlIDS->rules->fingerprint);
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$this->sessionClose();
|
||||
$mdlIDS = $this->getModel();
|
||||
$grid = new UIModelGrid($mdlIDS->rules->fingerprint);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled", "action", "description", "fingerprint"),
|
||||
"description"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -100,32 +100,13 @@ class SettingsController extends ApiControllerBase
|
||||
public function searchRemoteBlacklistsAction()
|
||||
{
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("filename");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array(
|
||||
"enabled",
|
||||
"filename",
|
||||
"url",
|
||||
"description"
|
||||
);
|
||||
$mdlProxy = new Proxy();
|
||||
$grid = new UIModelGrid($mdlProxy->forward->acl->remoteACLs->blacklists->blacklist);
|
||||
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled", "filename", "url", "description"),
|
||||
"description"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -196,32 +196,14 @@ class SettingsController extends ApiControllerBase
|
||||
*/
|
||||
public function searchPipesAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("number");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array("enabled","number", "bandwidth","bandwidthMetric","burst","description","mask","origin");
|
||||
$mdlShaper = new TrafficShaper();
|
||||
$grid = new UIModelGrid($mdlShaper->pipes->pipe);
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
$this->sessionClose();
|
||||
$mdlShaper = new TrafficShaper();
|
||||
$grid = new UIModelGrid($mdlShaper->pipes->pipe);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled","number", "bandwidth","bandwidthMetric","burst","description","mask","origin"),
|
||||
"number"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -230,32 +212,14 @@ class SettingsController extends ApiControllerBase
|
||||
*/
|
||||
public function searchQueuesAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("number");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array("enabled","number", "pipe","weight","description","mask","origin");
|
||||
$mdlShaper = new TrafficShaper();
|
||||
$grid = new UIModelGrid($mdlShaper->queues->queue);
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
$this->sessionClose();
|
||||
$mdlShaper = new TrafficShaper();
|
||||
$grid = new UIModelGrid($mdlShaper->queues->queue);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled","number", "pipe","weight","description","mask","origin"),
|
||||
"number"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -379,31 +343,14 @@ class SettingsController extends ApiControllerBase
|
||||
*/
|
||||
public function searchRulesAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->sessionClose();
|
||||
// fetch query parameters
|
||||
$itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
|
||||
$currentPage = $this->request->getPost('current', 'int', 1);
|
||||
$sortBy = array("sequence");
|
||||
$sortDescending = false;
|
||||
|
||||
if ($this->request->hasPost('sort') && is_array($this->request->getPost("sort"))) {
|
||||
$sortBy = array_keys($this->request->getPost("sort"));
|
||||
if ($this->request->getPost("sort")[$sortBy[0]] == "desc") {
|
||||
$sortDescending = true;
|
||||
}
|
||||
}
|
||||
|
||||
$searchPhrase = $this->request->getPost('searchPhrase', 'string', '');
|
||||
|
||||
// create model and fetch query resuls
|
||||
$fields = array("interface", "proto","source","destination","description","origin","sequence","target");
|
||||
$mdlShaper = new TrafficShaper();
|
||||
$grid = new UIModelGrid($mdlShaper->rules->rule);
|
||||
return $grid->fetch($fields, $itemsPerPage, $currentPage, $sortBy, $sortDescending, $searchPhrase);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$this->sessionClose();
|
||||
$mdlShaper = new TrafficShaper();
|
||||
$grid = new UIModelGrid($mdlShaper->rules->rule);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("interface", "proto","source","destination","description","origin","sequence","target"),
|
||||
"sequence"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user