ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\GlobalScreen\GUI\Output\Output Class Reference
+ Collaboration diagram for ILIAS\GlobalScreen\GUI\Output\Output:

Public Member Functions

 __construct (private UIServices $ui_services, private Services $http, private Translator $translator, private Tabs $tabs, private \ilToolbarGUI $toolbar,)
 
 response ()
 
 ui ()
 
 toolbar ()
 
 success (string $message, bool $keep=true)
 
 info (string $message, bool $keep=true)
 
 error (string $message, bool $keep=true)
 
 message (string $type, string $message, bool $keep=true)
 
 outAsyncAsConfirmation (string $title, string $message, string $button_text, URI|string $post_url, InterruptiveItem ... $components)
 
 outAsyncAsModal (string $title, URI|string $post_url, ?Component ... $components)
 
 outAsync (?Component ... $components)
 
 outString (string $string)
 
 out (?Component ... $components)
 
 render (?Component ... $components)
 
 nok (bool $as_image=false)
 
 ok (bool $as_image=false)
 

Private Attributes

Factory $ui_factory
 
Renderer $ui_renderer
 
ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 43 of file Output.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\GUI\Output\Output::__construct ( private UIServices  $ui_services,
private Services  $http,
private Translator  $translator,
private Tabs  $tabs,
private \ilToolbarGUI  $toolbar 
)

Definition at line 51 of file Output.php.

57 {
58 $this->ui_factory = $this->ui_services->factory();
59 $this->ui_renderer = $this->ui_services->renderer();
60 $this->main_tpl = $this->ui_services->mainTemplate();
61 }

Member Function Documentation

◆ error()

ILIAS\GlobalScreen\GUI\Output\Output::error ( string  $message,
bool  $keep = true 
)

Definition at line 88 of file Output.php.

88 : void
89 {
90 $this->message('failure', $message, $keep);
91 }
message(string $type, string $message, bool $keep=true)
Definition: Output.php:93

References ILIAS\GlobalScreen\GUI\Output\Output\message().

+ Here is the call graph for this function:

◆ info()

ILIAS\GlobalScreen\GUI\Output\Output::info ( string  $message,
bool  $keep = true 
)

Definition at line 83 of file Output.php.

83 : void
84 {
85 $this->message('info', $message, $keep);
86 }

References ILIAS\GlobalScreen\GUI\Output\Output\message().

+ Here is the call graph for this function:

◆ message()

ILIAS\GlobalScreen\GUI\Output\Output::message ( string  $type,
string  $message,
bool  $keep = true 
)

Definition at line 93 of file Output.php.

93 : void
94 {
95 $this->main_tpl->setOnScreenMessage($type, $message, $keep);
96 }

Referenced by ILIAS\GlobalScreen\GUI\Output\Output\error(), ILIAS\GlobalScreen\GUI\Output\Output\info(), and ILIAS\GlobalScreen\GUI\Output\Output\success().

+ Here is the caller graph for this function:

◆ nok()

ILIAS\GlobalScreen\GUI\Output\Output::nok ( bool  $as_image = false)

Definition at line 211 of file Output.php.

211 : Icon|Image
212 {
213 if ($as_image) {
214 return $this->ui_factory->image()->standard(
215 'assets/images/standard/icon_unchecked.svg',
216 ''
217 );
218 }
219
220 return $this->ui_factory->symbol()->icon()->custom(
221 'assets/images/standard/icon_unchecked.svg',
222 '',
223 'small'
224 );
225 }

◆ ok()

ILIAS\GlobalScreen\GUI\Output\Output::ok ( bool  $as_image = false)

Definition at line 227 of file Output.php.

227 : Icon|Image
228 {
229 if ($as_image) {
230 return $this->ui_factory->image()->standard(
231 'assets/images/standard/icon_checked.svg',
232 ''
233 );
234 }
235
236 return $this->ui_factory->symbol()->icon()->custom(
237 'assets/images/standard/icon_checked.svg',
238 '',
239 'small'
240 );
241 }

◆ out()

ILIAS\GlobalScreen\GUI\Output\Output::out ( ?Component ...  $components)

Definition at line 194 of file Output.php.

194 : void
195 {
196 $this->tabs->show();
197 $components = array_filter($components, fn(?Component $component): bool => $component !== null);
198
199 $this->main_tpl->setContent(
200 $this->ui_renderer->render($components)
201 );
202 }
$components

References $components, and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ outAsync()

ILIAS\GlobalScreen\GUI\Output\Output::outAsync ( ?Component ...  $components)

