Esempio n. 1
0
    } else {
        echo $noe_id;
    }
} elseif ($_GET['page'] === "update") {
    $blackout = unserialize(PROFESSOR_NOE_SUBMISSION_BLACKOUT);
    if (!empty($blackout['start']) && !empty($blackout['end'])) {
        if (strtotime($_POST['exam_date']) >= strtotime($blackout['start']) && strtotime($_POST['exam_date']) <= strtotime($blackout['end'])) {
            $loggers['audit']->notice("Attempted to edit NOE in range of blackout dates");
            echo "invalid-dates";
            exit;
        }
    }
    $has_permission = $model->checkCourseAllowed($SESSION->user_id, $_POST['cid']);
    if ($has_permission) {
        $noes->updateNOE($_POST['rid'], $_POST, $SESSION->user_id);
        $loggers['audit']->info("Details updated for NOE {$_POST['rid']}");
    } else {
        $loggers['audit']->warning("Unauthorized attempt to update details for NOE {$_POST['rid']}");
    }
} elseif ($_GET['page'] === "delete") {
    $has_permission = $model->checkCourseAllowed($SESSION->user_id, $_POST['cid']);
    if ($has_permission) {
        $noes->deleteNOE($_POST['rid']);
        $loggers['audit']->info("Deleted NOE {$_POST['rid']}");
    } else {
        $loggers['audit']->warning("Unauthorized attempt to delete NOE {$_POST['rid']}");
    }
} else {
    header('Location: https://' . URL_PHP . '/error-external.php?eid=F010');
    exit;
}
Esempio n. 2
0
        });
    }
    $l10n->addResource(__DIR__ . '/l10n/notice-of-examination.json');
    $viewFile = 'views/notice-of-examination.php';
} elseif ($_GET['page'] === "add-notice-of-exam") {
    $noe_id = $noes->addNOE($_POST, $SESSION->first_name . " " . $SESSION->last_name, $SESSION->user_name, $SESSION->user_id);
    $loggers['audit']->info("NOE {$noe_id} added");
    echo $noe_id;
    //Need to borrow prof module functions to trigger reminder emails professor and students
    $professor = new \Ventus\Professor\RequestForm($dbo);
    $professor->reminderToAccessServiceStudents(null, $noe_id);
    $loggers['audit']->info("Exam confirmation reminders sent to students for NOE {$noe_id}");
    $professor->reminderToProfessors(array('source' => 'exams', 'exam_request_id' => $noe_id));
    $loggers['audit']->info("Exam reminder sent to professors for NOE {$noe_id}");
} elseif ($_GET['page'] === "delete-request") {
    $noes->deleteNOE($_POST['request_id']);
    $loggers['audit']->info("NOE {$_POST['request_id']} deleted");
} elseif ($_GET['page'] === "update-exam-date-and-duration") {
    $noes->updateExamStartAndDuration($_POST['request_id'], $_POST['exam_date'], $_POST['exam_duration'], $SESSION->user_id);
    $loggers['audit']->info("Exam date updated for NOE {$_POST['request_id']}");
} elseif ($_GET['page'] === "fetch-control-sheet") {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($controlSheets->fetchControlSheet($_POST['request_id']));
    exit;
} elseif ($_GET['page'] === "add-control-sheet") {
    $controlSheets->addUpdateControlSheet($_POST['request_id'], $_POST);
    $loggers['audit']->info("Control sheet added/updated for NOE {$_POST['request_id']}");
} elseif ($_GET['page'] === "view-file") {
    $file = $examFiles->fetchFile($_GET["file-id"]);
    header("Content-Length: {$file['size']}");
    header("Content-Type: {$file['type']}");