ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ContextRepository.php
Go to the documentation of this file.
2
4
14{
15
19 private $contexts = [];
20 const C_MAIN = 'main';
21 const C_DESKTOP = 'desktop';
22 const C_REPO = 'repo';
23 const C_ADMINISTRATION = 'administration';
24 const C_LTI = 'lti';
25
26
30 public function main() : ScreenContext
31 {
32 return $this->get(BasicScreenContext::class, self::C_MAIN);
33 }
34
35
39 public function internal() : ScreenContext
40 {
41 return $this->get(BasicScreenContext::class, 'internal');
42 }
43
44
48 public function external() : ScreenContext
49 {
50 return $this->get(BasicScreenContext::class, 'external');
51 }
52
53
57 public function desktop() : ScreenContext
58 {
59 return $this->get(BasicScreenContext::class, self::C_DESKTOP);
60 }
61
62
66 public function repository() : ScreenContext
67 {
68 $context = $this->get(BasicScreenContext::class, self::C_REPO);
69 $context = $context->withReferenceId(new ReferenceId((int) ($_GET['ref_id'] ?? 0)));
70
71 return $context;
72 }
73
74
78 public function administration() : ScreenContext
79 {
80 return $this->get(BasicScreenContext::class, self::C_ADMINISTRATION);
81 }
82
83
87 public function lti() : ScreenContext
88 {
89 return $this->get(BasicScreenContext::class, self::C_LTI);
90 }
91
92
99 private function get(string $class_name, string $identifier)
100 {
101 if (!isset($this->contexts[$identifier])) {
102 $this->contexts[$identifier] = new $class_name($identifier);
103 }
104
105 return $this->contexts[$identifier];
106 }
107}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
$context
Definition: webdav.php:26