37 define(
'UT_INACTIVE_BOTH',0);
38 define(
'UT_ACTIVE_BOTH',1);
39 define(
'UT_ACTIVE_UT',2);
40 define(
'UT_ACTIVE_LP',3);
42 include_once
"classes/class.ilObject.php";
65 $this->
ilObject($a_id,$a_call_by_reference);
67 define(
"DEFAULT_TIME_SPAN",60*5);
75 $this->status = $a_status;
90 $this->tracking_enabled = (bool) $a_enable;
107 $status = $ilias->getSetting(
"enable_tracking");
124 $status = $ilias->getSetting(
"enable_tracking");
134 $this->tracking_user_related = (bool) $a_enable;
139 return $this->tracking_user_related ?
true :
false;
149 return (
boolean) $ilSetting->get(
'save_user_related_data');
154 $this->valid_time = (int) $a_time_span;
161 return (
int) $this->valid_time;
168 return (
int) $ilias->getSetting(
"tracking_time_span",DEFAULT_TIME_SPAN);
180 $this->is_change_event_tracking_enabled = $newValue;
202 require_once
'Services/Tracking/classes/class.ilChangeEvent.php';
205 if ($this->is_change_event_tracking_enabled)
238 $q =
"SELECT count(*) AS cnt FROM ut_access";
239 $cnt_set = $ilDB->query($q);
243 return $cnt_rec[
"cnt"];
253 $q =
"SELECT count(*) as cnt, count(distinct user_id) as user_cnt, date_format(acc_time,'%Y-%m') AS month FROM ut_access".
254 " GROUP BY month ORDER BY month DESC";
255 $min_set = $ilDB->query($q);
259 $months[] = array(
"month" => $min_rec[
"month"],
260 "cnt" => $min_rec[
"cnt"],
"user_cnt" => $min_rec[
"user_cnt"]);
272 $q =
"SELECT count(*) as cnt, date_add('$a_month-01', INTERVAL 1 MONTH) as d FROM ut_access WHERE acc_time <= ".
273 "date_add('$a_month-01', INTERVAL 1 MONTH)";
275 $cnt_set = $ilDB->query($q);
279 return $cnt_rec[
"cnt"];
289 $q =
"SELECT count(*) as cnt, user_id FROM ut_access "
290 .($a_searchTermsCondition !=
"" ? $a_searchTermsCondition :
" WHERE ")
293 .
" GROUP BY user_id";
295 $cnt_set = $ilDB->query($q);
302 if ($cnt_rec[
"user_id"] != 0)
304 $acc[] = array(
"user_id" => $cnt_rec[
"user_id"],
305 "name" => $name[
"lastname"].
", ".$name[
"firstname"],
306 "cnt" => $cnt_rec[
"cnt"]);
318 $q =
"SELECT count(acc_obj_id) AS cnt, acc_obj_id FROM ut_access "
319 .($a_searchTermsCondition !=
"" ? $a_searchTermsCondition :
" WHERE ")
321 .
" GROUP BY acc_obj_id";
322 $cnt_set = $ilDB->query($q);
328 if ($cnt_rec[
"cnt"] !=
"")
331 $acc[] = array(
"id" => $cnt_rec[
"acc_obj_id"],
333 "author" => $this->
getOwnerName($cnt_rec[
"acc_obj_id"]),
334 "duration" => $this->
getDuration($cnt_rec[
"acc_obj_id"]),
335 "cnt" => $cnt_rec[
"cnt"]);
344 $q =
"SELECT AVG(spent_seconds) FROM read_event"
345 .
" WHERE obj_id = " . $ilDB->quote($a_obj_id)
347 $res = $ilDB->query($q);
349 return $data[
"spent_seconds"];
359 $q =
"SELECT id, user_id,client_ip,acc_obj_id,language ,acc_time FROM ut_access "
360 .($a_searchTermsCondition !=
"" ? $a_searchTermsCondition :
" WHERE ")
365 $cnt_set = $ilDB->query($q);
371 if ($cnt_rec[
"user_id"] != 0)
373 $acc[] = array(
"user_id" => $cnt_rec[
"user_id"],
374 "name" => $name[
"lastname"].
", ".$name[
"firstname"],
375 "client_ip" => $cnt_rec[
"client_ip"],
377 "language" => $cnt_rec[
"language"],
378 "acc_time" => $cnt_rec[
"acc_time"]
392 $q =
"DELETE FROM ut_access WHERE acc_time <= ".
393 "date_add('$a_month-01', INTERVAL 1 MONTH)";
406 $q =
"SELECT distinct A.obj_id,A.type,A.title FROM object_data as A,object_data as B WHERE A.type = ".
407 $ilDB->quote($a_type).
" AND A.obj_id = B.owner AND B.type=".$ilDB->quote(
$type);
409 $author = $ilDB->query($q);
413 $all[] = array(
"title" => $aauthor[
"title"],
414 "obj_id" =>$aauthor[
"obj_id"]);
426 $q =
"SELECT title,obj_id FROM object_data WHERE owner = ".$ilDB->quote(
$id).
" and type=".$ilDB->quote(
$type);
428 $lms = $ilDB->query($q);
432 $all[] = array(
"title" => $alms[
"title"],
433 "obj_id" =>$alms[
"obj_id"]);
445 $q =
"SELECT obj_id FROM object_data WHERE type = ".$ilDB->quote(
$type).
" and title=".$ilDB->quote(
$title);
446 $id = $ilDB->query($q);
448 return $obj_id[
"obj_id"];
456 $q =
"select obj_id from object_data "
457 .
" where type = 'tst' and "
459 $res = $this->ilias->db->query($q);
460 for ($i=0;$i<
$res->numRows();$i++)
472 $q =
"SELECT count(*) from ut_access "
475 $res = $this->ilias->db->query($q);
485 $q =
" select A.login from usr_data as A, object_data as B where A.usr_id=B.owner and B.obj_id = ".$id;
486 $res = $this->ilias->db->query($q);
496 #$this->enableTracking($ilias->getSetting("enable_tracking",0));
499 $this->
setValidTimeSpan($ilias->getSetting(
"tracking_time_span",DEFAULT_TIME_SPAN));
502 require_once
'Services/Tracking/classes/class.ilChangeEvent.php';
513 $query =
"DELETE FROM ut_access WHERE user_id = '".$a_usr_id.
"'";
514 $ilDB->query($query);
516 $query =
"DELETE FROM read_event WHERE usr_id = '".$a_usr_id.
"'";
517 $ilDB->query($query);
519 $query =
"DELETE FROM write_event WHERE usr_id = '".$a_usr_id.
"'";
520 $ilDB->query($query);
522 $query =
"DELETE FROM ut_lp_filter WHERE usr_id = '".$a_usr_id.
"'";
523 $ilDB->query($query);
525 $query =
"DELETE FROM ut_lp_marks WHERE usr_id = '".$a_usr_id.
"'";
526 $ilDB->query($query);
528 $query =
"DELETE FROM ut_online WHERE usr_id = '".$a_usr_id.
"'";
529 $ilDB->query($query);