* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @author Rizart Dokollari * @author George Skarlatos * @since 9/19/2014 */ require __DIR__ . '/../app/init.php'; $general->loggedOutProtect(); try { $tutors = TutorFetcher::retrieveActive(); $currentTerms = TermFetcher::retrieveCurrTerm(); $schedules = ScheduleFetcher::retrieveTutorsOnCurrentTerms(); if (isUrlRequestingAllSchedules($user)) { $pageTitle = "All Schedules"; } else { if (isBtnAddSchedulePrsd()) { $pageTitle = "Add schedule"; $days = isset($_POST['day']) ? $_POST['day'] : null; Schedule::add($_POST['tutorId'], $_POST['termId'], $days, $_POST['startsAt'], $_POST['endsAt']); header('Location: ' . BASE_URL . 'staff/schedules/success'); exit; } else { if (isBtnDeletePrsd()) { Schedule::delete($_POST['delScheduleIdModal']); header('Location: ' . BASE_URL . 'staff/schedules/success');
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'] : ''; $studentBroughtAlong = isset($_POST['student-brought-along']) ? $_POST['student-brought-along'] : null; $conclusionAdditionalComments = isset($_POST['conclusion-additional-comments']) ? $_POST['conclusion-additional-comments'] : '';
public static function replaceMajorId($id, $newMajorId, $oldMajorId) { // no changes made. no need to do any work. if (strcmp($newMajorId, $oldMajorId) === 0) { return false; } Tutor::validateId($id); Major::validateId($newMajorId); Major::validateId($oldMajorId); TutorFetcher::replaceMajorId($id, $newMajorId); return true; }
$pageTitle = "Personnel"; $section = "staff"; try { // protect again any sql injections on url if (isset($_GET['id']) && preg_match("/^[0-9]+\$/", $_GET['id'])) { $userId = $_GET['id']; $pageTitle = "Profile"; if (($data = User::getSingle($userId)) === false) { header('Location: ' . BASE_URL . 'error-404'); exit; } if (strcmp($data['type'], 'tutor') === 0) { $tutor = TutorFetcher::retrieveSingle($userId); $curUser = new Tutor($data['id'], $data['f_name'], $data['l_name'], $data['email'], $data['mobile'], $data['img_loc'], $data['profile_description'], $data['date'], $data['type'], $data['active'], $tutor[MajorFetcher::DB_COLUMN_NAME]); $schedules = ScheduleFetcher::retrieveCurrWorkingHours($curUser->getId()); $teachingCourses = TutorFetcher::retrieveCurrTermTeachingCourses($curUser->getId()); } else { if (strcmp($data['type'], 'secretary') === 0) { $curUser = new Secretary($data['id'], $data['f_name'], $data['l_name'], $data['email'], $data['mobile'], $data['img_loc'], $data['profile_description'], $data['date'], $data['type'], $data['active']); } else { if (strcmp($data['type'], 'admin') === 0) { $curUser = new Admin($data['id'], $data['f_name'], $data['l_name'], $data['email'], $data['mobile'], $data['img_loc'], $data['profile_description'], $data['date'], $data['type'], $data['active']); } else { throw new Exception("Something terrible has happened with the database. <br/>The software developers will tremble with fear."); } } } } else { if (isBtnInactivePrsd()) { $users = User::retrieveAllInactive(); $sectionTitle = "Inactive Members";
* Display a single user in a table data views. Requires * the following tutor details (as elements of an array named $jobs): * * * Created by PhpStorm. * Date: 4/1/14 * Time: 3:24 AM * */ $id = $curUser[UserFetcher::DB_COLUMN_ID]; $first_name = $curUser[UserFetcher::DB_COLUMN_FIRST_NAME]; $last_name = $curUser[UserFetcher::DB_COLUMN_LAST_NAME]; $email = $curUser[UserFetcher::DB_COLUMN_EMAIL]; $position = $curUser[UserTypesFetcher::DB_COLUMN_TYPE]; if (User::isUserTypeTutor($position)) { $courses = TutorFetcher::retrieveCurrTermTeachingCourses($id); $schedules = ScheduleFetcher::retrieveCurrWorkingHours($id); } $mobile = $curUser[UserFetcher::DB_COLUMN_MOBILE]; ?> <tr> <td class="text-center"><?php echo $first_name . " " . $last_name; ?> </td> <td class="text-center"><?php echo $email; ?> </td> <td class="text-center"><?php echo $position;