/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/cms.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-30 13:06:35 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130530130635-ugsojc341u3bo81a
Made some changes so it now is correctly spelled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
                        $this->load->model('user', '', TRUE);
12
12
                        $this->load->model('admin/admin_model', '', TRUE);
13
13
                        $this->load->model('filetree');
14
 
                }
15
 
                
16
 
                /*
17
 
                 *Temporary function to be able to be logged in to reach the page
18
 
                 */
19
 
                public function tempLogin() {
20
 
                        $this->load->model('user');
21
 
                        $loginDetails = array(
22
 
                        'username' => 'tempTeacher',
23
 
                        'name' => 'tempFoo',
24
 
                        'usertype' => 'Teacher',
25
 
                        'ssn' => '0000',
26
 
                        'activeCourse' => 'DA525G');
27
 
                        $this->session->set_userdata('authenticated', $loginDetails);
28
 
                        redirect(base_url().'cms', 'refresh');
29
 
                }
30
 
                public function tempLogout() {
31
 
                        $this->load->model('user');
32
 
                        $this->session->unset_userdata('authenticated');
33
 
                        redirect(base_url().'home', 'refresh');
 
14
                        $this->load->model('stats');
34
15
                }
35
16
                
36
17
                /*
46
27
                        }
47
28
                }               
48
29
                
49
 
                public function test(){
50
 
                        
51
 
                        $result = $this->admin_model->getStudentCourses("student");
52
 
                        foreach($result as $res) {
53
 
                                echo $res->courseID. ' - ';
54
 
                                echo $res->name;
55
 
                                echo "<br>";
56
 
                                
57
 
                        }
58
 
                        
59
 
                        //var_dump($result);
60
 
                }
61
 
                
62
 
                
63
30
                /*
64
31
                 *      This function draws the cms page.
65
32
                 */
67
34
                        $userName = $this->user->getUserName();
68
35
                        $userType = $this->user->getUserType();
69
36
                        $activeCourse = $this->user->getActiveCourse();
70
 
                        //Creates an array with all courses.
71
 
                        $courses = $this->admin_model->getCourses();
 
37
 
 
38
                        if($userName != "" && $userType == "Teacher") {
 
39
                                //Creates an array with all courses.
 
40
                                $courses = $this->admin_model->getCourses();
 
41
                        } elseif($userName != "" && $userType == "Student") {
 
42
                                $courses = $this->admin_model->getStudentCourses($userName);
 
43
                        } else {
 
44
                                $courses = $this->admin_model->getPublicCourses();
 
45
                        }
 
46
 
 
47
 
72
48
                        //Creates an array with all categories for active course
73
49
                        $categories = $this->admin_model->getCategories($activeCourse['courseID']);
74
50
                        
113
89
                        //Creates an array with the necessary css- and jsfiles needed for the views that are about to be shown.
114
90
                        $headTagData = array(
115
91
                                'cssFiles' => array('bannermenu', 'sidemenu', 'cmsindex'),
116
 
                                'jsFiles' => array('bannermenu')
117
 
                        );
 
92
                                'jsFiles' => array('bannermenu', 'sidemenu')
 
93
                        );
 
94
                        
 
95
                        $stats = array(
 
96
                                'system' => $this->stats->getSystemStats(),
 
97
                                'course' => $this->stats->getCourseStats($data['activeCourse']['courseID']),
 
98
                                'user' => $this->stats->getUserStats()
 
99
                        );
 
100
                        $data['stats'] = $stats;
118
101
                        
119
102
                        //Puts the array above in <head></head>
120
103
                        $this->load->view('headTag', array('headTagData' => $headTagData));