* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$auth = new Auth();
if (!$auth->isAuthorized()) {
    $auth->forbidden();
    exit(0);
    // Should never get here but just in case...
}
$result = "OK";
$id = Tools::post('id');
$mode = Tools::post('mode');
$html = '';
$applicationStatusListView = new ApplicationStatusListView('html', null);
if ('add' == $mode) {
    $applicationStatusModel = new ApplicationStatusModel();
    $applicationStatusModel->setId($id);
    $html = $applicationStatusListView->displayApplicationStatusRow($applicationStatusModel, $mode);
} else {
    $applicationStatusController = new ApplicationStatusController();
    $applicationStatusModel = $applicationStatusController->get($id);
    $html = $applicationStatusListView->displayApplicationStatusRow($applicationStatusModel, $mode);
}
$result = array('result' => $result, 'row' => $html);
echo json_encode($result) . PHP_EOL;
    $auth->forbidden();
    exit(0);
    // Should never get here but just in case...
}
$statusValue = Tools::post('statusValue');
$style = Tools::post('style');
$isActive = Tools::post('isActive');
$sortKey = Tools::post('sortKey');
$result = 'OK';
$applicationStatusId = '';
$newApplicationStatusModel = null;
try {
    $applicationStatusModel = new ApplicationStatusModel();
    $applicationStatusModel->setStatusValue($statusValue);
    $applicationStatusModel->setStyle($style);
    $applicationStatusModel->setIsActive($isActive);
    $applicationStatusModel->setSortKey($sortKey);
    $applicationStatusController = new ApplicationStatusController();
    $applicationStatusId = $applicationStatusController->add($applicationStatusModel);
    if (!($applicationStatusId > 0)) {
        throw new ControllerException("Add failed.");
    }
    $newApplicationStatusModel = $applicationStatusController->get($applicationStatusId);
    $applicationStatusRowView = new ApplicationStatusListView();
    $row = $applicationStatusRowView->displayApplicationStatusRow($newApplicationStatusModel, 'list');
} catch (ControllerException $e) {
    $applicationStatusRowView = new ApplicationStatusListView('html', null);
    $row = $applicationStatusRowView->displayApplicationStatusRow($newApplicationStatusModel, 'list', 'Add Application Status record failed. ' . $e->getMessage());
}
$result = array('result' => $result, 'row' => $row, 'newId' => $applicationStatusId);
echo json_encode($result) . PHP_EOL;
Beispiel #3
0
/**
 * phpjobseeker
 *
 * Copyright (C) 2009, 2015 Kevin Benton - kbenton at bentonfam dot org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$page = new PJSWebPage($config->getTitle() . ' - Application Statuses');
$body = "<h2>Application Statuses</h2>";
$asc = new ApplicationStatusController('read');
$asmList = $asc->getAll();
$asv = new ApplicationStatusListView('html', $asmList);
$body .= $asv->getView();
$page->setBody($body);
$page->displayPage();
 *
 */
require_once "Libs/autoload.php";
$auth = new Auth();
if (!$auth->isAuthorized()) {
    $auth->forbidden();
    exit(0);
    // Should never get here but just in case...
}
$id = Tools::post('id');
$statusValue = Tools::post('statusValue');
$style = Tools::post('style');
$isActive = Tools::post('isActive');
$sortKey = Tools::post('sortKey');
$result = 'OK';
$asrv = new ApplicationStatusListView('html', null);
try {
    $applicationStatusController = new ApplicationStatusController();
    $applicationStatusModel = $applicationStatusController->get($id);
    $applicationStatusModel->setStatusValue($statusValue);
    $applicationStatusModel->setStyle($style);
    $applicationStatusModel->setIsActive($isActive);
    $applicationStatusModel->setSortKey($sortKey);
    $result = $applicationStatusController->update($applicationStatusModel);
    if (!($result > 0)) {
        throw new ControllerException("Update failed.");
    }
    $row = $asrv->displayApplicationStatusRow($applicationStatusModel, 'list');
} catch (ControllerException $e) {
    $row = $asrv->displayApplicationStatusRow($newApplicationStatusModel, 'list', 'Update Application Status record failed. ' . $e->getMessage());
}