ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ViewFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
30 final class ViewFactory
31 {
33  private \ilLanguage $language;
34  private Services $http;
35 
36  public function __construct(
37  private TableDataProvider $data_provider,
38  private ActionBuilder $action_builder,
39  private ViewControlBuilder $view_control_builder,
40  private UploadBuilder $upload_builder
41  ) {
42  global $DIC;
43  $this->http = $DIC->http();
44  $this->ui_factory = $DIC->ui()->factory();
45  $this->language = $DIC->language();
46  }
47 
48  public function getComponentProvider(
49  Request $request
51  switch ($request->getMode()) {
52  case Mode::DATA_TABLE:
53  return new RequestToDataTable(
54  $request,
55  $this->ui_factory,
56  $this->language,
57  $this->http,
58  $this->data_provider,
59  $this->action_builder,
60  $this->view_control_builder,
61  $this->upload_builder
62  );
63  case Mode::DECK:
64  return new RequestToDeckOfCards(
65  $request,
66  $this->ui_factory,
67  $this->language,
68  $this->http,
69  $this->data_provider,
70  $this->action_builder,
71  $this->view_control_builder,
72  $this->upload_builder
73  );
74  case Mode::ITEMS:
75  return new RequestToItems(
76  $request,
77  $this->ui_factory,
78  $this->language,
79  $this->http,
80  $this->data_provider,
81  $this->action_builder,
82  $this->view_control_builder,
83  $this->upload_builder
84  );
85  case Mode::PRESENTATION_TABLE:
86  return new RequestToPresentationTable(
87  $request,
88  $this->ui_factory,
89  $this->language,
90  $this->http,
91  $this->data_provider,
92  $this->action_builder,
93  $this->view_control_builder,
94  $this->upload_builder
95  );
96  default:
97  throw new \InvalidArgumentException('Unknown mode');
98  }
99  }
100 }
__construct(private TableDataProvider $data_provider, private ActionBuilder $action_builder, private ViewControlBuilder $view_control_builder, private UploadBuilder $upload_builder)
Definition: ViewFactory.php:36
static http()
Fetches the global http state from ILIAS.
This is how the factory for UI elements looks.
Definition: Factory.php:37
global $DIC
Definition: shib_login.php:22
language()
description: > Example for rendring a language glyph.
Definition: language.php:41