function update() { $disciplina = new Disciplina(); $disciplina->setNome($_POST['nome']); //$disciplina->setTutor($tutor->getById()); $curso = new Curso(); $curso->setId($_POST['curso']); $disciplina->setCurso($curso->getById()); $disciplina->setId($_POST['id']); $disciplina->update(); if (isset($_POST['tutor']) && $_POST['tutor']) { $tutor = new Tutor(); $tutor->setId($_POST['tutor']); $tutor->addTutorDisciplina($tutor->getId(), $disciplina->getId()); } header("location: ../view/index.php"); }
$general->loggedOutProtect(); $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();