ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
multiple.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
8 
20 function multiple(): string
21 {
22  global $DIC;
23 
24  $http = $DIC->http();
25  $factory = $DIC->ui()->factory();
26  $renderer = $DIC->ui()->renderer();
27  $get_request = $http->wrapper()->query();
28  $data_factory = new \ILIAS\Data\Factory();
29 
30  $example_uri = $data_factory->uri((string) $http->request()->getUri());
31  $url_builder = new URLBuilder($example_uri);
32  [$process_form_url_builder, $process_form_parameter] = $url_builder->acquireParameter(explode('\\', __NAMESPACE__), "process");
33 
34  $file_input_one = $factory->input()->field()->file(new \ilUIDemoFileUploadHandlerGUI(), "Upload File");
35  $file_input_two = $factory->input()->field()->file(new \ilUIDemoFileUploadHandlerGUI(), "Upload More");
36 
37  $form = $factory->input()->container()->form()->standard(
38  (string) $process_form_url_builder->withParameter($process_form_parameter, '1')->buildURI(),
39  [$file_input_one, $file_input_two]
40  );
41 
42  // simulates a form processing endpoint:
43  if ($get_request->has($process_form_parameter->getName())) {
44  $form = $form->withRequest($http->request());
45  $data = $form->getData();
46  } else {
47  $data = 'No submitted data yet.';
48  }
49 
50  return '<pre>' . print_r($data, true) . '</pre>' . $renderer->render($form);
51 }
$renderer
$http
Definition: deliver.php:30
Class ilUIDemoFileUploadHandlerGUI.
global $DIC
Definition: shib_login.php:26
multiple()
description: > The example shows the behaviour of multiple File Field&#39;s inside the same Form Contain...
Definition: multiple.php:20
URLBuilder.
Definition: URLBuilder.php:40