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'] : '';
public static function getForTerm($termId) { Term::validateId($termId); return CourseFetcher::retrieveForTerm($termId); }
<?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