ReportFetcher::updateLabel($formReportId, Report::LABEL_MESSAGE_PENDING_VALIDATION, Report::LABEL_COLOR_WARNING); } else { // user is secretary confirming report ReportFetcher::updateLabel($formReportId, Report::LABEL_MESSAGE_COMPLETE, Report::LABEL_COLOR_SUCCESS); } } if (!$updateDone) { throw new Exception("No new data inserted."); } } if (isUrlRqstngManualReportEnable()) { if ($studentsAppointmentData[0][AppointmentHasStudentFetcher::DB_COLUMN_REPORT_ID] === null && $nowDateTime > $startDateTime) { $students = AppointmentHasStudentFetcher::retrieveStudentsWithAppointment($appointmentId); $appointment = Appointment::getSingle($appointmentId); foreach ($students as $student) { $reportId = ReportFetcher::insert($student[AppointmentHasStudentFetcher::DB_COLUMN_STUDENT_ID], $student[AppointmentHasStudentFetcher::DB_COLUMN_ID], $student[AppointmentHasStudentFetcher::DB_COLUMN_INSTRUCTOR_ID]); } AppointmentFetcher::updateLabel($appointmentId, Appointment::LABEL_MESSAGE_COMPLETE, Appointment::LABEL_COLOR_SUCCESS); if (!$user->isTutor()) { Mailer::sendTutorNewReportsCronOnly($appointment); } } } else { if (isUrlRqstngAppointmentCancelByStudent()) { AppointmentFetcher::updateLabel($appointmentId, Appointment::LABEL_MESSAGE_STUDENT_CANCELED, Appointment::LABEL_COLOR_CANCELED); } else { if (isBtnUpdateAppointmentPrsd() && ($user->isSecretary() && strcmp($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_LABEL_MESSAGE], Appointment::LABEL_MESSAGE_COMPLETE) !== 0 || $user->isAdmin())) { $updateDone = Appointment::updateStudents($appointmentId, $studentsAppointmentData, $_POST['studentsIds']); $updateDone = Appointment::updateInstructors($appointmentId, $studentsAppointmentData, $_POST['instructorIds']) || $updateDone; $updateDone = Appointment::updateCourse($appointmentId, $studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_COURSE_ID], $_POST['courseId']) || $updateDone; // TODO: validate new date times.