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_wrapper_with_additional_input';
28  $post_url = "{$request->getUri()}&$submit_flag";
29 
30  $dropzone = $factory
31  ->dropzone()->file()->wrapper(
32  'Upload your files here',
33  $post_url,
34  $factory->messageBox()->info('Drag and drop files onto me!'),
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  );
44 
45  // please use ilCtrl to generate an appropriate link target
46  // and check it's command instead of this.
47  if ($wrapper->has($submit_flag)) {
48  $dropzone = $dropzone->withRequest($request);
49  $data = $dropzone->getData();
50  } else {
51  $data = 'no results yet.';
52  }
53 
54  return '<pre>' . print_r($data, true) . '</pre>' .
55  $renderer->render($dropzone);
56 }
$renderer
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...
with_additional_input()
description: > Example for rendering a file dropzone wrapper with additional input.