ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
with_additional_input.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
19 {
20  global $DIC;
21 
22  $factory = $DIC->ui()->factory();
23  $renderer = $DIC->ui()->renderer();
24  $request = $DIC->http()->request();
25  $wrapper = $DIC->http()->wrapper()->query();
26 
27  $submit_flag = 'dropzone_standard_with_additional_input';
28  $post_url = "{$request->getUri()}&$submit_flag";
29 
30  $dropzone = $factory
31  ->dropzone()->file()->standard(
32  'Upload your files here',
33  'Drag files in here to upload them!',
34  $post_url,
35  $factory->input()->field()->file(
37  'your files'
38  ),
39  $factory->input()->field()->text(
40  'Additional Input',
41  'Additional input which affects all files of this upload.'
42  )
43  )->withUploadButton(
44  $factory->button()->shy('Upload files', '#')
45  );
46 
47  // please use ilCtrl to generate an appropriate link target
48  // and check it's command instead of this.
49  if ($wrapper->has($submit_flag)) {
50  $dropzone = $dropzone->withRequest($request);
51  $data = $dropzone->getData();
52  } else {
53  $data = 'no results yet.';
54  }
55 
56  return '<pre>' . print_r($data, true) . '</pre>' .
57  $renderer->render($dropzone);
58 }
$renderer
with_additional_input()
description: > Example for rendering a standard file dropzone with additional input.
global $DIC
Definition: shib_login.php:25
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...