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