public function add($curriculumID = null) { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isStudent()) { redirect('Login/logout'); } $curriculum = new Curriculum_model(); if ($curriculum->loadPropertiesFromPrimaryKey($curriculumID)) { $user->addCurriculum($curriculum); } redirect('Selectcurriculum/index'); }
public function submitStudentInfoForm($studentID) { $allCurriculums = $this->Curriculum_model->getAllCurriculums(); $student = new User_model(); $student->loadPropertiesFromPrimaryKey($studentID); foreach ($allCurriculums as $curriculum) { $cID = $curriculum->getCurriculumID(); if ($this->input->post('Curriculum' . $cID)) { if (!in_array($curriculum, $student->getCurriculums())) { $student->addCurriculum($curriculum); } } else { $student->removeCurriculum($curriculum); } } $advisorID = $this->input->post('advisorID'); $advisor = new User_model(); $advisor->loadPropertiesFromPrimaryKey($advisorID); $curriculum = new Curriculum_model(); $curriculum->loadPropertiesFromPrimaryKey($curriculumID); $student->setAdvisor($advisor); $student->update(); redirect('User/prepareAddCourses/' . $studentID); }