ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
with_additional_input.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
8 {
9  global $DIC;
10 
11  $factory = $DIC->ui()->factory();
12  $renderer = $DIC->ui()->renderer();
13  $request = $DIC->http()->request();
14  $wrapper = $DIC->http()->wrapper()->query();
15 
16  $submit_flag = 'dropzone_standard_with_additional_input';
17  $post_url = "{$request->getUri()}&$submit_flag";
18 
19  $dropzone = $factory
20  ->dropzone()->file()->standard(
21  'Upload your files here',
22  'Drag files in here to upload them!',
23  $post_url,
24  $factory->input()->field()->file(
26  'your files'
27  ),
28  $factory->input()->field()->text(
29  'Additional Input',
30  'Additional input which affects all files of this upload.'
31  )
32  )->withUploadButton(
33  $factory->button()->shy('Upload files', '#')
34  );
35 
36  // please use ilCtrl to generate an appropriate link target
37  // and check it's command instead of this.
38  if ($wrapper->has($submit_flag)) {
39  $dropzone = $dropzone->withRequest($request);
40  $data = $dropzone->getData();
41  } else {
42  $data = 'no results yet.';
43  }
44 
45  return '<pre>' . print_r($data, true) . '</pre>' .
46  $renderer->render($dropzone);
47 }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...