ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
trait.GlobalDICGUIServices.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Repository;
22
24use ILIAS\HTTP;
29use Slim\Http\Stream;
39
44{
45 private \ILIAS\DI\Container $DIC;
46
47 protected function initGUIServices(\ILIAS\DI\Container $DIC): void
48 {
49 $this->DIC = $DIC;
51 }
52
53 public function ui(): UIServices
54 {
55 return $this->DIC->ui();
56 }
57
58 public function object(): \ilObjectService
59 {
60 return $this->DIC->object();
61 }
62
63 public function ctrl(): \ilCtrl
64 {
65 return $this->DIC->ctrl();
66 }
67
68 public function http(): HTTP\Services
69 {
70 return $this->DIC->http();
71 }
72
73 public function httpUtil(): HTTPUtil
74 {
75 return new HTTPUtil($this->DIC->http());
76 }
77
78 public function html(): HTMLUtil
79 {
80 return new HTMLUtil();
81 }
82
84 {
85 return $this->DIC->ui()->mainTemplate();
86 }
87
88 public function initFetch(): void
89 {
90 $main_tpl = $this->mainTemplate();
91 $main_tpl->addJavaScript("assets/js/repository.js");
92 }
93
94 public function clearAsnyOnloadCode(): void
95 {
96 $this->ui()->renderer()->renderAsync(
97 $this->ui()->factory()->legacy()->content("")
98 );
99 }
100
101 public function upload(): FileUpload
102 {
103 return $this->DIC->upload();
104 }
105
106 public function toolbar(): \ilToolbarGUI
107 {
108 return $this->DIC->toolbar();
109 }
110
112 {
113 return $this->DIC->globalScreen();
114 }
115
116 public function help(): \ilHelpGUI
117 {
118 return $this->DIC->help();
119 }
120
121 public function tabs(): \ilTabsGUI
122 {
123 return $this->DIC->tabs();
124 }
125
126 public function locator(): \ilLocatorGUI
127 {
128 return $this->DIC["ilLocator"];
129 }
130
132 {
133 return $this->DIC["ilNavigationHistory"];
134 }
135
139 public function form(
140 $class_path,
141 string $cmd,
142 string $submit_caption = ""
143 ): FormAdapterGUI {
145 $class_path,
146 $cmd,
147 $submit_caption
148 );
149 }
150
151 public function modal(
152 string $title = "",
153 string $cancel_label = ""
154 ): ModalAdapterGUI {
156 $title,
157 $cancel_label,
158 $this->httpUtil()
159 );
160 }
161
165 public function send(string $output): void
166 {
167 $http = $this->http();
168 $http->saveResponse($http->response()->withBody(
169 Streams::ofString($output)
170 ));
171 $http->sendResponse();
172 $http->close();
173 }
174
178 public function filter(
179 string $filter_id,
180 $class_path,
181 string $cmd,
182 bool $activated = true,
183 bool $expanded = true
186 $filter_id,
187 $class_path,
188 $cmd,
189 $activated,
190 $expanded
191 );
192 }
193
194 public function button(
195 string $caption,
196 string $cmd
199 $caption,
200 $cmd
201 );
202 }
203
204 public function link(
205 string $caption,
206 string $href,
207 bool $new_viewport = false
208 ): LinkAdapterGUI {
210 $caption,
211 $href,
212 $new_viewport
213 );
214 }
215
216 public function symbol(
219 );
220 }
221
222 public function listing(
225 );
226 }
227
228 public function profile(): ProfileGUI
229 {
230 return new ProfileGUI(
231 $this->DIC->repository()->internal()->domain()->profile(),
232 $this->ui()->factory()
233 );
234 }
235}
factory()
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Definition: Streams.php:32
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
Class ilCtrl provides processing control methods.
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Last visited history for repository items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$http
Definition: deliver.php:30
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class HTTPServicesTest.
@noinspection PhpIncompatibleReturnTypeInspection
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd, string $submit_caption="")
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
modal(string $title="", string $cancel_label="")
button(string $caption, string $cmd)
initGUIServices(\ILIAS\DI\Container $DIC)
link(string $caption, string $href, bool $new_viewport=false)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26
catch(ilCmiXapiException $e) send($response)
Definition: xapitoken.php:100