40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
class DashboardsController{
|
||
|
|
private $model;
|
||
|
|
|
||
|
|
function __construct(){
|
||
|
|
$this->model = new DashboardsModel();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* get data required for order central gadget
|
||
|
|
* @return json orders info
|
||
|
|
*/
|
||
|
|
public function getOrderCentralInfo(){
|
||
|
|
$viewAllOrders = isset($_REQUEST['viewAllOrders']) ? $_REQUEST['viewAllOrders'] : false;
|
||
|
|
$filters = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : '';
|
||
|
|
$sortBy = isset($_REQUEST['sortBy']) ? $_REQUEST['sortBy'] : '';
|
||
|
|
echo json_encode($this->model->getOrderCentralInfo($viewAllOrders, $filters, $sortBy), JSON_NUMERIC_CHECK);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* get selected dashbord info
|
||
|
|
* @return json info and gadgets for selected dashboards
|
||
|
|
*/
|
||
|
|
public function getMyDashboard(){
|
||
|
|
$idDashboard = isset($_REQUEST['myDashboard']) ? $_REQUEST['myDashboard'] : 0;
|
||
|
|
echo json_encode($this->model->getMyDashboard($idDashboard));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* get data required for the enxt action gadget
|
||
|
|
* @return json next actions info
|
||
|
|
*/
|
||
|
|
public function getNextActionsInfo(){
|
||
|
|
$filters = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : '';
|
||
|
|
$sortBy = isset($_REQUEST['sortBy']) ? $_REQUEST['sortBy'] : '';
|
||
|
|
echo json_encode($this->model->getNextActionsInfo($filters, $sortBy), JSON_NUMERIC_CHECK);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?>
|