| 1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* File for training_data_object class
|
|
|
19 |
*
|
|
|
20 |
* @package report_training
|
|
|
21 |
* @copyright 2016 Mark Heumueller <mark.heumueller@gmx.de>
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
/**
|
|
|
26 |
* Class which holds all saveable data
|
|
|
27 |
*
|
|
|
28 |
* @package report_training
|
|
|
29 |
* @copyright 2016 Mark Heumueller <mark.heumueller@gmx.de>
|
|
|
30 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
31 |
*/
|
|
|
32 |
class training_data_object{
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* @var int $userid ID of the user
|
|
|
36 |
*/
|
|
|
37 |
public $userid;
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* @var String $userrole "userrole" check if is admin
|
|
|
41 |
*/
|
|
|
42 |
public $userrole;
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
* @var int $objectdata currenttime in timestamp
|
|
|
46 |
*/
|
|
|
47 |
public $objectdate;
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* @var String $activemoodlelang user used moodlelang
|
|
|
51 |
*/
|
|
|
52 |
public $activemoodlelang;
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* @var String $userhash created hash
|
|
|
56 |
*/
|
|
|
57 |
public $userhash;
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* @var String $devicetype type of device
|
|
|
61 |
*/
|
|
|
62 |
public $devicetype;
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* @var String $devicesystem operating system
|
|
|
66 |
*/
|
|
|
67 |
public $devicesystem;
|
|
|
68 |
|
|
|
69 |
/**
|
|
|
70 |
* @var String $devicebrowser current used browser
|
|
|
71 |
*/
|
|
|
72 |
public $devicebrowser;
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
* @var float $devicebrowserversion version of used browser
|
|
|
76 |
*/
|
|
|
77 |
public $devicebrowserversion;
|
|
|
78 |
|
|
|
79 |
/**
|
|
|
80 |
* @var int $devicedisplaysizex width of devicescreen in px
|
|
|
81 |
*/
|
|
|
82 |
public $devicedisplaysizex;
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* @var int $devicedisplaysizey height of devicescreen in px
|
|
|
86 |
*/
|
|
|
87 |
public $devicedisplaysizey;
|
|
|
88 |
|
|
|
89 |
/**
|
|
|
90 |
* @var int $devicewindowsizex width of browser in px
|
|
|
91 |
*/
|
|
|
92 |
public $devicewindowsizex;
|
|
|
93 |
|
|
|
94 |
/**
|
|
|
95 |
* @var int $devicewindowsizey height of browser in px
|
|
|
96 |
*/
|
|
|
97 |
public $devicewindowsizey;
|
|
|
98 |
|
|
|
99 |
/**
|
|
|
100 |
* @var String $devicepointingmethod interation method
|
|
|
101 |
*/
|
|
|
102 |
public $devicepointingmethod;
|
|
|
103 |
|
|
|
104 |
/**
|
|
|
105 |
* @var String $httpuserag http user agent
|
|
|
106 |
*/
|
|
|
107 |
public $httpuserag;
|
|
|
108 |
|
|
|
109 |
/**
|
|
|
110 |
* @var String $httpssl is ssl used
|
|
|
111 |
*/
|
|
|
112 |
public $httpssl;
|
|
|
113 |
|
|
|
114 |
/**
|
|
|
115 |
* @var String $httpacclang http active lang
|
|
|
116 |
*/
|
|
|
117 |
public $httpacclang;
|
|
|
118 |
|
|
|
119 |
/**
|
|
|
120 |
* Construct for object
|
|
|
121 |
*/
|
|
|
122 |
public function __construct() {
|
|
|
123 |
$this->httpuserag = htmlentities($_SERVER['HTTP_USER_AGENT']);
|
|
|
124 |
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
|
|
|
125 |
$this->httpssl = $_SERVER['HTTPS'];
|
|
|
126 |
} else {
|
|
|
127 |
$this->httpssl = 'off';
|
|
|
128 |
}
|
|
|
129 |
$this->httpacclang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
|
|
130 |
}
|
|
|
131 |
/**
|
|
|
132 |
* Creating a hash based on userrsession - used for anonymization
|
|
|
133 |
* @param moodle_session $usersession
|
|
|
134 |
* @return String hash
|
|
|
135 |
*/
|
|
|
136 |
public static function get_identify_hash($usersession) {
|
|
|
137 |
$usersession = $usersession->sesskey;
|
|
|
138 |
$salt = sha1(md5($usersession));
|
|
|
139 |
return $anonymoushash = md5($usersession.$salt);
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
/**
|
|
|
143 |
* Debug function
|
|
|
144 |
* @deprecated
|
|
|
145 |
*/
|
|
|
146 |
public function _data_object_debug() {
|
|
|
147 |
var_dump(get_object_vars($this));
|
|
|
148 |
}
|
|
|
149 |
}
|