|
static int | $last_access_time = null |
| This static variable is used to prevent two database request (addUser and updateAccess) on login. More...
|
|
Definition at line 27 of file class.ilOnlineTracking.php.
◆ addUser()
static ilOnlineTracking::addUser |
( |
int |
$a_user_id | ) |
|
|
static |
Definition at line 51 of file class.ilOnlineTracking.php.
51 : bool
52 {
54
57 'SELECT access_time FROM ut_online WHERE usr_id = ' .
$ilDB->quote(
58 $a_user_id,
59 'integer'
60 )
61 );
64 self::$last_access_time = (
int) $row[
'access_time'];
65 return false;
66 }
67
69 'INSERT INTO ut_online (usr_id, access_time) VALUES (%s, %s)',
70 array('integer', 'integer'),
71 array($a_user_id, time())
72 );
73 self::$last_access_time = time();
74 return true;
75 }
References $DIC, $ilDB, $res, and ILIAS\Repository\int().
Referenced by ilAuthFrontend\handleAuthenticationSuccess().
◆ getOnlineTime()
static ilOnlineTracking::getOnlineTime |
( |
int |
$a_user_id | ) |
|
|
static |
Definition at line 34 of file class.ilOnlineTracking.php.
34 : int
35 {
37
40 'SELECT online_time FROM ut_online WHERE usr_id = ' .
$ilDB->quote(
41 $a_user_id,
42 'integer'
43 )
44 );
46 return (int) $row['online_time'];
47 }
48 return 0;
49 }
References $DIC, $ilDB, and $res.
◆ updateAccess()
static ilOnlineTracking::updateAccess |
( |
ilObjUser |
$user | ) |
|
|
static |
Definition at line 77 of file class.ilOnlineTracking.php.
77 : bool
78 {
80
83
84 if (null === self::$last_access_time) {
85 $query =
'SELECT access_time FROM ut_online WHERE usr_id = ' .
$ilDB->quote(
87 'integer'
88 );
91 return false;
92 }
94 self::$last_access_time = (
int) $row[
'access_time'];
95 }
96
97 $time_span = (
int)
$ilSetting->get(
'tracking_time_span',
'300');
100 'UPDATE ut_online SET online_time = online_time + %s, access_time = %s WHERE usr_id = %s',
101 array('integer', 'integer', 'integer'),
102 array($diff, time(), $user->
getId())
103 );
104 } else {
106 'UPDATE ut_online SET access_time = %s WHERE usr_id = %s',
107 array('integer', 'integer'),
108 array(time(), $user->
getId())
109 );
110 }
111 return true;
112 }
static int $last_access_time
This static variable is used to prevent two database request (addUser and updateAccess) on login.
References $DIC, $ilDB, $ilSetting, $last_access_time, $res, ilObject\getId(), and ILIAS\Repository\int().
Referenced by ilInitialisation\initUserAccount().
◆ $last_access_time
int ilOnlineTracking::$last_access_time = null |
|
staticprotected |
The documentation for this class was generated from the following file: