58 $this->ilias =& $ilias;
70 global $ilUser, $ilDB;
72 $q =
"SELECT * from ut_access "
74 .
" user_id = ".$ilDB->quote($ilUser->getId())
75 .
" order by acc_time desc limit 1 ";
76 $res = $ilDB->query($q);
80 function _hasEntry($a_obj_id, $a_obj_type,$a_sub_id = 0, $a_sub_type =
"")
86 $query =
"SELECT COUNT(id) as num_entries FROM ut_access ".
87 "WHERE session_id = ".$ilDB->quote(session_id()).
" ".
88 "AND acc_obj_id = ".$ilDB->quote($a_obj_id).
" ".
89 "AND acc_sub_id = ".$ilDB->quote($a_sub_id);
90 $res = $ilDB->query($query);
93 return $row->num_entries ?
true :
false;
105 function _trackAccess($a_obj_id, $a_obj_type,$a_sub_id = 0, $a_sub_type =
"", $a_action_type =
"read")
107 global $ilUser, $ilDB;
110 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
116 include_once
'Services/Tracking/classes/class.ilLearningProgress.php';
121 $user_id = $ilUser->getId();
128 $client_ip = getenv(
"REMOTE_ADDR");
129 $script = substr($_SERVER[
"SCRIPT_FILENAME"], strlen(IL_ABSOLUTE_PATH) - 1,
130 strlen($_SERVER[
"SCRIPT_FILENAME"]) - strlen(IL_ABSOLUTE_PATH) + 1);
131 $language = $ilUser->getLanguage();
132 $session_id = session_id();
134 #$last_access = ilTracking::_getLastAccess();
140 $q =
"INSERT INTO ut_access ("
141 .
"user_id, action_type, php_script, client_ip,"
142 .
"acc_obj_type, acc_obj_id, acc_sub_type, acc_sub_id,"
143 .
"language, browser, session_id, acc_time"
145 .$ilDB->quote($user_id).
","
146 .$ilDB->quote($a_action_type).
","
147 .$ilDB->quote($script).
","
148 .$ilDB->quote($client_ip).
","
149 .$ilDB->quote($a_obj_type).
","
150 .$ilDB->quote($a_obj_id).
","
151 .$ilDB->quote($a_sub_type).
","
152 .$ilDB->quote($a_sub_id).
","
153 .$ilDB->quote($language).
","
154 .$ilDB->quote($_SERVER[
"HTTP_USER_AGENT"]).
","
155 .$ilDB->quote($session_id).
", now()"
194 $q =
" SELECT title from object_data "
195 .
" WHERE type = 'tst'"
196 .
" AND owner = ".$user_id;
197 $res = $this->ilias->db->query($q);
198 for($i=0;$i<
$res->numRows();$i++)
222 $from = strtotime($from);
223 $to = strtotime($to);
224 $dayf = date (
"d",$from);
225 $dayt = date (
"d",$to);
226 $yearf = date (
"Y",$from);
227 $yeart = date (
"Y",$to);
228 $montht = date (
"m",$to);
229 $monthf = date (
"m",$from);
230 $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
235 $from = strtotime($from);
236 $to = strtotime($to);
237 $dayf = date (
"d",$from);
238 $dayt = date (
"d",$to);
239 $yearf = date (
"Y",$from);
240 $yeart = date (
"Y",$to);
241 $montht = date (
"m",$to);
242 $monthf = date (
"m",$from);
243 $hourt = date (
"h",$to);
244 $hourf = date (
"h",$from);
245 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
251 $time = strtotime($time);
252 $day = date(
"d",$time);
253 $month = date(
"m",$time);
254 $year = date(
"Y",$time);
255 $hour = date(
"H",$time);
256 $min = date(
"i",$time);
257 $sec = date(
"s",$time);
259 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
264 $time = strtotime($time);
265 $day = date(
"d",$time);
266 $month = date(
"m",$time);
267 $year = date(
"y",$time);
268 $min = date(
"i",$time);
269 $hour = date(
"h",$time);
270 $sec = date(
"s",$time);
272 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
278 $q =
"SELECT obj_id from object_data "
279 .
" WHERE type = 'lm' and "
281 $res = $this->ilias->db->query($q);
282 for($i=0;$i<
$res->numRows();$i++)
290 $q =
"SELECT obj_id from object_data "
291 .
" WHERE type = 'tst' and "
293 $res = $this->ilias->db->query($q);
294 for($i=0;$i<
$res->numRows();$i++)
302 $q =
"select obj_id from object_data "
303 .
" where type = 'tst' and "
305 $res = $this->ilias->db->query($q);
306 for ($i=0;$i<
$res->numRows();$i++)
314 $q =
"SELECT count(*) from ut_access "
317 $res = $this->ilias->db->query($q);
323 $q =
"SELECT a.login,b.acc_obj_type,b.language,b.client_ip,b.acc_time "
324 .
" FROM usr_data as a,ut_access as b "
325 .
" WHERE a.usr_id=b.user_id "
328 $res = $this->ilias->db->query($q);
329 for($i=0;$i<
$res->numRows();$i++)
337 $q =
"SELECT a.login,b.acc_obj_type,b.client_ip,b.acc_time "
338 .
" FROM usr_data as a,ut_access as b "
339 .
" WHERE a.usr_id=b.user_id "
342 $res = $this->ilias->db->query($q);
343 for($i=0;$i<
$res->numRows();$i++)
351 $q =
"SELECT user_id from ut_access where ".$condition;
353 $res = $this->ilias->db->query($q);
354 for($i=0;$i<
$res->numRows();$i++)
362 $q =
"select user_fi from tst_active where ".$condition;
363 $res = $this->ilias->db->query($q);
364 for($i=0;$i<
$res->numRows();$i++)
372 $q =
"select obj_id from object_data where type = 'tst' and title = '".$test.
"'";
373 $res = $this->ilias->db->query($q);
379 $q =
"SELECT count(*) from ut_access "
380 .
" WHERE (acc_time > '".$from
381 .
"' AND acc_time <='".$from1.
"')"
385 $res = $this->ilias->db->query($q);
391 $q =
"SELECT acc_time from ut_access "
392 .
" WHERE (acc_time >= '".$from
393 .
"' AND acc_time <='".$to.
"')"
397 $res = $this->ilias->db->query($q);
398 for($i=0;$i<
$res->numRows();$i++)
407 $q =
"SELECT title from object_data "
412 $res = $this->ilias->db->query($q);
413 for($i=0;$i<
$res->numRows();$i++)