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'));
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'));
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'),
65 array($a_user_id, time())
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');
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'),
104 array($diff, time(), $user->
getId())
110 'UPDATE ut_online SET access_time = %s WHERE usr_id = %s',
111 array(
'integer',
'integer'),
112 array(time(), $user->
getId())
An exception for terminatinating execution or to throw for unit testing.
getId()
get object id @access public