ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
UploadBuilder.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
29 final class UploadBuilder
30 {
31  public function __construct(
32  private Request $request,
33  private \ilCtrlInterface $ctrl,
34  private Factory $ui_factory,
35  private \ilLanguage $language,
36  private UploadHandler $upload_handler
37  ) {
38  }
39 
40  public function getDropZone(): \Generator
41  {
42  if ($this->request->canUserUplaod()) {
43  yield $this->ui_factory->dropzone()->file()->standard(
44  $this->language->txt('upload_modal_title'),
45  $this->language->txt('msg_upload'),
46  $this->ctrl->getLinkTargetByClass(
47  \ilContainerResourceGUI::class,
49  ),
50  $this->ui_factory->input()->field()->file(
51  $this->upload_handler,
52  $this->language->txt('upload_field_title')
53  )->withMaxFiles(100)
54  )->withUploadButton(
55  $this->ui_factory->button()->shy(
56  $this->language->txt('select_files_from_computer'),
57  '#'
58  )
59  )->withBulky(true);
60  }
61  }
62 }
This is how the factory for UI elements looks.
Definition: Factory.php:37
__construct(private Request $request, private \ilCtrlInterface $ctrl, private Factory $ui_factory, private \ilLanguage $language, private UploadHandler $upload_handler)
language()
description: > Example for rendring a language glyph.
Definition: language.php:41