Пример #1
0
 public static function get($courseId)
 {
     self::validateId($courseId);
     return CourseFetcher::retrieveSingle($courseId);
 }
Пример #2
0
function reportsHaveBeenCrtd($studentsAppointmentData)
{
    return $studentsAppointmentData[0][AppointmentHasStudentFetcher::DB_COLUMN_REPORT_ID] !== null;
}
try {
    if (!isUrlValid() || $user->isTutor() && !Tutor::hasAppointmentWithId($user->getId(), $_GET['appointmentId'])) {
        header('Location: ' . BASE_URL . "error-403");
        exit;
    }
    date_default_timezone_set('Europe/Athens');
    $pageTitle = "Single Appointment";
    $appointmentId = $_GET['appointmentId'];
    $studentsAppointmentData = Appointment::getAllStudentsWithAppointment($appointmentId);
    $terms = TermFetcher::retrieveCurrTerm();
    $students = StudentFetcher::retrieveAll();
    $courses = CourseFetcher::retrieveForTerm($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_TERM_ID]);
    $instructors = InstructorFetcher::retrieveAll();
    $tutors = TutorFetcher::retrieveAll();
    $startDateTime = new DateTime($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_START_TIME]);
    $endDateTime = new DateTime($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_END_TIME]);
    $nowDateTime = new DateTime();
    // load reports if they have been created
    if (reportsHaveBeenCrtd($studentsAppointmentData)) {
        $reports = Report::getAllWithAppointmentId($appointmentId);
    }
    if (isBtnUpdateReportPrsd() || isBtnCompleteReportPrsd()) {
        $formReportId = isset($_POST['form-update-report-id']) ? $_POST['form-update-report-id'] : '';
        $reportUpdate = getReport($formReportId, $reports);
        $projectTopicOtherNew = isset($_POST['project-topic-other']) ? $_POST['project-topic-other'] : '';
        $otherTextArea = isset($_POST['other_text_area']) ? $_POST['other_text_area'] : '';
        $studentsConcernsTextArea = isset($_POST['students-concerns-textarea']) ? $_POST['students-concerns-textarea'] : '';
Пример #3
0
 public static function sendTutorNewAppointment($tutorId, $secretaryName)
 {
     require_once ROOT_PATH . "plugins/PHPMailer/PHPMailerAutoload.php";
     try {
         $appointment = AppointmentFetcher::retrieveSingle($tutorId);
         $appointmentStart = new DateTime($appointment[AppointmentFetcher::DB_COLUMN_START_TIME]);
         $appointmentEnd = new DateTime($appointment[AppointmentFetcher::DB_COLUMN_END_TIME]);
         $tutorUser = UserFetcher::retrieveSingle($appointment[AppointmentFetcher::DB_COLUMN_TUTOR_USER_ID]);
         $course = CourseFetcher::retrieveSingle($appointment[AppointmentFetcher::DB_COLUMN_COURSE_ID]);
         $subject = self::SUBJECT_PREFIX . self::SUBJECT_NEW_SASS_APP_APPOINTMENT;
         $alternativeEmail = self::EMAIL_DEV_SASS;
         $alternativeName = self::SASS_APP_AUTOMATIC_SYSTEM_DEVELOPERS;
         $setViewScheduleLink = "<a style='background-color:#008dd0;color:#fff;border-radius:4px;display:block;\n\t\ttext-decoration:none;margin-top:30px;margin-bottom:15px;margin-right:0px;margin-left:0px;padding-top:20px;\n\t\tpadding-bottom:20px;padding-right:20px;padding-left:20px;text-align:center'\n\t\thref='" . App::getDomainName() . "/appointments/" . $appointment[AppointmentFetcher::DB_COLUMN_ID] . "' target='_blank' >Appointment Details</a>";
         $senderEmail = self::NO_REPLY_EMAIL_PREFIX . $_SERVER['SERVER_NAME'];
         $senderName = $secretaryName;
         $receiverEmail = $tutorUser[UserFetcher::DB_COLUMN_EMAIL];
         $receiverName = $tutorUser[UserFetcher::DB_COLUMN_FIRST_NAME] . " " . $tutorUser[UserFetcher::DB_COLUMN_LAST_NAME];
         //Create a new PHPMailer instance
         $mail = new PHPMailer();
         // Set PHPMailer to use the sendmail transport
         //Set who the message is to be sent from
         $mail->setFrom($senderEmail, self::SASS_APP_AUTOMATIC_SYSTEM);
         //Set an alternative reply-to address
         $mail->addReplyTo($alternativeEmail, $alternativeName);
         //Set who the message is to be sent to
         $mail->addAddress($receiverEmail, $receiverName);
         //Set the subject line
         $mail->Subject = $subject;
         $message = "<html><div bgcolor='#fafafa' marginheight='0' marginwidth='0' style='width:100%!important;background:#fafafa'>";
         $message .= "<div style='padding:20px 20px 20px 20px!important;width:550px;margin:0 auto'>";
         $message .= "<h1 style='margin:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:40px;letter-spacing:-1px;color:#333;font-weight:normal'>\n\t\t\t\t\tNew Appointment from SASS App</h1>";
         $message .= "<span style='margin:0 0 30px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:17px;font-weight:300;color:#555'>\n\t\t\t\t\tWe have a new appointment for you, <strong>{$receiverName}</strong></span>.";
         $message .= "<div style='margin:20px auto!important;width:510px;padding:20px 20px 20px 20px!important;border:1px solid #ddd!important;border-radius:3px!important;background:#ffffff!important'>";
         $message .= "<p style='margin:5px 0 15px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:normal;color:#333;line-height:20px'>\n\t\t\t\t\tHere is an overview the appointment";
         $message .= "<br/><strong>Course:</strong> " . $course[CourseFetcher::DB_COLUMN_CODE] . " " . $course[CourseFetcher::DB_COLUMN_NAME];
         $message .= "<br/><strong>Date:</strong> " . $appointmentStart->format(self::DATE_FORMAT);
         $message .= "<br/><strong>Hour:</strong> " . $appointmentStart->format(self::HOUR_FORMAT) . " - " . $appointmentEnd->format(self::HOUR_FORMAT) . "</p>";
         $message .= "<p style='margin:0 0 30px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:17px;font-weight:300;color:#555'>\n\t\t\t\t\t\t\tFor more details you can visit your {$setViewScheduleLink}</p>";
         $message .= "<div style='margin:20px 0;border-top:1px solid #ddd'></div>";
         $message .= "<p style='margin:0 0 30px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:17px;font-weight:300;color:#555'>Thanks,<br/><strong>{$senderName}</strong></p>";
         $message .= "</div>";
         $message .= "<div style='margin:20px 0;text-align:center;'>";
         $message .= '<img alt="SASS logo" height="40" width="40" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC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Oum0geW1NiKJecEZiele55TQv1IyO1t5K+ZNM0QgWBDenFE9Wdhw92ZSpPFopH8sVe7AIt2BvnMH9J+Mr+LyIy9tp6ADZ3dhI3EC1tYe/DVPaWsvf7upqaN5am/eDHa2hM3CWYgjHs4bmh3oJba0TtX+N4BxMG6s9v6L7zAQX5jY0GtZffUq59fMHrV85gT/+CS+HmNfwxWhorp1g/504kMR5WWL1GZJNieFIi/aT3VAH+ijpyOlMm9EgrRxnM/NDWnh6LlFhirCZwQsm9tCxjgxpdxZi9oDme95UN1mzgdUR8e22uxt4BH/G0xOtNMpLxjxv+aC7Lqhvi/PqB0BPLmkp/hUp7RxLypyBcf5bH/EizMGmaMT6R6T0LnynNs2ZxC2kfzSs2zhs3qeJTVhH9/63qK3P4WvYjt2JS4Or8SCxnTRQX31zsKmttbOheRGex6OJLbWxL65VfRw/HyDdhQ9gaf0segn3Jp39wy49gSXYQv4jumcs/sTDwev1K2Vb8DIuG7sE0ifqZ9bvEn/paP2nnvZPXI8i+EjicLArcadG+2CnfV96m57LPkrWrbM+G5FtJfvu2frankncRjbrbA1wSt1lffTRRx999PF/jP8CuIm4fhDynqkAAAAASUVORK5CYII=" />';
         $message .= "</div>";
         $message .= "</div>";
         $message .= "</div></html>";
         $email_body = $message;
         //Set who the message is to be sent from
         $mail->setFrom($senderEmail, self::SASS_APP_AUTOMATIC_SYSTEM);
         //Set who the message is to be sent to
         $mail->addAddress($receiverEmail, $receiverName);
         //Set the subject line
         $mail->Subject = $subject;
         //Read an HTML message body from an external file, convert referenced images to embedded,
         //convert HTML into a basic plain-text alternative body
         $mail->msgHTML($email_body);
         //Attach an image file
         //$mail->addAttachment('images/phpmailer_mini.gif');
         self::safelySendMail($mail);
     } catch (phpmailerException $e) {
         throw new Exception("PHPMailer error: " . $e->errorMessage());
         //Pretty error messages from PHPMailer
     } catch (Exception $e) {
         throw new Exception("Something went wrong with mail. Please re-send mail to user for setting password.");
         //Pretty error messages from PHPMailer
     }
 }
Пример #4
0
<?php

require __DIR__ . '/app/init.php';
$general->loggedOutProtect();
// redirect if user elevation is not that of admin
if (!$user->isAdmin()) {
    header('Location: ' . BASE_URL . "error-403");
    exit;
}
$curTerms = TermFetcher::retrieveAll();
$students = StudentFetcher::retrieveAll();
$courses = CourseFetcher::retrieveAll();
$instructors = InstructorFetcher::retrieveAll();
$tutors = TutorFetcher::retrieveAll();
$pageTitle = "Search";
$section = "search";
?>

<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"> <!--<![endif]-->
<?php 
require ROOT_PATH . 'views/head.php';
?>
<body>
Пример #5
0
<?php

require __DIR__ . '/../app/init.php';
$general->loggedOutProtect();
$user->denyTutor();
$pageTitle = "New Appointment";
$section = "appointments";
try {
    $curTerms = TermFetcher::retrieveCurrTerm();
    $coursesForCurTerm = sizeof($curTerms) > 0 ? CourseFetcher::retrieveForTerm($curTerms[0][TermFetcher::DB_COLUMN_ID]) : "";
    $instructors = InstructorFetcher::retrieveAll();
    $students = StudentFetcher::retrieveAll();
    if (isBtnAddStudentPrsd()) {
        Appointment::add($user, $_POST['dateTimePickerStart'], $_POST['dateTimePickerEnd'], $_POST['courseId'], $_POST['studentsIds'], $_POST['tutorId'], $_POST['instructorIds'], $_POST['termId'], $user->getFirstName() . " " . $user->getLastName());
    }
} catch (Exception $e) {
    $errors[] = $e->getMessage();
}
function isBtnAddStudentPrsd()
{
    return isset($_POST['hiddenSubmitPrsd']) && empty($_POST['hiddenSubmitPrsd']);
}
function isModificationSuccess()
{
    return isset($_GET['success']) && strcmp($_GET['success'], 'y1!q' === 0);
}
/**
 * http://stackoverflow.com/a/4128377/2790481
 *
 * @param $findId
 * @param $objects