ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSessionReminderGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
11
13 protected $page;
14
16 protected $lng;
17
23 public function __construct(
26 \ilLanguage $language
27 ) {
28 $this->sessionReminder = $sessionReminder;
29 $this->page = $page;
30 $this->lng = $language;
31 }
32
36 public function populatePage() : void
37 {
38 if (!$this->sessionReminder->isActive()) {
39 return;
40 }
41
42 iljQueryUtil::initjQuery($this->page);
43 ilYuiUtil::initCookie();
44
45 $this->page->addJavaScript('./Services/Authentication/js/session_reminder.js');
46
47 $url = './sessioncheck.php?client_id=' . CLIENT_ID . '&lang=' . $this->lng->getLangKey();
48 $devMode = defined('DEVMODE') && DEVMODE ? 1 : 0;
49 $clientId = defined('CLIENT_ID') ? CLIENT_ID : '';
50 $sessionId = session_id();
51 $sessionHash = md5($sessionId);
52
53 $javascript = <<<JS
54(function($) {
55 $("body").ilSessionReminder({
56 url: "$url",
57 client_id: "$clientId",
58 hash: "$sessionHash",
59 frequency: 60,
60 debug: $devMode
61 });
62})(jQuery);
63JS;
64
65 $this->page->addOnLoadCode($javascript);
66 }
67}
An exception for terminatinating execution or to throw for unit testing.
language handling
__construct(ilSessionReminder $sessionReminder, ilGlobalTemplateInterface $page, \ilLanguage $language)
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
const CLIENT_ID
Definition: constants.php:39
$url