<?php

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');
$result = 'OK';
$row = "";
try {
    $applicationStatusModel = new ApplicationStatusModel();
    $applicationStatusModel->setId($id);
    $applicationStatusController = new ApplicationStatusController();
    $applicationStatusController->delete($applicationStatusModel);
} catch (ControllerException $e) {
    $result = "Delete failed. " . $e->getMessage();
}
echo json_encode(array('result' => $result, 'row' => $row)) . PHP_EOL;
 * 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;
Example #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();
    $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;
Example #5
0
    /**
     * Return the HTML view
     *
     * @return string
     */
    private function _getHtmlView()
    {
        $body = <<<'HTML'
<a href="addJob.php">Add a new job</a><br />
<table border="1" cellspacing="0" cellpadding="2">
  <caption>Current Jobs</caption>
  <tr>
    <th>Actions</th>
    <th>Urgency</th>
    <th>Title</th>
    <th>Location</th>
    <th>Company</th>
    <th>Contact</th>
    <th>Status</th>
    <th>Next Action</th>
    <th>Next Action Due</th>
    <th>Link</th>
    <th>Created</th>
    <th>Updated</th>
  </tr>
HTML;
        foreach ($this->getJobModels() as $jobModel) {
            $id = $jobModel->getId();
            $primaryContactId = $jobModel->getPrimaryContactId();
            $companyId = $jobModel->getCompanyId();
            $applicationStatusId = $jobModel->getApplicationStatusId();
            $lastStatusChange = $jobModel->getLastStatusChange();
            $urgency = $jobModel->getUrgency();
            $created = $jobModel->getCreated();
            $updated = $jobModel->getUpdated();
            $nextActionDue = $jobModel->getNextActionDue();
            $nextAction = $jobModel->getNextAction();
            $positionTitle = $jobModel->getPositionTitle();
            $location = $jobModel->getLocation();
            $url = $jobModel->getUrl();
            if ($primaryContactId >= 1) {
                $contactController = new ContactController('read');
                $contactModel = $contactController->get($primaryContactId);
                $contactName = $contactModel->getContactName();
            }
            if ($companyId >= 1) {
                $companyController = new CompanyController('read');
                $companyModel = $companyController->get($companyId);
                $companyName = $companyModel->getCompanyName();
            } else {
                $companyName = '';
            }
            if ($applicationStatusId >= 1) {
                $applicationStatusController = new ApplicationStatusController('read');
                $applicationStatusModel = $applicationStatusController->get($applicationStatusId);
                $applicationStatusValue = $applicationStatusModel->getStatusValue();
                $applicationStatusStyle = $applicationStatusModel->getStyle();
            } else {
                $applicationStatusValue = '';
                $applicationStatusStyle = '';
            }
            $body .= <<<HTML
  <tr>
    <td>
        <a href="editJob.php?id={$id}">Edit</a>
      | <a href="deleteJob.php?id={$id}">Delete</a>
    </td>
    <td>{$urgency}</td>
    <td>{$positionTitle}</td>
    <td>{$location}</td>
    <td>{$companyName}</td>
    <td>{$contactName}</td>
    <td style="{$applicationStatusStyle}">{$applicationStatusValue}</td>
    <td>{$nextAction}</td>
    <td>{$nextActionDue}</td>
    <td><a href="{$url}">{$url}</a></td>
    <td>{$created}</td>
    <td>{$updated}</td>
  </tr>
HTML;
        }
        $body .= '</table>';
        return $body;
    }
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());
}
$result = array('result' => $result, 'row' => $row);
echo json_encode($result) . PHP_EOL;