Example #1
0
//============================================================================================
$profile = new Profile($dbo);
$los = new LettersSupport($dbo);
$emp_profile = new \Ventus\Profile\MyProfile($dbo);
if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) {
    $studentProfile = $profile->getProfile($_GET['student_num']);
}
//============================================================================================
// Load the content
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $thisPage = 'los';
    if (!empty($studentProfile)) {
        $emp_signature = $emp_profile->getEmpSignature($SESSION->user_name);
        $manager_details = \Ventus\Utilities\Functions::fetchSubGroupEmployeeDetails(SUB_SERVICE_ID_COUNSELLING_MANAGER);
        $letters = $los->listLetters($_GET['student_num']);
        $l10n->addResource(__DIR__ . '/l10n/letters-of-support.json');
        $viewFile = 'views/letters-of-support.php';
    }
} elseif ($_GET['page'] === "add") {
    $los->addLetter($_POST);
    $loggers['audit']->info("Letter of support added");
} elseif ($_GET['page'] === "fetch") {
    $content = $los->getLetter($_GET['row']);
    echo $content['letter_of_support'];
} elseif ($_GET['page'] === "update") {
    $los->updateLetter($_POST['id'], $_POST);
    $loggers['audit']->info("Letter of support {$_POST['id']} updated");
} elseif ($_GET['page'] === "lock") {
    $los->lockLetter($_GET['id']);