Beispiel #1
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this templates file, choose Tools | Templates
 * and open the templates in the editor.
 */
//this file will handle profile requests
include_once '../classes/viewDAO.php';
include_once '../classes/json.php';
session_start();
//get action
$action = $_REQUEST["action"];
$dao = new viewDAO();
if ($action == "approve") {
    $message = $dao->approve();
    json::sendJsonObj($message);
}
Beispiel #2
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this templates file, choose Tools | Templates
 * and open the templates in the editor.
 */
include_once '../dataAccess/pdoDAO.php';
include_once '../../classes/json.php';
$dao = new pdoDAO();
$action = $_REQUEST['action'];
switch ($action) {
    case "initReports":
        \ZP\ZP::log('Opened Reports', 'Opened Reports', $_SESSION['user']->getID(), $_SESSION['module_number']);
        $obj = $dao->initReports();
        json::sendJsonObj($obj);
        break;
    case "getReport":
        $mineID = trim($_POST['mineID']);
        $from = trim($_POST['from']);
        $to = trim($_POST['to']);
        $indicatorID = trim($_POST['indicatorID']);
        $report = $dao->getReport($mineID, $from, $to, $indicatorID);
        json::sendJsonObj($report);
        break;
    default:
        break;
}
    case "initProfile":
        $obj = $dao->initProfile();
        json::sendJsonObj($obj);
        break;
    case "init-empstats":
        $list = $dao->initEmpstats();
        json::sendJsonObj($list);
        break;
    case "init_plicences":
        $list = $dao->init_plicences();
        json::sendJsonObj($list);
        break;
    case "saveLicences":
        //create objects arr
        $arr = array();
        for ($i = 1; $i <= $_POST['rowCount']; $i++) {
            $obj = (object) ["licenceID" => $_POST["licenceID" . $i], "code" => $_POST["code" . $i], "type" => $_POST["type" . $i], "resources" => $_POST["resources" . $i], "area" => $_POST["area" . $i], "location" => $_POST["location" . $i], "status" => $_POST["status" . $i]];
            array_push($arr, $obj);
        }
        $dao->saveLicences($arr);
        break;
    case "addLicence":
        $licence = (object) ["licence" => $_POST["licence"], "resources" => $_POST["resources"], "area" => $_POST["area"], "location" => $_POST["location"], "type" => $_POST["type"], "status" => $_POST["status"], "code" => $_POST["code"]];
        $dao->addLicence($licence);
        break;
    case "init_boinfo":
        $list = $dao->init_boinfo();
        json::sendJsonObj($list);
    default:
        break;
}