/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/controllers/start.php

  • Committer: a11andoh
  • Date: 2013-05-27 11:25:41 UTC
  • mfrom: (105 lenasys_b)
  • mto: This revision was merged to the branch mainline in revision 106.
  • Revision ID: a11andoh@student.his.se-20130527112541-gut7vg5nu8mxvgmn
blurp

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
                }
14
14
        
15
15
                /*
 
16
                 *Temporary function to be able to be logged in to reach the page
 
17
                 */
 
18
                public function tempLogin() {
 
19
                        $this->load->model('user');
 
20
                        $loginDetails = array(
 
21
                        'username' => 'tempTeacher',
 
22
                        'name' => 'tempFoo',
 
23
                        'usertype' => 'Teacher',
 
24
                        'ssn' => '0000',
 
25
                        'activeCourse' => 'DA525G');
 
26
                        $this->session->set_userdata('authenticated', $loginDetails);
 
27
                        redirect(base_url().'start', 'refresh');
 
28
                }
 
29
                public function tempLogout() {
 
30
                        $this->load->model('user');
 
31
                        $this->session->unset_userdata('authenticated');
 
32
                        redirect(base_url().'home', 'refresh');
 
33
                }
 
34
        
 
35
                /*
16
36
                 *      This function runs when the user navigates directly to the start controller
17
37
                 */
18
38
                public function index() {
19
39
                        if($this->user->isLoggedIn()) {
20
40
                                //User already logged in
21
 
                                redirect(base_url().'home', 'refresh');
 
41
                                redirect(base_url().'cms', 'refresh');
22
42
                        } else {
23
43
                                //Display the start page
24
44
                                $this->drawStartPage('');
31
51
                private function drawStartPage() {
32
52
                        $userName = $this->user->getUserName();
33
53
                        $userType = $this->user->getUserType();
 
54
                        //Creates an array with active course info.
 
55
                        $activeCourse = $this->user->getActiveCourse();
34
56
                        //Creates an array with all courses.
35
57
                        $courses = $this->admin_model->getCourses();
36
58
                        
 
59
                        
37
60
                        //Creates an array with the variables that the bannermenu-view is expecting.
38
61
                        $data = array(
39
62
                                'userType' => $userType,
40
63
                                'userName' => $userName,
 
64
                                'activeCourse' => $activeCourse,
41
65
                                'courses' => $courses
42
66
                        );
43
67