/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: b11johgu
  • Date: 2013-05-14 12:30:38 UTC
  • mto: This revision was merged to the branch mainline in revision 65.
  • Revision ID: b11johgu@student.his.se-20130514123038-rthxj3f34o32gpxy
ExamplesController:
- Added expand/collapse arrows for categories/subcategories.
- Added category positioning (incomplete).

more general changes made.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
class Stats extends CI_Model {
 
4
 
 
5
        function __construct(){
 
6
                parent::__construct();
 
7
                $this->load->library('user_agent');
 
8
        }
 
9
 
 
10
        function statsTeacher() {
 
11
                if($this->agent->is_browser()) {
 
12
                        $agent['browser'] = $this->agent->browser();
 
13
                        $agent['version'] = $this->agent->version();
 
14
                }
 
15
                elseif ($this->agent->is_mobile()) {
 
16
                        $agent['mobile'] = $this->agent->mobile();
 
17
                }
 
18
                else {
 
19
                        $agent['error_plattform'] = 'Oidentifierad plattform';
 
20
                }
 
21
 
 
22
                        $agent['platform'] = $this->agent->platform();
 
23
                
 
24
                //-------------------------------------------------------
 
25
                
 
26
                //retrive the number of courses in the system
 
27
                $this->db->select('COUNT(*)');
 
28
                $this->db->from('Courses');
 
29
                
 
30
                //exececute query
 
31
                $query = $this->db->get();
 
32
                $agent['numberOfCourses'] = $query->result();
 
33
 
 
34
                //-------------------------------------------------------
 
35
 
 
36
                //retrive the number of examples in the system
 
37
                $this->db->select('COUNT(*)');
 
38
                $this->db->from('Examples');
 
39
                
 
40
                //exececute query
 
41
                $query = $this->db->get();
 
42
                $agent['numberOfExamples'] = $query->result();
 
43
 
 
44
                //-------------------------------------------------------
 
45
/*
 
46
                //retrive the number of examples in the active course
 
47
                $this->db->select('COUNT(*)');
 
48
                $this->db->from('Examples');
 
49
                $this->db->where('courseID', $activeCourse);
 
50
                
 
51
                //exececute query
 
52
                $query = $this->db->get();
 
53
                $agent['numberOfExamplesInCourse'] = $query->result();
 
54
*/
 
55
                //-------------------------------------------------------
 
56
 
 
57
                //retrive the number of quizzes in the system
 
58
                $this->db->select('COUNT(*)');
 
59
                $this->db->from('Quizzes');
 
60
                
 
61
                //exececute query
 
62
                $query = $this->db->get();
 
63
                $agent['numberOfQuizzes'] = $query->result();
 
64
                
 
65
                //-------------------------------------------------------
 
66
/*
 
67
                //retrive the number of quizzes in the active course
 
68
                $this->db->select('COUNT(*)');
 
69
                $this->db->from('Quizzes');
 
70
                $this->db->where('courseID', $activeCourse);
 
71
                
 
72
                //exececute query
 
73
                $query = $this->db->get();
 
74
                $agent['numberOfQuizzesInCourse'] = $query->result();
 
75
*/              
 
76
                return $agent;
 
77
        }
 
78
 
 
79
        function statsStudent() {
 
80
                if($this->agent->is_browser()) {
 
81
                        $agent['browser'] = $this->agent->browser();
 
82
                        $agent['version'] = $this->agent->version();
 
83
                }
 
84
                elseif ($this->agent->is_mobile()) {
 
85
                        $agent['mobile'] = $this->agent->mobile();
 
86
                }
 
87
                else {
 
88
                        $agent = 'Oidentifierad plattform';
 
89
                }
 
90
 
 
91
                //retrive the number of examples in the active course
 
92
                $this->db->select('COUNT(*)');
 
93
                $this->db->from('Examples');
 
94
                $this->db->where('courseID', $activeCourse);
 
95
                
 
96
                //exececute query
 
97
                $query = $this->db->get();
 
98
                $agent['numberOfExamplesInCourse'] = $query->result();
 
99
 
 
100
                //-------------------------------------------------------
 
101
 
 
102
                //retrive the number of quizzes in the active course
 
103
                $this->db->select('COUNT(*)');
 
104
                $this->db->from('Quizzes');
 
105
                $this->db->where('courseID', $activeCourse);
 
106
                
 
107
                //exececute query
 
108
                $query = $this->db->get();
 
109
                $agent['numberOfQuizzesInCourse'] = $query->result();
 
110
 
 
111
                return $agent;
 
112
        }
 
113
}