ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ModeSessionRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ilSession;
24
30{
31 protected const KEY = "cont_view";
32 protected const VIEW_ADMIN = "admin";
33 protected const VIEW_CONTENT = "content";
34
35 public function __construct()
36 {
37 }
38
39 public function setAdminMode(): void
40 {
41 ilSession::set(self::KEY, self::VIEW_ADMIN);
42 }
43
44 public function setContentMode(): void
45 {
46 ilSession::clear(self::KEY);
47 }
48
49 public function isAdminMode(): bool
50 {
51 if (ilSession::has(self::KEY)) {
52 return (ilSession::get(self::KEY) === self::VIEW_ADMIN);
53 }
54 return false;
55 }
56
57 public function isContentMode(): bool
58 {
59 return !ilSession::has(self::KEY);
60 }
61}
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static has($a_var)