ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\GlobalScreen\Client\ModeToggle Class Reference

Class ModeToggle This is just for testing!!! And will be removed after. More...

+ Collaboration diagram for ILIAS\GlobalScreen\Client\ModeToggle:

Public Member Functions

 __construct ()
 
 getMode ()
 
 saveStateOfAll ()
 
 toggle ()
 

Data Fields

const GS_MODE = 'gs_mode'
 
const MODE1 = "all"
 
const MODE2 = "none"
 

Protected Attributes

 $wrapper
 
 $refinery
 
 $ctrl
 
 $global_screen
 
 $http
 

Detailed Description

Class ModeToggle This is just for testing!!! And will be removed after.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 31 of file ModeToggle.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\Client\ModeToggle::__construct ( )

Definition at line 58 of file ModeToggle.php.

References $DIC, ILIAS\FileDelivery\http(), and ilInitialisation\initILIAS().

59  {
61  global $DIC;
62  $this->ctrl = $DIC->ctrl();
63  $this->wrapper = $DIC->http()->wrapper();
64  $this->http = $DIC->http();
65  $this->refinery = $DIC->refinery();
66  $this->global_screen = $DIC->globalScreen();
67  }
static initILIAS()
ilias initialisation
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

Member Function Documentation

◆ getMode()

ILIAS\GlobalScreen\Client\ModeToggle::getMode ( )

Definition at line 69 of file ModeToggle.php.

Referenced by ILIAS\GlobalScreen\Client\ModeToggle\saveStateOfAll(), and ILIAS\GlobalScreen\Client\ModeToggle\toggle().

69  : string
70  {
71  return $this->wrapper->cookie()->has(self::GS_MODE)
72  ? $this->wrapper->cookie()->retrieve(self::GS_MODE, $this->refinery->to()->string())
73  : self::MODE1;
74  }
+ Here is the caller graph for this function:

◆ saveStateOfAll()

ILIAS\GlobalScreen\Client\ModeToggle::saveStateOfAll ( )

Definition at line 76 of file ModeToggle.php.

References ILIAS\GlobalScreen\Client\ModeToggle\getMode(), and ILIAS\GlobalScreen\Client\ItemState\LEVEL_OF_TOOL.

76  : bool
77  {
78  return $this->getMode() == ItemState::LEVEL_OF_TOOL;
79  }
+ Here is the call graph for this function:

◆ toggle()

ILIAS\GlobalScreen\Client\ModeToggle::toggle ( )

Definition at line 81 of file ModeToggle.php.

References $_SERVER, ILIAS\GlobalScreen\Client\ModeToggle\getMode(), and ILIAS\FileDelivery\http().

81  : void
82  {
83  $current_mode = $this->getMode();
84  $new_mode = $current_mode == self::MODE1 ? self::MODE2 : self::MODE1;
85  $cookie_factory = new CookieFactoryImpl();
86  $cookie = $cookie_factory->create(self::GS_MODE, $new_mode)
87  ->withExpires(time() + 3600);
88  $this->http->cookieJar()->with($cookie);
89  header('Location: ' . $_SERVER['HTTP_REFERER']);
90  }
static http()
Fetches the global http state from ILIAS.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ILIAS\GlobalScreen\Client\ModeToggle::$ctrl
protected

Definition at line 48 of file ModeToggle.php.

◆ $global_screen

ILIAS\GlobalScreen\Client\ModeToggle::$global_screen
protected

Definition at line 52 of file ModeToggle.php.

◆ $http

ILIAS\GlobalScreen\Client\ModeToggle::$http
protected

Definition at line 56 of file ModeToggle.php.

◆ $refinery

ILIAS\GlobalScreen\Client\ModeToggle::$refinery
protected

Definition at line 44 of file ModeToggle.php.

◆ $wrapper

ILIAS\GlobalScreen\Client\ModeToggle::$wrapper
protected

Definition at line 40 of file ModeToggle.php.

◆ GS_MODE

const ILIAS\GlobalScreen\Client\ModeToggle::GS_MODE = 'gs_mode'

Definition at line 33 of file ModeToggle.php.

◆ MODE1

const ILIAS\GlobalScreen\Client\ModeToggle::MODE1 = "all"

Definition at line 34 of file ModeToggle.php.

◆ MODE2

const ILIAS\GlobalScreen\Client\ModeToggle::MODE2 = "none"

Definition at line 35 of file ModeToggle.php.


The documentation for this class was generated from the following file: