26         public static function getOnlineTime($a_user_id)
 
   33                 $res = $ilDB->query(
'SELECT online_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($a_user_id, 
'integer'));
 
   34                 while(
$row = $ilDB->fetchAssoc(
$res))
 
   36                         return (
int)
$row[
'online_time'];
 
   48         public static function addUser($a_user_id)
 
   55                 $res = $ilDB->query(
'SELECT access_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($a_user_id, 
'integer'));
 
   56                 if($ilDB->numRows(
$res))
 
   59                         self::$last_access_time = (int)
$row[
'access_time'];
 
   64                         'INSERT INTO ut_online (usr_id, access_time) VALUES (%s, %s)',
 
   65                         array(
'integer', 
'integer'),
 
   66                         array($a_user_id, time())
 
   68                 self::$last_access_time = time();
 
   79         public static function updateAccess(
ilObjUser $user)
 
   87                 if(null === self::$last_access_time)
 
   89                         $query = 
'SELECT access_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($user->
getId(), 
'integer');
 
   91                         if(!$ilDB->numRows(
$res))
 
   96                         self::$last_access_time = 
$row[
'access_time'];
 
   99                 $time_span = (int)$ilSetting->get(
'tracking_time_span', 300);
 
  100                 if(($diff = time() - self::$last_access_time) <= $time_span)
 
  103                                 'UPDATE ut_online SET online_time = online_time + %s, access_time = %s WHERE usr_id = %s',
 
  104                                 array(
'integer', 
'integer', 
'integer'),
 
  105                                 array($diff, time(), $user->
getId())
 
  111                                 'UPDATE ut_online SET access_time = %s WHERE usr_id = %s',
 
  112                                 array(
'integer', 
'integer'),
 
  113                                 array(time(), $user->
getId())