33 die (
"class ilTracking is deprecated");
34 $this->ilias =& $ilias;
46 global $ilUser,
$ilDB;
49 $q =
"SELECT * from ut_access "
51 .
" user_id = ".$ilDB->quote($ilUser->getId(),
'integer')
52 .
" ORDER BY acc_time DESC";
53 $res = $ilDB->query($q);
57 function _hasEntry($a_obj_id, $a_obj_type,$a_sub_id = 0, $a_sub_type =
"")
63 $query =
"SELECT COUNT(id) as num_entries FROM ut_access ".
64 "WHERE session_id = ".$ilDB->quote(session_id(),
"text").
" ".
65 "AND acc_obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
66 "AND acc_sub_id = ".$ilDB->quote($a_sub_id,
"text").
" ";
70 return $row->num_entries ?
true :
false;
82 function _trackAccess($a_obj_id, $a_ref_id, $a_obj_type, $a_sub_id = 0, $a_sub_type =
"", $a_action_type =
"read")
84 global $ilUser,
$ilDB;
86 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
92 include_once
'Services/Tracking/classes/class.ilLearningProgress.php';
97 $user_id = $ilUser->getId();
104 $client_ip = getenv(
"REMOTE_ADDR");
105 $script = substr($_SERVER[
"SCRIPT_FILENAME"], strlen(IL_ABSOLUTE_PATH) - 1,
106 strlen($_SERVER[
"SCRIPT_FILENAME"]) - strlen(IL_ABSOLUTE_PATH) + 1);
107 $language = $ilUser->getLanguage();
108 $session_id = session_id();
110 #$last_access = ilTracking::_getLastAccess();
117 $q =
"INSERT INTO ut_access ("
119 .
"user_id, action_type, php_script, client_ip,"
120 .
"acc_obj_type, acc_obj_id, acc_sub_type, acc_sub_id,"
121 .
"language, browser, session_id, acc_time, ut_month"
123 .$ilDB->quote($ilDB->nextId(
'ut_access'),
'integer').
','
124 .$ilDB->quote($user_id,
"integer").
","
125 .$ilDB->quote($a_action_type,
"text").
","
126 .$ilDB->quote($script,
"text").
","
127 .$ilDB->quote($client_ip,
"text").
","
128 .$ilDB->quote($a_obj_type,
"text").
","
129 .$ilDB->quote($a_obj_id,
"integer").
","
130 .$ilDB->quote($a_sub_type,
"text").
","
131 .$ilDB->quote($a_sub_id,
"integer").
","
132 .$ilDB->quote($language,
"text").
","
133 .$ilDB->quote(substr($_SERVER[
"HTTP_USER_AGENT"],0.255)).
","
134 .$ilDB->quote($session_id,
"text").
", "
138 $ilDB->manipulate($q);
177 $q =
" SELECT title from object_data "
178 .
" WHERE type = ".$ilDB->quote(
"tst",
"text")
179 .
" AND owner = ".$ilDB->quote($user_id ,
'integer');
180 $res = $this->ilias->db->query($q);
181 for($i=0;$i<
$res->numRows();$i++)
183 $result[$i]=
$res->fetchRow();
192 $from = strtotime($from);
193 $to = strtotime($to);
194 $dayf = date (
"d",$from);
195 $dayt = date (
"d",$to);
196 $yearf = date (
"Y",$from);
197 $yeart = date (
"Y",$to);
198 $montht = date (
"m",$to);
199 $monthf = date (
"m",$from);
200 $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
205 $from = strtotime($from);
206 $to = strtotime($to);
207 $dayf = date (
"d",$from);
208 $dayt = date (
"d",$to);
209 $yearf = date (
"Y",$from);
210 $yeart = date (
"Y",$to);
211 $montht = date (
"m",$to);
212 $monthf = date (
"m",$from);
213 $hourt = date (
"h",$to);
214 $hourf = date (
"h",$from);
215 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
221 $time = strtotime($time);
222 $day = date(
"d",$time);
223 $month = date(
"m",$time);
224 $year = date(
"Y",$time);
225 $hour = date(
"H",$time);
226 $min = date(
"i",$time);
227 $sec = date(
"s",$time);
229 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
234 $time = strtotime($time);
235 $day = date(
"d",$time);
236 $month = date(
"m",$time);
237 $year = date(
"y",$time);
238 $min = date(
"i",$time);
239 $hour = date(
"h",$time);
240 $sec = date(
"s",$time);
242 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
250 $q =
"SELECT obj_id from object_data "
251 .
" where type = ".$ilDB->quote(
"lm",
"text").
" and "
252 .
" owner = ".$ilDB->quote($id,
"integer");
253 $res = $this->ilias->db->query($q);
254 for($i=0;$i<
$res->numRows();$i++)
256 $result[$i]=
$res->fetchRow();
264 $q =
"SELECT obj_id from object_data "
265 .
" where type = ".$ilDB->quote(
"tst",
"text").
" and "
266 .
" owner = ".$ilDB->quote($id,
"integer");
267 $res = $this->ilias->db->query($q);
268 for($i=0;$i<
$res->numRows();$i++)
270 $result[$i]=
$res->fetchRow();
279 $q =
"select obj_id from object_data "
280 .
" where type = ".$ilDB->quote(
"tst",
"text").
" and "
281 .
" owner = ".$ilDB->quote($id,
"integer");
282 $res = $this->ilias->db->query($q);
283 for ($i=0;$i<
$res->numRows();$i++)
285 $result[$i]=
$res->fetchRow();
294 $q =
"SELECT count(*) from ut_access "
297 $res = $this->ilias->db->query($q);
298 $result =
$res->fetchRow();
306 $q =
"SELECT a.login,b.acc_obj_type,b.language,b.client_ip,b.acc_time "
307 .
" FROM usr_data a,ut_access b "
308 .
" WHERE a.usr_id=b.user_id "
311 $res = $this->ilias->db->query($q);
312 for($i=0;$i<
$res->numRows();$i++)
314 $result[$i]=
$res->fetchRow();
323 $q =
"SELECT a.login,b.acc_obj_type,b.client_ip,b.acc_time "
324 .
" FROM usr_data a,ut_access b "
325 .
" WHERE a.usr_id=b.user_id "
328 $res = $this->ilias->db->query($q);
329 for($i=0;$i<
$res->numRows();$i++)
331 $result[$i]=
$res->fetchRow();
340 $q =
"SELECT user_id from ut_access where ".$condition;
342 $res = $this->ilias->db->query($q);
343 for($i=0;$i<
$res->numRows();$i++)
345 $result[$i]=
$res->fetchRow();
354 $q =
"select user_fi from tst_active where ".$condition;
355 $res = $this->ilias->db->query($q);
356 for($i=0;$i<
$res->numRows();$i++)
358 $result[$i]=
$res->fetchRow();
367 $q =
"select obj_id from object_data where type = ".
368 $ilDB->quote(
"tst",
"text").
" and title = ".$ilDB->quote(
$test,
"text");
369 $res = $this->ilias->db->query($q);
370 $result =
$res->fetchRow();
378 $q =
"SELECT count(*) from ut_access "
379 .
" WHERE (acc_time > ".$ilDB->quote($from,
"timestamp")
380 .
" AND acc_time <= ".$ilDB->quote($from1,
"integer").
")"
384 $res = $this->ilias->db->query($q);
385 $result =
$res->fetchRow();
393 $q =
"SELECT acc_time from ut_access "
394 .
" WHERE (acc_time > ".$ilDB->quote($from,
"timestamp")
395 .
" AND acc_time <= ".$ilDB->quote($to,
"integer").
")"
399 $res = $this->ilias->db->query($q);
400 for($i=0;$i<
$res->numRows();$i++)
402 $result[$i]=
$res->fetchRow();
411 $q =
"SELECT title from object_data "
413 .
" type = ".$ilDB->quote(
"tst",
"text")
415 .
" owner = ".$ilDB->quote($id,
"integer");
416 $res = $this->ilias->db->query($q);
417 for($i=0;$i<
$res->numRows();$i++)
419 $result[$i]=
$res->fetchRow();