/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/application/models/user.php

  • Committer: a11andoh
  • Date: 2013-05-24 11:28:43 UTC
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: a11andoh@student.his.se-20130524112843-360je7hu7q13r171
added the cms controller to load all content pages.
added first time registration controller to load the views for the registration
pages.
added and fixed temporarypages for the controllers 
and edited the models to be able to get active courses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
                        return FALSE;
176
176
                }
177
177
 
178
 
                /* 
179
 
                 * Updates the details of a user. Takes a username and an associative array of data with the details to be changed 
180
 
                 */
181
 
                public function updateUser($username, $data) {
182
 
                        $this->db->where("username", $username);
183
 
                        $this->db->update("Users", $data);
184
 
                }
185
 
 
186
178
 
187
179
                /*
188
180
                 *      This function removes users from the database.
395
387
                }
396
388
                
397
389
                /*
398
 
                * This function fetches the active course info
 
390
                * This function fetches the active course from the user table
399
391
                */
400
392
                public function getActiveCourse(){
401
 
                        
402
393
                        if($this->isLoggedIn()) {
403
394
                                $temp = $this->session->userdata('authenticated');
404
 
                                $courseID = $temp['activeCourse'];
405
 
                                $courseName;
406
 
                        
407
 
                                //Query-structure
408
 
                                $this->db->select('name');
409
 
                                $this->db->from('Courses');
410
 
                                $this->db->where('courseID', $courseID);
411
 
                                $this->db->limit(1);
412
 
                                //Execute query
413
 
                                $query = $this->db->get();
414
 
                                $result = $query->result();
415
 
 
416
 
                                foreach($result as $row) {
417
 
                                        $courseName = $row->name;
418
 
                                }
419
 
                                
420
 
                                $data = array(
421
 
                                        'courseID' => $courseID,
422
 
                                        'courseName' => $courseName
423
 
                                );
424
 
                                
425
 
                                return $data;
 
395
                                return $temp['activeCourse'];   
426
396
                        }
 
397
                        
427
398
                        return FALSE;
428
399
                }
429
400
        }
 
401
        
430
402
?>
 
 
b'\\ No newline at end of file'