1<?php
2
3/* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\UI\Implementation;
6
7use \ILIAS\UI\Component as C;
8use ILIAS\UI\NotImplementedException;
9
10// TODO: This might cache the created factories.
11use ILIAS\UI\Implementation\Component\SignalGenerator;
12
13class Factory implements \ILIAS\UI\Factory
14{
15    /**
16     * @var C\Counter\Factory
17     */
18    protected $counter_factory;
19
20    /**
21     * @var C\Glyph\Factory
22     */
23    protected $glyph_factory;
24
25    /**
26     * @var C\Button\Factory
27     */
28    protected $button_factory;
29
30    /**
31     * @var C\Listing\Factory
32     */
33    protected $listing_factory;
34
35    /**
36     * @var C\Image\Factory
37     */
38    protected $image_factory;
39
40    /**
41     * @var C\Panel\Factory
42     */
43    protected $panel_factory;
44
45    /**
46     * @var C\Modal\Factory
47     */
48    protected $modal_factory;
49
50    /**
51     * @var C\Dropzone\Factory
52     */
53    protected $dropzone_factory;
54
55    /**
56     * @var C\Popover\Factory
57     */
58    protected $popover_factory;
59
60    /**
61     * @var C\Divider\Factory
62     */
63    protected $divider_factory;
64
65    /**
66     * @var C\Link\Factory
67     */
68    protected $link_factory;
69
70    /**
71     * @var C\Dropdown\Factory
72     */
73    protected $dropdown_factory;
74
75    /**
76     * @var C\Item\Factory
77     */
78    protected $item_factory;
79
80    /**
81     * @var C\Icon\Factory
82     */
83    protected $icon_factory;
84
85    /**
86     * @var C\ViewControl\Factory
87     */
88    protected $viewcontrol_factory;
89
90    /**
91     * @var C\Chart\Factory
92     */
93    protected $chart_factory;
94
95    /**
96     * @var C\Input\Factory
97     */
98    protected $input_factory;
99
100    /**
101     * @var C\Table\Factory
102     */
103    protected $table_factory;
104
105    /**
106     * @var C\Card\Factory
107     */
108    protected $card_factory;
109
110    /**
111     * @var Component\MessageBox\Factory
112     */
113    protected $messagebox_factory;
114
115    public function __construct(
116        C\Counter\Factory $counter_factory,
117        C\Glyph\Factory $glyph_factory,
118        C\Button\Factory $button_factory,
119        C\Listing\Factory $listing_factory,
120        C\Image\Factory $image_factory,
121        C\Panel\Factory $panel_factory,
122        C\Modal\Factory $modal_factory,
123        C\Dropzone\Factory $dropzone_factory,
124        C\Popover\Factory $popover_factory,
125        C\Divider\Factory $divider_factory,
126        C\Link\Factory $link_factory,
127        C\Dropdown\Factory $dropdown_factory,
128        C\Item\Factory $item_factory,
129        C\Icon\Factory $icon_factory,
130        C\ViewControl\Factory $viewcontrol_factory,
131        C\Chart\Factory $chart_factory,
132        C\Input\Factory $input_factory,
133        C\Table\Factory $table_factory,
134        C\MessageBox\Factory $messagebox_factory,
135        C\Card\Factory $card_factory
136    ) {
137        $this->counter_factory = $counter_factory;
138        $this->glyph_factory = $glyph_factory;
139        $this->button_factory = $button_factory;
140        $this->listing_factory = $listing_factory;
141        $this->image_factory = $image_factory;
142        $this->panel_factory = $panel_factory;
143        $this->modal_factory = $modal_factory;
144        $this->dropzone_factory = $dropzone_factory;
145        $this->popover_factory = $popover_factory;
146        $this->divider_factory = $divider_factory;
147        $this->link_factory = $link_factory;
148        $this->dropdown_factory = $dropdown_factory;
149        $this->item_factory = $item_factory;
150        $this->icon_factory = $icon_factory;
151        $this->viewcontrol_factory = $viewcontrol_factory;
152        $this->chart_factory = $chart_factory;
153        $this->input_factory = $input_factory;
154        $this->table_factory = $table_factory;
155        $this->messagebox_factory = $messagebox_factory;
156        $this->card_factory = $card_factory;
157    }
158
159    /**
160     * @inheritdoc
161     */
162    public function counter()
163    {
164        return $this->counter_factory;
165    }
166
167    /**
168     * @inheritdoc
169     */
170    public function glyph()
171    {
172        return $this->glyph_factory;
173    }
174
175    /**
176     * @inheritdoc
177     */
178    public function button()
179    {
180        return $this->button_factory;
181    }
182
183    /**
184     * @inheritdoc
185     */
186    public function card()
187    {
188        return $this->card_factory;
189    }
190
191    /**
192     * @inheritdoc
193     */
194    public function deck(array $cards)
195    {
196        return new Component\Deck\Deck($cards, Component\Deck\Deck::SIZE_S);
197    }
198
199    /**
200     * @inheritdoc
201     */
202    public function listing()
203    {
204        return $this->listing_factory;
205    }
206
207    /**
208     * @inheritdoc
209     */
210    public function image()
211    {
212        return $this->image_factory;
213    }
214
215    /**
216     * @inheritdoc
217     */
218    public function legacy($content)
219    {
220        return new Component\Legacy\Legacy($content);
221    }
222
223    /**
224     * @inheritdoc
225     */
226    public function panel()
227    {
228        return $this->panel_factory;
229    }
230
231    /**
232     * @inheritdoc
233     */
234    public function modal()
235    {
236        return $this->modal_factory;
237    }
238
239    /**
240     * @inheritdoc
241     */
242    public function dropzone()
243    {
244        return $this->dropzone_factory;
245    }
246
247    /**
248     * @inheritdoc
249     */
250    public function popover()
251    {
252        return $this->popover_factory;
253    }
254
255    /**
256     * @inheritdoc
257     */
258    public function divider()
259    {
260        return $this->divider_factory;
261    }
262
263    /**
264     * @inheritdoc
265     */
266    public function link()
267    {
268        return $this->link_factory;
269    }
270
271    /**
272     * @inheritdoc
273     */
274    public function dropdown()
275    {
276        return $this->dropdown_factory;
277    }
278
279    /**
280     * @inheritdoc
281     */
282    public function item()
283    {
284        return $this->item_factory;
285    }
286
287    /**
288     * @inheritdoc
289     */
290    public function icon()
291    {
292        return $this->icon_factory;
293    }
294
295    /**
296     * @inheritdoc
297     */
298    public function viewControl()
299    {
300        return $this->viewcontrol_factory;
301    }
302
303    /**
304     * @inheritdoc
305     */
306    public function breadcrumbs(array $crumbs)
307    {
308        return new Component\Breadcrumbs\Breadcrumbs($crumbs);
309    }
310
311    /**
312     * @inheritdoc
313     */
314    public function chart()
315    {
316        return $this->chart_factory;
317    }
318
319    /**
320     * @inheritdoc
321     */
322    public function input()
323    {
324        return $this->input_factory;
325    }
326
327    /**
328     * @inheritdoc
329     */
330    public function table()
331    {
332        return $this->table_factory;
333    }
334
335    /**
336     * @inheritdoc
337     */
338    public function messageBox()
339    {
340        return $this->messagebox_factory;
341    }
342}
343