ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Factory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\UI\Implementation;
22 
23 use ILIAS\UI\Component as C;
24 use ILIAS\UI\Help;
25 
26 // TODO: This might cache the created factories.
28 
29 class Factory implements \ILIAS\UI\Factory
30 {
31  public function __construct(
32  protected C\Counter\Factory $counter_factory,
33  protected C\Button\Factory $button_factory,
34  protected C\Listing\Factory $listing_factory,
35  protected C\Image\Factory $image_factory,
36  protected C\Panel\Factory $panel_factory,
37  protected C\Modal\Factory $modal_factory,
38  protected C\Dropzone\Factory $dropzone_factory,
39  protected C\Popover\Factory $popover_factory,
40  protected C\Divider\Factory $divider_factory,
41  protected C\Link\Factory $link_factory,
42  protected C\Dropdown\Factory $dropdown_factory,
43  protected C\Item\Factory $item_factory,
44  protected C\ViewControl\Factory $viewcontrol_factory,
45  protected C\Chart\Factory $chart_factory,
46  protected C\Input\Factory $input_factory,
47  protected C\Table\Factory $table_factory,
48  protected C\MessageBox\Factory $messagebox_factory,
49  protected C\Card\Factory $card_factory,
50  protected C\Layout\Factory $layout_factory,
51  protected C\MainControls\Factory $maincontrols_factory,
52  protected C\Tree\Factory $tree_factory,
53  protected C\Menu\Factory $menu_factory,
54  protected C\Symbol\Factory $symbol_factory,
55  protected C\Toast\Factory $toast_factory,
56  protected C\Legacy\Factory $legacy_factory,
57  protected C\launcher\Factory $launcher_factory,
58  protected C\Entity\Factory $entity_factory
59  ) {
60  }
61 
65  public function counter(): C\Counter\Factory
66  {
67  return $this->counter_factory;
68  }
69 
73  public function button(): C\Button\Factory
74  {
75  return $this->button_factory;
76  }
77 
81  public function card(): C\Card\Factory
82  {
83  return $this->card_factory;
84  }
85 
89  public function deck(array $cards): C\Deck\Deck
90  {
91  return new Component\Deck\Deck($cards, C\Deck\Deck::SIZE_S);
92  }
93 
97  public function listing(): C\Listing\Factory
98  {
99  return $this->listing_factory;
100  }
101 
105  public function image(): C\Image\Factory
106  {
107  return $this->image_factory;
108  }
109 
110  public function player(): C\Player\Factory
111  {
112  return new Component\Player\Factory();
113  }
114 
118  public function legacy(string $content): C\Legacy\Legacy
119  {
120  return $this->legacy_factory->legacy($content);
121  }
122 
126  public function panel(): C\Panel\Factory
127  {
128  return $this->panel_factory;
129  }
130 
134  public function modal(): C\Modal\Factory
135  {
136  return $this->modal_factory;
137  }
138 
142  public function dropzone(): C\Dropzone\Factory
143  {
144  return $this->dropzone_factory;
145  }
146 
150  public function popover(): C\Popover\Factory
151  {
152  return $this->popover_factory;
153  }
154 
158  public function divider(): C\Divider\Factory
159  {
160  return $this->divider_factory;
161  }
162 
166  public function link(): C\Link\Factory
167  {
168  return $this->link_factory;
169  }
170 
174  public function dropdown(): C\Dropdown\Factory
175  {
176  return $this->dropdown_factory;
177  }
178 
182  public function item(): C\Item\Factory
183  {
184  return $this->item_factory;
185  }
186 
187 
191  public function viewControl(): C\ViewControl\Factory
192  {
193  return $this->viewcontrol_factory;
194  }
195 
199  public function breadcrumbs(array $crumbs): C\Breadcrumbs\Breadcrumbs
200  {
201  return new Component\Breadcrumbs\Breadcrumbs($crumbs);
202  }
203 
207  public function chart(): C\Chart\Factory
208  {
209  return $this->chart_factory;
210  }
211 
215  public function input(): C\Input\Factory
216  {
217  return $this->input_factory;
218  }
219 
223  public function table(): C\Table\Factory
224  {
225  return $this->table_factory;
226  }
227 
231  public function messageBox(): C\MessageBox\Factory
232  {
233  return $this->messagebox_factory;
234  }
235 
239  public function layout(): C\Layout\Factory
240  {
241  return $this->layout_factory;
242  }
243 
247  public function mainControls(): C\MainControls\Factory
248  {
249  return $this->maincontrols_factory;
250  }
251 
255  public function tree(): C\Tree\Factory
256  {
257  return $this->tree_factory;
258  }
259 
263  public function menu(): C\Menu\Factory
264  {
265  return $this->menu_factory;
266  }
267 
271  public function symbol(): C\Symbol\Factory
272  {
273  return $this->symbol_factory;
274  }
275 
276  public function toast(): C\Toast\Factory
277  {
278  return $this->toast_factory;
279  }
280 
281  public function helpTopics(string ...$topics): array
282  {
283  return array_map(
284  fn($t) => new Help\Topic($t),
285  $topics
286  );
287  }
288 
289  public function launcher(): C\Launcher\Factory
290  {
291  return $this->launcher_factory;
292  }
293 
294  public function entity(): C\Entity\Factory
295  {
296  return $this->entity_factory;
297  }
298 }
link()
description: purpose: > Links are used navigate to other resources or views of the system by clickin...
Definition: Factory.php:166
input()
description: purpose: > In opposite to components with a purely receptive or at most navigational ch...
Definition: Factory.php:215
deck(array $cards)
description: purpose: > Decks are used to display multiple Cards in a grid.They should be used if a ...
Definition: Factory.php:89
This is just a class that marks a string as a help topic.
Definition: Topic.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
symbol()
description: purpose: > Symbols are graphical representations of concepts or contexts quickly compre...
Definition: Factory.php:271
menu()
description: purpose: > Menus let the user choose from several (navigational) options.
Definition: Factory.php:263
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(protected C\Counter\Factory $counter_factory, protected C\Button\Factory $button_factory, protected C\Listing\Factory $listing_factory, protected C\Image\Factory $image_factory, protected C\Panel\Factory $panel_factory, protected C\Modal\Factory $modal_factory, protected C\Dropzone\Factory $dropzone_factory, protected C\Popover\Factory $popover_factory, protected C\Divider\Factory $divider_factory, protected C\Link\Factory $link_factory, protected C\Dropdown\Factory $dropdown_factory, protected C\Item\Factory $item_factory, protected C\ViewControl\Factory $viewcontrol_factory, protected C\Chart\Factory $chart_factory, protected C\Input\Factory $input_factory, protected C\Table\Factory $table_factory, protected C\MessageBox\Factory $messagebox_factory, protected C\Card\Factory $card_factory, protected C\Layout\Factory $layout_factory, protected C\MainControls\Factory $maincontrols_factory, protected C\Tree\Factory $tree_factory, protected C\Menu\Factory $menu_factory, protected C\Symbol\Factory $symbol_factory, protected C\Toast\Factory $toast_factory, protected C\Legacy\Factory $legacy_factory, protected C\launcher\Factory $launcher_factory, protected C\Entity\Factory $entity_factory)
Definition: Factory.php:31
chart()
description: purpose: > Charts are used to graphically represent data in various forms such as maps...
Definition: Factory.php:207
helpTopics(string ... $topics)
description: purpose: > Help Topics can be attached to certain components.
Definition: Factory.php:281
tree()
description: purpose: > Trees present hierarchically structured data.rivals: Drilldown: > A Drilldow...
Definition: Factory.php:255
table()
description: purpose: > Tables present a set of uniformly structured data.
Definition: Factory.php:223
listing()
description: purpose: > Listings are used to structure itemised textual information.composition: > Listings may contain ordered, unordered, or labeled items. effect: > Listings hold only textual information. They may contain Links but no Buttons. rules: composition: 1: Listings MUST NOT contain Buttons.
Definition: Factory.php:97
layout()
description: purpose: > Layout components are components used for the overall construction of the us...
Definition: Factory.php:239
This is how the factory for UI elements looks.
Definition: Factory.php:37
popover()
description: purpose: > Popovers can be used when space is scarce i.e.within List GUI items...
Definition: Factory.php:150
dropdown()
description: purpose: > Dropdowns reveal a list of interactions that change the system’s status or ...
Definition: Factory.php:174
dropzone()
description: purpose: > Dropzones are containers used to drop either files or other HTML elements...
Definition: Factory.php:142
divider()
description: purpose: > A divider marks a thematic change in a sequence of other components...
Definition: Factory.php:158
toast()
description: purpose: Toasts are temporary messages from the system published to the user...
Definition: Factory.php:276
card()
description: purpose: > A card is a flexible content container for small chunks of structured data...
Definition: Factory.php:81
counter()
description: purpose: > Counter inform users about the quantity of items indicated by a glyph...
Definition: Factory.php:65
viewControl()
description: purpose: > View Controls switch between different visualisation of data.composition: > View Controls are composed mainly of buttons, they are often found in toolbars. effect: Interacting with a view control changes to display in some content area.
Definition: Factory.php:191
mainControls()
description: purpose: > Main Controls are components that are always usable, depending only on overa...
Definition: Factory.php:247
legacy(string $content)
description: purpose: > This component is used to wrap an existing ILIAS UI element into a UI compon...
Definition: Factory.php:118
image()
description: purpose: The Image component is used to display images of various sources.composition: > An Image is composed of the image and an alternative text for screen readers. An Image MAY contain an initial source of reduced size and additional higher resolution sources optimized for different display sizes to be loaded asynchronously once the actual size on the screen is known.rules: interaction: 1: > Images MAY be included in interactive components. Images MAY also be interactive on their own. Clicking on an Image can e.g. provide navigation to another screen or showing a Modal on the same screen. The usage of an interactive Image MUST be confirmed by the JF to make sure that interactive Images will only be used in meaningful cases. accessibility: 1: > Images MUST contain the alt attribute. This attribute MAY be left empty (alt="") if the image is of decorative nature. According to the WAI, decorative images don’t add information to the content of a page. For example, the information provided by the image might already be given using adjacent text, or the image might be included to make the website more visually attractive (see https://www.w3.org/WAI/tutorials/images/decorative/). composition: 1: > If an Image may be displayed in widely differing sizes differently sized sources SHOULD be added as additional high resolution resource sources to reduce loading times without diminishing the user experience.
Definition: Factory.php:105
launcher()
description: purpose: > The Launcher starts an object, a process or a workflow.
Definition: Factory.php:289
breadcrumbs(array $crumbs)
description: purpose: > Breadcrumbs is a supplemental navigation scheme.It eases the user&#39;s navigati...
Definition: Factory.php:199
item()
description: purpose: > An item displays a unique entity within the system.It shows information abou...
Definition: Factory.php:182
modal()
description: purpose: The Modal forces users to focus on the task at hand.composition: > A Modal is ...
Definition: Factory.php:134
entity()
description: purpose: > An Entity displays information about entities within the system...
Definition: Factory.php:294
button()
description: purpose: > Buttons trigger interactions that change the system’s or view&#39;s status...
Definition: Factory.php:73
panel()
description: purpose: > Panels are used to group titled content.composition: > Panels consist of a h...
Definition: Factory.php:126
messageBox()
description: purpose: > Message Boxes inform the user about the state of the system or an ongoing us...
Definition: Factory.php:231
player()
description: purpose: > The Player component is used to play and control a media source...
Definition: Factory.php:110
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Purpose.php:21