ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ModeToggle.php
Go to the documentation of this file.
1<?php
2
4
13{
14 const GS_MODE = 'gs_mode';
15 const MODE1 = "all";
16 const MODE2 = "none";
17
18
19 public function getMode() : string
20 {
21 return isset($_COOKIE[self::GS_MODE]) ? $_COOKIE[self::GS_MODE] : self::MODE1;
22 }
23
24
25 public function saveStateOfAll() : bool
26 {
27 return $this->getMode() == ItemState::LEVEL_OF_TOOL;
28 }
29
30
31 public function toggle() : void
32 {
33 $current_mode = $this->getMode();
34 $new_mode = $current_mode == self::MODE1 ? self::MODE2 : self::MODE1;
35 setcookie(self::GS_MODE, $new_mode, 0, "/");
37 header('Location: ' . $_SERVER['HTTP_REFERER']);
38 }
39}
An exception for terminatinating execution or to throw for unit testing.
Entry Point for Async calls from the Notification Center.
Definition: gs_content.php:1
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$_COOKIE[session_name()]
Definition: xapitoken.php:39