3 declare(strict_types=0);
    24         $ilDB = $DIC->database();
    26             'SELECT online_time FROM ut_online WHERE usr_id = ' . 
$ilDB->quote(
    32             return (
int) $row[
'online_time'];
    37     public static function addUser(
int $a_user_id): bool
    41         $ilDB = $DIC->database();
    43             'SELECT access_time FROM ut_online WHERE usr_id = ' . 
$ilDB->quote(
    50             self::$last_access_time = (
int) $row[
'access_time'];
    55             'INSERT INTO ut_online (usr_id, access_time) VALUES (%s, %s)',
    56             array(
'integer', 
'integer'),
    57             array($a_user_id, time())
    59         self::$last_access_time = time();
    67         $ilDB = $DIC->database();
    70         if (null === self::$last_access_time) {
    71             $query = 
'SELECT access_time FROM ut_online WHERE usr_id = ' . 
$ilDB->quote(
    80             self::$last_access_time = (
int) $row[
'access_time'];
    83         $time_span = (
int) 
$ilSetting->get(
'tracking_time_span', 
'300');
    84         if (($diff = time() - self::$last_access_time) <= $time_span) {
    86                 'UPDATE ut_online SET online_time = online_time + %s, access_time = %s WHERE usr_id = %s',
    87                 array(
'integer', 
'integer', 
'integer'),
    88                 array($diff, time(), $user->
getId())
    92                 'UPDATE ut_online SET access_time = %s WHERE usr_id = %s',
    93                 array(
'integer', 
'integer'),
    94                 array(time(), $user->
getId())
 
static updateAccess(ilObjUser $user)
 
static int $last_access_time
This static variable is used to prevent two database request (addUser and updateAccess) on login...
 
static addUser(int $a_user_id)
 
static getOnlineTime(int $a_user_id)