15 public function getJsonResponse($sessionId)
25 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
27 $response = array(
'remind' =>
false);
29 $res = $ilDB->queryF(
'
30 SELECT expires, user_id, data
32 WHERE session_id = %s',
37 $num = $ilDB->numRows(
$res);
41 $response[
'message'] =
'The determined session data is not unique.';
47 $response[
'message'] =
'ILIAS could not determine the session data.';
51 $data = $ilDB->fetchAssoc(
$res);
54 $response[
'message'] =
'ILIAS could not fetch the session data or the corresponding user is no more authenticated.';
60 foreach((array)$session as $key => $entry)
62 if(strpos($key,
'_auth__') === 0)
64 $idletime = $entry[
'idle'];
69 if(null === $idletime)
71 $response[
'message'] =
'ILIAS could not determine the idle time from the session data.';
78 $response[
'message'] =
'The session is already expired. The client should have received a remind command before.';
87 include_once
'./Services/Authentication/classes/class.ilSessionReminder.php';
89 if($remind_time > time())
92 $response[
'message'] =
'Lead time not reached, yet. Current time: ' . date(
'Y-m-d H:i:s', time()) .
', Reminder time: ' . date(
'Y-m-d H:i:s', $remind_time);
97 switch($ilUser->getTimeFormat())
100 $formatted_expiration_time = $dateTime->get(
IL_CAL_FKT_DATE,
'g:ia', $ilUser->getTimeZone());
105 $formatted_expiration_time = $dateTime->get(
IL_CAL_FKT_DATE,
'H:i', $ilUser->getTimeZone());
110 'extend_url' =>
'./ilias.php?baseClass=ilPersonalDesktopGUI',
111 'txt' => str_replace(
"\\n",
'%0A', sprintf($lng->txt(
'session_reminder_alert'),
ilFormat::_secondsToString($expiretime - time()), $formatted_expiration_time, $ilClientIniFile->readVariable(
'client',
'name') .
' | ' .
ilUtil::_getHttpPath())),
124 return $expiretime < time();
133 return is_array($data) && isset($data[
'user_id']) && $data[
'user_id'] > 0 && $data[
'user_id'] != ANONYMOUS_USER_ID;