/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-28 15:19:50 UTC
  • mfrom: (90.1.18 lenasys2)
  • Revision ID: gustav.hartvigsson@gmail.com-20130528151950-94dkhjql3y0mphyp
merged Jonsson:s changes:
Fixed even/odd line color on cmsindex.

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
 
                        $this->load->model('stats');
 
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');
15
34
                }
16
35
                
17
36
                /*
27
46
                        }
28
47
                }               
29
48
                
 
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
                
30
63
                /*
31
64
                 *      This function draws the cms page.
32
65
                 */
34
67
                        $userName = $this->user->getUserName();
35
68
                        $userType = $this->user->getUserType();
36
69
                        $activeCourse = $this->user->getActiveCourse();
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
 
 
 
70
                        //Creates an array with all courses.
 
71
                        $courses = $this->admin_model->getCourses();
48
72
                        //Creates an array with all categories for active course
49
73
                        $categories = $this->admin_model->getCategories($activeCourse['courseID']);
50
74
                        
89
113
                        //Creates an array with the necessary css- and jsfiles needed for the views that are about to be shown.
90
114
                        $headTagData = array(
91
115
                                'cssFiles' => array('bannermenu', 'sidemenu', 'cmsindex'),
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;
 
116
                                'jsFiles' => array('bannermenu')
 
117
                        );
101
118
                        
102
119
                        //Puts the array above in <head></head>
103
120
                        $this->load->view('headTag', array('headTagData' => $headTagData));