Example #1
0
 public function deleteCurriculum($curriculumID = NULL)
 {
     //get arguments
     if ($curriculumID == NULL) {
         $curriculumID = $this->input->post('curriculum');
     }
     $curriculum = new Curriculum_model();
     $curriculum->loadPropertiesFromPrimaryKey($curriculumID);
     $curriculum->delete();
     $this->index();
 }
Example #2
0
 public function remove($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->removeCurriculum($curriculum);
     }
     redirect('Selectcurriculum/index');
 }
Example #3
0
 /**
  * Summary of getAllCurriculums
  * Get all the curriculums stored in the database
  * 
  * @return array An array of all the curriculum models currently stored in the database
  */
 public static function getAllCurriculums()
 {
     $db = get_instance()->db;
     $data = array();
     $db->select('CurriculumID');
     $db->from('Curriculums');
     $results = $db->get();
     foreach ($results->result_array() as $row) {
         $model = new Curriculum_model();
         $model->loadPropertiesFromPrimaryKey($row['CurriculumID']);
         array_push($data, $model);
     }
     return $data;
 }
Example #4
0
 /**
  * Summary of getCurriculums
  * Get all of the curriculums that this user model is bound to
  *
  * @return Array An array containing all of the curriculum models this user is bound to
  */
 public function getCurriculums()
 {
     $models = array();
     $this->db->select('CurriculumID');
     $this->db->from('UserCurriculums');
     $this->db->where('UserID', $this->userID);
     $results = $this->db->get();
     if ($results->num_rows() > 0) {
         foreach ($results->result_array() as $row) {
             $model = new Curriculum_model();
             if ($model->loadPropertiesFromPrimaryKey($row['CurriculumID'])) {
                 array_push($models, $model);
             }
         }
     }
     return $models;
 }
Example #5
0
 private function collectCourseData($curriculumID)
 {
     #get list of all curriculumcourseslots for names of courses
     $curriculum = new Curriculum_model();
     $curriculum->loadPropertiesFromPrimaryKey($curriculumID);
     $currCourseList = $curriculum->getCurriculumCourseSlots();
     #Courses list to grab courseIDs from courseName and course Number
     $course = new Course_model();
     $courseList = $course->getAllCourses();
     #Create a list of CourseIDs to reference courses
     $courseIDList = array();
     #loop through each currCourseListName and grab the matching courseID's
     #with matching CourseNames and CourseNumbers
     foreach ($currCourseList as $currCourse) {
         $currCourseName = $currCourse->getName();
         $nameLength = strlen($currCourseName);
         $cName = preg_split('%[0-9]%', $currCourseName);
         $cName = strtoupper($cName[0]);
         $cNumber = $currCourseName[$nameLength - 3] . $currCourseName[$nameLength - 2] . $currCourseName[$nameLength - 1];
         foreach ($courseList as $course) {
             if ($course->getCourseName() . ' ' . $course->getCourseNumber() == $cName . $cNumber) {
                 array_push($courseIDList, $course->getCourseID());
             }
         }
     }
     #now that we have a list of all courseIDs we need to make a list of
     #courseSectionIDs
     #first make a list of all courseSections
     $courseSections = new Course_section_model();
     $courseSectionList = $courseSections->getAllCourseSections();
     #next make a list to store the courseSectionIDs we need
     $courseSectionIDList = array();
     foreach ($courseIDList as $courseID) {
         foreach ($courseSectionList as $courseSection) {
             if ($courseSection->getCourse()->getCourseID() == $courseID) {
                 array_push($courseSectionIDList, $courseSection->getCourseSectionID());
             }
         }
     }
     $allCourseData = array();
     foreach ($courseSectionIDList as $csID) {
         $courseData = array('sectionID' => null, 'courseName' => null, 'quarterID' => null, 'quarterName' => null, 'quarterYear' => null, 'sectionNum' => null);
         $cSection = new Course_section_model();
         $cSection->loadPropertiesFromPrimaryKey($csID);
         $course = $cSection->getCourse();
         $cName = $course->getCourseName();
         $cNumber = $course->getCourseNumber();
         $courseData['quarterID'] = $cSection->getAcademicQuarter()->getAcademicQuarterID();
         $courseData['quarterName'] = $cSection->getAcademicQuarter()->getName();
         $courseData['quarterYear'] = $cSection->getAcademicQuarter()->getYear();
         $courseData['sectionNum'] = $cSection->getSectionName();
         $courseData['sectionID'] = $csID;
         $courseData['courseName'] = $cName . $cNumber;
         array_push($allCourseData, $courseData);
     }
     return $allCourseData;
 }