Beispiel #1
0
        appendHeaderJS($editar_job);
        $Smarty->assign('actualPage', 'editar-job');
        $Smarty->assign('pageTitle', sprintf('Editar Job %s (ID: %d) | Zeus Monitor', $returnInfo['job']['job_name'], $returnInfo['job']['job_id']));
        $Smarty->display("editar-job.tpl");
    } catch (\Exception $e) {
        $Smarty->assign('alert', array('message' => $e->getMessage(), 'type' => 'error'));
        $Smarty->assign('pageTitle', 'Alerta | Zeus Monitor');
        $Smarty->display("alert.tpl");
    }
    /**/
});
$f3->route(array('POST /adicionar-job', 'POST /editar-job/@jobID'), function ($f3, $params) {
    global $Smarty;
    try {
        $job = new \Ramos\Zeus\Job();
        $returnInfo = json_decode($job->createUpdateJob($params), true);
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                $Smarty->assign('alert', array('message' => $returnInfo['success'], 'type' => 'success'));
                $Smarty->assign('actualPage', 'editar-job');
                $Smarty->assign('pageTitle', 'Adição bem sucedida | Zeus Monitor');
                $Smarty->display("alert.tpl");
                break;
            default:
                throw new \Exception(__("Unknown error when we tried to decode the JSON response. Contact the administrator."));
                break;
        }
    } catch (\Exception $e) {
        $Smarty->assign('alert', array('message' => $e->getMessage(), 'type' => 'error'));
        $Smarty->assign('pageTitle', 'Alerta | Zeus Monitor');
        $Smarty->display("alert.tpl");