ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
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  case Mode::ITEMS:
65  case Mode::PRESENTATION_TABLE:
66  default:
67  throw new \InvalidArgumentException('Unknown mode or not implemented yet.');
68  }
69  }
70 }
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
__construct(private TableDataProvider $data_provider, private ActionBuilder $action_builder, private ViewControlBuilder $view_control_builder, private UploadBuilder $upload_builder)
Definition: ViewFactory.php:36
language()
description: > Example for rendring a language glyph.
Definition: language.php:41