Пример #1
0
// Load the Model
//============================================================================================
$model = new EmailsToProfessors($dbo);
$professor = new RequestForm($dbo);
$student_profile = new \Ventus\Student\StudentProfile($dbo);
$letters = new \Ventus\Specialist\EmailLetterGenerator();
//============================================================================================
// Load the page requested by the user
//============================================================================================
if ($_GET['page'] === "trigger-first-email") {
    $model->firstEmail($_GET['session']);
    $loggers['audit']->info("FIRST email sent to professors");
} elseif ($_GET['page'] === "send-reminders") {
    $exams = $model->fetchAutoImportedNOE($_GET['session']);
    foreach ($exams as $e) {
        $professor->reminderToAccessServiceStudents($e['cid']);
        $loggers['audit']->info("Exam confirmation reminders sent to students for NOE (confirmation ID: {$e['cid']})");
    }
} elseif ($_GET['page'] === "retrigger-confirmation-email") {
    $unconfirmed_requests = $model->fetchUnconfirmedNotices();
    print_r($unconfirmed_requests);
    echo '<br><br>';
    foreach ($unconfirmed_requests as $u) {
        $course_exists = $professor->checkCourseExistence($u['course_code'], $u['course_section'], $u['session'], $u['teach_method']);
        if ($course_exists !== null) {
            $u['prof_name'] = $course_exists;
            print_r($u);
            echo '<br><br>';
            $model->resendEmailConfirmation($u);
            $loggers['audit']->info("Confirmation email resent to requestor for NOE (confirmation ID: {$u['confirmation_key']})");
        }
Пример #2
0
        echo "success";
        $_POST['prof_name'] = $course_exists;
        $insert_id = $model->addRequest($_POST);
        $loggers['audit']->info("NOE {$insert_id} added");
        $model->sendEmailConfirmation($_POST, $insert_id);
    } else {
        echo "invalid-course";
        $loggers['audit']->notice("Attempted to add NOE for invalid course {$_POST['course_code']}{$_POST['course_section']} {$_POST['teach_method']} {$_POST['session']}");
        $model->sendInvalidInformationEmail($_POST);
    }
} elseif ($_GET['page'] === "crequest") {
    $id = $model->verifyConfirmationLink($_GET['cid']);
    //If the confirmation link has been successfully verified, then send an email to all AS students in that course
    if ($id === 1) {
        $loggers['audit']->info("Confirmed NOE with confirmation ID {$_GET['cid']}");
        $model->reminderToAccessServiceStudents($_GET['cid']);
        $model->reminderToProfessors($_GET);
    }
    $l10n->addResource(__DIR__ . '/l10n/header-external.json');
    $l10n->addResource(__DIR__ . '/l10n/confirm-request.json');
    require_once FS_PHP . '/header-external.php';
    require_once 'views/confirm-request.php';
    require_once FS_PHP . '/footer-external.php';
} elseif ($_GET['page'] === "outlook-reminder") {
    $l10n->addResource(__DIR__ . '/l10n/request-form.json');
    $l10n->addResource(FS_L10N . '/filenames.json');
    $reminder_end = \DateTime::createFromFormat(DATETIME_MYSQL, $_GET['exam_date']);
    $reminder_end->setTime(21, 0);
    $reminder_end->modify('-' . FACULTY_BUSINESS_DAYS_BEFORE_EXAM_BLOCK_CHANGES_CONTROL_SHEET . ' days');
    header("Content-Type: text/calendar");
    header("Content-Disposition: inline; filename=" . $l10n->_f('file.professor_exam_request_reminder', date('Y-m-d'), null) . ".ics");