protected function teacherview() { global $user; global $objPDO; $student = new student($objPDO, $user->getuserId()); $headMenu = array("username" => $student->getName()); if ($user->checkAdmin() == true || $student->checkTeacher()) { if ($user->checkAdmin()) { $teacher = $_GET['uid']; } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php'; $teacherProfile = new Teacher($objPDO); $teacherProfile->loadByUserId($student->getID()); $teacher = $teacherProfile->getID(); } include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/timetable_settings_class.php'; $sett = new TimetableSettings($objPDO); $slots = $sett->getAllSlots(); if (!isset($slots)) { $num_slots = 0; } else { $num_slots = count($slots); } include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/timetable_class.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_class.php'; $tt = new Timetable($objPDO); $sec = new Section($objPDO); $timetable = $tt->getByTeacherId($teacher); $subject = $tt->getTeacherSubject($teacher); $section = $sec->getSectionArray(); $total = 0; $count = array(); foreach ($timetable as $key => $value) { $total++; if (array_key_exists($value, $count)) { $count[$value]++; } else { $count[$value] = 1; } } include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/teacher_timetable_view_template.php'; } else { header('Location:http://localhost/cloud'); } }