/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/stats.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:
14
14
                public function getUserStats() {
15
15
                        //Dummy-array to be filled
16
16
                        $userStats = array(
17
 
                                'agentType' => '[unknown]',
18
 
                                'agentName' => '[unknown]',
19
 
                                'agentVersion' => '[unknown]',
20
 
                                'agentPlatform' => '[unknown]',
21
 
                                'agentString' => '[unknown]'    
 
17
                                'agentType' => 'unknown',
 
18
                                'agentName' => 'unknown',
 
19
                                'agentVersion' => 'unknown',
 
20
                                'agentPlatform' => 'unknown',
 
21
                                'agentString' => 'unknown'      
22
22
                        );
23
23
                
24
24
                        //If user is using a web browser
25
25
                        if($this->agent->is_browser()) {
26
 
                                $userStats['agentType'] = 'Desktop';
 
26
                                $userStats['agentType'] = 'browser';
27
27
                                $userStats['agentName'] = $this->agent->browser();
28
28
                                $userStats['agentVersion'] = $this->agent->version();
29
29
                        }
30
30
                        //If user is using a mobile browser
31
31
                        elseif ($this->agent->is_mobile()) {
32
 
                                $userStats['agentType'] = 'Mobile';
 
32
                                $userStats['agentType'] = 'mobile';
33
33
                                $userStats['agentName'] = $this->agent->mobile();
34
34
                        }
35
35
                        //If user is a robot
36
36
                        elseif ($this->agent->is_robot()) {
37
 
                                $userStats['agentType'] = 'Robot';
 
37
                                $userStats['agentType'] = 'robot';
38
38
                                $userStats['agentName'] = $this->agent->robot();
39
39
                        }
40
40
                        
54
54
                public function getSystemStats() {
55
55
                        //Dummy-array to be filled
56
56
                        $systemStats = array(
57
 
                                'courseAmount' => '[unknown]',
58
 
                                'exampleAmount' => '[unknown]',
59
 
                                'quizAmount' => '[unknown]'     
 
57
                                'courseAmount' => 'unknown',
 
58
                                'exampleAmount' => 'unknown',
 
59
                                'quizAmount' => 'unknown'       
60
60
                        );
61
61
                        
62
62
                        //Get amount of courses
63
 
                        $systemStats['courseAmount'] = $this->db->count_all('Courses');
 
63
                        $query = $this->db->get('Courses');
 
64
                        $systemStats['courseAmount'] = $query->num_rows();
64
65
                        
65
66
                        //Get amount of examples
66
 
                        $systemStats['exampleAmount'] = $this->db->count_all('Examples');
 
67
                        $query = $this->db->get('Examples');
 
68
                        $systemStats['exampleAmount'] = $query->num_rows();
67
69
                        
68
70
                        //Get amount of quizzes
69
 
                        $systemStats['quizAmount'] = $this->db->count_all('Quizzes');
 
71
                        $query = $this->db->get('Quizzes');
 
72
                        $systemStats['quizAmount'] = $query->num_rows();
70
73
                        
71
74
                        //Return result
72
75
                        return $systemStats;
77
80
                 *      This function returns an array with course stats.
78
81
                 */ 
79
82
                
80
 
                public function getCourseStats($courseID) {
 
83
                public function getCourseStats() {
81
84
                        //Dummy-array to be filled
82
85
                        $courseStats = array(
83
 
                                'exampleAmount' => '[unknown]',
84
 
                                'quizAmount' => '[unknown]'     
 
86
                                'exampleAmount' => 'unknown',
 
87
                                'quizAmount' => 'unknown'       
85
88
                        );
86
89
                        
87
 
                        $this->db->where('courseID', $courseID);
88
 
                        $this->db->from('Examples');
89
 
                        $courseStats['exampleAmount'] = $this->db->count_all_results();
90
 
                        
91
 
                        $this->db->where('courseID', $courseID);
92
 
                        $this->db->from('Quizzes');
93
 
                        $courseStats['quizAmount'] = $this->db->count_all_results();
94
 
                        
95
90
                        //Return result
96
91
                        return $courseStats;    
97
92
                }