示例#1
0
 public function confirm_remove()
 {
     if (!isset($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     //Create new user and load its data
     $user = new User_model();
     if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     if (!$user->isProgramChair()) {
         redirect('Mainpage');
     }
     $tcourse = $this->input->post("transferCourseID");
     $t_course = new Student_transfer_course_model();
     $norm_course = new Course_model();
     //explode this, then load the data from pimary key, then load course from primary, then add equilvilent course
     $str_array = explode(",", $tcourse);
     $t_course->loadPropertiesFromPrimaryKey(intval($str_array[0]));
     $norm_course->loadPropertiesFromPrimaryKey(intval($str_array[1]));
     $t_course->removeEquivilentCourse($norm_course);
     redirect('Transfer_controller/viewIdMapping');
 }
示例#2
0
 public function delete()
 {
     $user = new User_model();
     if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     if (!$user->isProgramChair()) {
         redirect('Login/logout');
     }
     if (!$this->uri->segment(3)) {
         redirect('Coursemanager/index');
     }
     $course = new Course_model();
     if (!$course->loadPropertiesFromPrimaryKey($this->uri->segment(3))) {
         redirect('Coursemanager/index');
     }
     $course->delete();
     redirect('Coursemanager/index/' . $course->getCourseName());
 }
示例#3
0
 /**
  * Summary of getAllCourses
  * Get all of the courses saved in the database
  * 
  * @param string $courseName A filter to only select courses with the specified course name, leave null for no filter
  * @return An array of all the course models represented in the database
  */
 public static function getAllCourses($courseName = null)
 {
     $db = get_instance()->db;
     $db->select('CourseID');
     if ($courseName != null) {
         $db->where('CourseName', $courseName);
     }
     $db->order_by('CourseName, CourseNumber', 'asc');
     $results = $db->get('Courses');
     $data_arr = array();
     foreach ($results->result_array() as $row) {
         $course = new Course_model();
         if ($course->loadPropertiesFromPrimaryKey($row['CourseID'])) {
             array_push($data_arr, $course);
         }
     }
     return $data_arr;
 }
 public function getAllEquivilentCourses()
 {
     $models = array();
     if ($this->studentTransferCourseID != null) {
         $this->db->select('EquivilentCourseID');
         $this->db->from('StudentTransferCourseEquivilentCourses');
         $this->db->where('StudentTransferCourseID', $this->studentTransferCourseID);
         $results = $this->db->get();
         if ($results->num_rows() > 0) {
             foreach ($results->result_array() as $row) {
                 $model = new Course_model();
                 if ($model->loadPropertiesFromPrimaryKey($row['EquivilentCourseID'])) {
                     array_push($models, $model);
                 }
             }
         }
     }
     return $models;
 }