ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
trait.GlobalDICGUIServices.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Repository;
22 
24 use ILIAS\HTTP;
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 
111  public function globalScreen(): GlobalScreen\Services
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 {
144  return new 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 {
155  return new 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
184  ): FilterAdapterGUI {
185  return new FilterAdapterGUI(
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
197  ): ButtonAdapterGUI {
198  return new ButtonAdapterGUI(
199  $caption,
200  $cmd
201  );
202  }
203 
204  public function link(
205  string $caption,
206  string $href,
207  bool $new_viewport = false
208  ): LinkAdapterGUI {
209  return new LinkAdapterGUI(
210  $caption,
211  $href,
212  $new_viewport
213  );
214  }
215 
216  public function symbol(
217  ): SymbolAdapterGUI {
218  return new SymbolAdapterGUI(
219  );
220  }
221 
222  public function listing(
223  ): ListingAdapterGUI {
224  return new ListingAdapterGUI(
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
button(string $caption, string $cmd)
PhpIncompatibleReturnTypeInspection
initGUIServices(\ILIAS\DI\Container $DIC)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
factory()
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$http
Definition: deliver.php:30
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
Class HTTPServicesTest.
global $DIC
Definition: shib_login.php:26
legacy()
expected output: > ILIAS shows the rendered Component.
Definition: legacy.php:29
Class FileUpload.
Definition: FileUpload.php:37
Last visited history for repository items.
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
form( $class_path, string $cmd, string $submit_caption="")
modal(string $title="", string $cancel_label="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
link(string $caption, string $href, bool $new_viewport=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)