Пример #1
0
/**
 * Controller do sistema
 * @author Henrique Ramos <*****@*****.**>
 * @since 0.1 
 * @version 0.1
 */
//Inclui o arquivo de configuração
require_once "config.php";
$f3->route(array('POST /remover-alerta/@alertID'), function ($f3, $params) {
    try {
        if (empty($params['alertID']) or !is_numeric($params['alertID'])) {
            throw new \Exception("Fill the \"alert id\" parameter correctly.");
        }
        $alertID = $params['alertID'];
        $alert = new \Ramos\Zeus\Alert();
        $alert->deleteAlert($alertID);
        echo json_encode(array('success' => __('Successful alert deletion.')));
    } catch (\Exception $e) {
        http_response_code(500);
        echo json_encode(array('error' => $e->getMessage()));
    }
});
//Change
$f3->route(array('GET /remover-job/@jobID', 'POST /remover-job/@jobID'), function ($f3, $params) {
    global $Smarty;
    try {
        $jobs = new \Ramos\Zeus\Job();
        if (empty($params['jobID']) or !is_numeric($params['jobID'])) {
            throw new \Exception(__("Not found any job matching this parameters."));
        }
        $returnInfo = $jobs->removeJobController($params);