public function index() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isStudent()) { redirect('Login/logout'); } $selectedCurriculums = $user->getCurriculums(); $unselectedCurriculums = Curriculum_model::getAllCurriculums(); foreach ($unselectedCurriculums as $key => $unselectedCurriculum) { foreach ($selectedCurriculums as $selectedCurriculum) { if ($selectedCurriculum->getCurriculumID() == $unselectedCurriculum->getCurriculumID()) { unset($unselectedCurriculums[$key]); break; } } } $data = array('user' => $user, 'selectedCurriculums' => $selectedCurriculums, 'unselectedCurriculums' => $unselectedCurriculums); $this->load->view('curriculumselect_index_view', $data); }
public function prepareAddCourses($sID) { $this->checkSec(); $studentData = array('sID' => $sID, 'curriculumSlots' => NULL, 'filledSlots' => array()); $student = new User_model(); $student->loadPropertiesFromPrimaryKey($sID); $curriculums = $student->getCurriculums(); $allCurriculumSlots = array(); foreach ($curriculums as $curriculum) { $cSlots = $curriculum->getCurriculumCourseSlots(); $allCurriculumSlots = array_merge($allCurriculumSlots, $cSlots); } //All of the curriculum course slots for the selected student. $studentData['curriculumSlots'] = $allCurriculumSlots; //All course sections taken by the student. $sectionsTaken = $student->getAllCoursesTaken(); //The courses for related to the taken course sections. $coursesTaken = array(); foreach ($sectionsTaken as $section) { array_push($coursesTaken, $section[0]->getCourse()); } //Selected courses will be an array in which // selectedCourse[0] = the course taken // selectedCourse[1] = the slot for that course $selectedCourses = $this->getSelectedCourses($coursesTaken, $allCurriculumSlots); $filledSlots = array(); foreach ($selectedCourses as $selCourse) { $course = $selCourse[0]; $slotName = $selCourse[1]; //If a course section is found its ID is stored // in the filledSlots array referenced by the slot name. $filledSlots[$slotName] = $this->getSectionForCourse($course); } $studentData['filledSlots'] = $filledSlots; $this->load->view('student_courses_form', $studentData); }
<body> <?php include_once 'application/views/Templates/navbar.php'; ?> <div class="container"> <p><b>Please select a curriculum.</b></p><br/> <form action="<?php echo site_url('User/submitStudentInfoForm/' . $uID); ?> " method="POST"> <?php $student = new User_model(); $student->loadPropertiesFromPrimaryKey($uID); $studentAdvisor = $student->getAdvisor(); $studentCurriculms = $student->getCurriculums(); $Curriculums = $this->Curriculum_model->getAllCurriculums(); foreach ($Curriculums as $Curriculum) { $id = $Curriculum->getCurriculumID(); $slotName = $Curriculum->getName(); echo '<input type="checkbox" value="true" name="Curriculum' . $id . '"'; if (in_array($Curriculum, $studentCurriculms)) { echo 'checked'; } echo '/> ' . $slotName . '</br>'; } ?> <p><b>Please select an advisor. </b></p><br/> <select name="advisorID" > <?php $advisors = $this->User_model->getAllAdvisors();