25 $res = $ilDB->query(
"SELECT * FROM ut_online WHERE usr_id = ".
26 $ilDB->quote($a_user_id,
"integer"));
27 while (
$row = $ilDB->fetchObject(
$res))
29 $access_time =
$row->access_time;
30 $online_time =
$row->online_time;
32 return (
int) $online_time;
46 $res = $ilDB->query(
"SELECT * FROM ut_online WHERE usr_id = ".
47 $ilDB->quote($a_user_id,
"integer"));
54 $ilDB->manipulate(sprintf(
"INSERT INTO ut_online (usr_id, access_time) VALUES (%s,%s)",
55 $ilDB->quote($a_user_id,
"integer"),
56 $ilDB->quote(time(),
"integer")));
70 $query =
"SELECT * FROM ut_online WHERE usr_id = ".
71 $ilDB->quote($a_usr_id,
'integer');
80 $access_time =
$row->access_time;
81 $online_time =
$row->online_time;
83 $time_span = (int) $ilias->getSetting(
"tracking_time_span",300);
85 if((
$diff = time() - $access_time) <= $time_span)
87 $ilDB->manipulate(sprintf(
"UPDATE ut_online SET online_time = online_time + %s, ".
88 "access_time = %s WHERE usr_id = %s",
89 $ilDB->quote(
$diff,
"integer"),
90 $ilDB->quote(time(),
"integer"),
91 $ilDB->quote($a_usr_id,
"integer")));
95 $ilDB->manipulate(sprintf(
"UPDATE ut_online SET ".
96 "access_time = %s WHERE usr_id = %s",
97 $ilDB->quote(time(),
"integer"),
98 $ilDB->quote($a_usr_id,
"integer")));