3
class Stats extends CI_Model {
5
function __construct(){
7
$this->load->library('user_agent');
10
function statsTeacher() {
11
if($this->agent->is_browser()) {
12
$agent['browser'] = $this->agent->browser();
13
$agent['version'] = $this->agent->version();
15
elseif ($this->agent->is_mobile()) {
16
$agent['mobile'] = $this->agent->mobile();
19
$agent['error_plattform'] = 'Oidentifierad plattform';
22
$agent['platform'] = $this->agent->platform();
24
//-------------------------------------------------------
26
//retrive the number of courses in the system
27
$this->db->select('COUNT(*)');
28
$this->db->from('Courses');
31
$query = $this->db->get();
32
$agent['numberOfCourses'] = $query->result();
34
//-------------------------------------------------------
36
//retrive the number of examples in the system
37
$this->db->select('COUNT(*)');
38
$this->db->from('Examples');
41
$query = $this->db->get();
42
$agent['numberOfExamples'] = $query->result();
44
//-------------------------------------------------------
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);
52
$query = $this->db->get();
53
$agent['numberOfExamplesInCourse'] = $query->result();
55
//-------------------------------------------------------
57
//retrive the number of quizzes in the system
58
$this->db->select('COUNT(*)');
59
$this->db->from('Quizzes');
62
$query = $this->db->get();
63
$agent['numberOfQuizzes'] = $query->result();
65
//-------------------------------------------------------
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);
73
$query = $this->db->get();
74
$agent['numberOfQuizzesInCourse'] = $query->result();
79
function statsStudent() {
80
if($this->agent->is_browser()) {
81
$agent['browser'] = $this->agent->browser();
82
$agent['version'] = $this->agent->version();
84
elseif ($this->agent->is_mobile()) {
85
$agent['mobile'] = $this->agent->mobile();
88
$agent = 'Oidentifierad plattform';
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);
97
$query = $this->db->get();
98
$agent['numberOfExamplesInCourse'] = $query->result();
100
//-------------------------------------------------------
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);
108
$query = $this->db->get();
109
$agent['numberOfQuizzesInCourse'] = $query->result();