Definition at line 174 of file Output.php.

174 : void
175 {
176 $components = array_filter($components, fn(?Component $component): bool => $component !== null);
177 $string = $this->ui_renderer->renderAsync($components);
178 $response = $this->http->response()->withBody(
180 $string
181 )
182 );
183 $this->http->saveResponse($response);
184 $this->http->sendResponse();
185 $this->http->close();
186 }
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
static http()
Fetches the global http state from ILIAS.
$response
Definition: xapitoken.php:90

References $components, $response, and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ outAsyncAsConfirmation()

ILIAS\GlobalScreen\GUI\Output\Output::outAsyncAsConfirmation ( string  $title,
string  $message,
string  $button_text,
URI|string  $post_url,
InterruptiveItem ...  $components 
)

Definition at line 98 of file Output.php.

104 : void {
105 if ($post_url instanceof URI) {
106 $post_url = (string) $post_url;
107 }
108 $modal = $this
109 ->ui_factory
110 ->modal()
111 ->interruptive(
112 $title,
113 $message,
114 $post_url
115 )
116 ->withAffectedItems(
118 )
119 ->withActionButtonLabel($button_text);
120
121 $this->outAsync($modal);
122 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
outAsync(?Component ... $components)
Definition: Output.php:174

◆ outAsyncAsModal()

ILIAS\GlobalScreen\GUI\Output\Output::outAsyncAsModal ( string  $title,
URI|string  $post_url,
?Component ...  $components 
)

Definition at line 124 of file Output.php.

128 : void {
129 if ($post_url instanceof URI) {
130 $post_url = (string) $post_url;
131 }
132
133 $is_form = count($components) === 1 && $components[0] instanceof Form;
134 $are_interruptive = array_filter(
136 fn(?Component $component): bool => $component instanceof InterruptiveItem
137 ) !== [];
138
139 $modal = match (true) {
140 $is_form => $this
141 ->ui_factory
142 ->modal()
143 ->roundtrip(
144 $title,
145 null,
147 $post_url
148 ),
149 $are_interruptive => $this
150 ->ui_factory
151 ->modal()
152 ->interruptive(
153 $title,
154 $this->translator->translate('confirm_delete'),
155 $post_url
156 )
157 ->withAffectedItems(
159 ),
160 default => $this
161 ->ui_factory
162 ->modal()
163 ->roundtrip(
164 $title,
166 [],
167 $post_url
168 )
169 };
170
171 $this->outAsync($modal);
172 }

◆ outString()

ILIAS\GlobalScreen\GUI\Output\Output::outString ( string  $string)

Definition at line 188 of file Output.php.

188 : void
189 {
190 $this->tabs->show();
191 $this->main_tpl->setContent($string);
192 }

References ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ render()

ILIAS\GlobalScreen\GUI\Output\Output::render ( ?Component ...  $components)

Definition at line 204 of file Output.php.

204 : string
205 {
206 $components = array_filter($components, fn(?Component $component): bool => $component !== null);
207
208 return $this->ui_renderer->render($components);
209 }

References $components.

◆ response()

ILIAS\GlobalScreen\GUI\Output\Output::response ( )

Definition at line 63 of file Output.php.

63 : ResponseInterface
64 {
65 return $this->http->response();
66 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ success()

ILIAS\GlobalScreen\GUI\Output\Output::success ( string  $message,
bool  $keep = true 
)

Definition at line 78 of file Output.php.

78 : void
79 {
80 $this->message('success', $message, $keep);
81 }

References ILIAS\GlobalScreen\GUI\Output\Output\message().

+ Here is the call graph for this function:

◆ toolbar()

ILIAS\GlobalScreen\GUI\Output\Output::toolbar ( )

Definition at line 73 of file Output.php.

74 {
75 return $this->toolbar;
76 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ ui()

ILIAS\GlobalScreen\GUI\Output\Output::ui ( )

Definition at line 68 of file Output.php.

69 {
70 return $this->ui_services;
71 }
Provides fluid interface to RBAC services.
Definition: UIServices.php:25

Field Documentation

◆ $main_tpl

ilGlobalTemplateInterface ILIAS\GlobalScreen\GUI\Output\Output::$main_tpl
private

Definition at line 49 of file Output.php.

◆ $ui_factory

Factory ILIAS\GlobalScreen\GUI\Output\Output::$ui_factory
private

Definition at line 47 of file Output.php.

◆ $ui_renderer

Renderer ILIAS\GlobalScreen\GUI\Output\Output::$ui_renderer
private

Definition at line 48 of file Output.php.


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