25 public static function getOnlineTime($a_user_id)
32 $res = $ilDB->query(
'SELECT online_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($a_user_id,
'integer'));
33 while(
$row = $ilDB->fetchAssoc(
$res))
35 return (
int)
$row[
'online_time'];
47 public static function addUser($a_user_id)
54 $res = $ilDB->query(
'SELECT access_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($a_user_id,
'integer'));
55 if($ilDB->numRows(
$res))
58 self::$last_access_time = (int)
$row[
'access_time'];
63 'INSERT INTO ut_online (usr_id, access_time) VALUES (%s, %s)',
64 array(
'integer',
'integer'),
67 self::$last_access_time =
time();
78 public static function updateAccess(
ilObjUser $user)
86 if(null === self::$last_access_time)
88 $query =
'SELECT access_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($user->
getId(),
'integer');
90 if(!$ilDB->numRows(
$res))
95 self::$last_access_time =
$row[
'access_time'];
98 $time_span = (int)$ilSetting->get(
'tracking_time_span', 300);
99 if(($diff =
time() - self::$last_access_time) <= $time_span)
102 'UPDATE ut_online SET online_time = online_time + %s, access_time = %s WHERE usr_id = %s',
103 array(
'integer',
'integer',
'integer'),
110 'UPDATE ut_online SET access_time = %s WHERE usr_id = %s',
111 array(
'integer',
'integer'),
getId()
get object id public
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.