ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
$message
Definition: xapiexit.php:31

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 }

References $message.

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 205 of file Output.php.

205 : Icon|Image
206 {
207 if ($as_image) {
208 return $this->ui_factory->image()->standard(
209 'assets/images/standard/icon_unchecked.svg',
210 ''
211 );
212 }
213
214 return $this->ui_factory->symbol()->icon()->custom(
215 'assets/images/standard/icon_unchecked.svg',
216 '',
217 'small'
218 );
219 }

◆ ok()

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

Definition at line 221 of file Output.php.

221 : Icon|Image
222 {
223 if ($as_image) {
224 return $this->ui_factory->image()->standard(
225 'assets/images/standard/icon_checked.svg',
226 ''
227 );
228 }
229
230 return $this->ui_factory->symbol()->icon()->custom(
231 'assets/images/standard/icon_checked.svg',
232 '',
233 'small'
234 );
235 }

◆ out()

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

Definition at line 188 of file Output.php.

188 : void
189 {
190 $this->tabs->show();
191 $components = array_filter($components, fn($component): bool => $component !== null);
192
193 $this->main_tpl->setContent(
194 $this->ui_renderer->render($components)
195 );
196 }
$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 168 of file Output.php.

168 : void
169 {
170 $components = array_filter($components, fn($component): bool => $component !== null);
171 $string = $this->ui_renderer->renderAsync($components);
172 $response = $this->http->response()->withBody(
174 $string
175 )
176 );
177 $this->http->saveResponse($response);
178 $this->http->sendResponse();
179 $this->http->close();
180 }
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:93

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->ui_factory->modal()->interruptive(
109 $title,
110 $message,
111 $post_url
112 )->withAffectedItems(
114 )->withActionButtonLabel($button_text);
115
116 $this->outAsync($modal);
117 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
outAsync(?Component ... $components)
Definition: Output.php:168

◆ outAsyncAsModal()

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

Definition at line 119 of file Output.php.

123 : void {
124 if ($post_url instanceof URI) {
125 $post_url = (string) $post_url;
126 }
127
128 $is_form = count($components) === 1 && $components[0] instanceof Form;
129 $are_interruptive = array_filter(
131 fn($component): bool => $component instanceof InterruptiveItem
132 ) !== [];
133
134 $modal = match (true) {
135 $is_form => $this->ui_factory->modal()->roundtrip(
136 $title,
137 null,
139 $post_url
140 ),
141 $are_interruptive => $this->ui_factory->modal()->interruptive(
142 $title,
143 $this->translator->translate('confirm_delete'),
144 $post_url
145 )->withAffectedItems(
147 // array_map(
148 // fn(KeyValue $item): \ILIAS\UI\Component\Modal\InterruptiveItem\KeyValue => $this->ui_factory->modal(
149 // )->interruptiveItem()->keyValue(
150 // $this->hash($item->getId()),
151 // $item->getKey(),
152 // $item->getValue()
153 // ),
154 // $components
155 // )
156 ),
157 default => $this->ui_factory->modal()->roundtrip(
158 $title,
160 [],
161 $post_url
162 )
163 };
164
165 $this->outAsync($modal);
166 }

◆ outString()

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

Definition at line 182 of file Output.php.

182 : void
183 {
184 $this->tabs->show();
185 $this->main_tpl->setContent($string);
186 }

References ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ render()

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

Definition at line 198 of file Output.php.

198 : string
199 {
200 $components = array_filter($components, fn($component): bool => $component !== null);
201
202 return $this->ui_renderer->render($components);
203 }

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: