ILIAS  release_8 Revision v8.24
in_form.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
11function in_form()
12{
13 // Step 0: Declare dependencies
14 global $DIC;
15 $ui = $DIC->ui()->factory();
16 $renderer = $DIC->ui()->renderer();
17 $request = $DIC->http()->request();
18
19 // Step 1: Define the input field.
20 // See the implementation of a UploadHandler in Services/UI/classes/class.ilUIDemoFileUploadHandlerGUI.php
21 $file = $ui->input()->field()->file(new \ilUIDemoFileUploadHandlerGUI(), "File Upload", "You can drop your files here");
22
23 // Step 2: Define the form and attach the field.
24 $form = $ui->input()->container()->form()->standard('#', ['file' => $file]);
25
26 // Step 3: Define some data processing.
27 $result = '';
28 if ($request->getMethod() == "POST") {
29 $form = $form->withRequest($request);
30 $result = $form->getData();
31 }
32
33 // Step 4: Render the form/result.
34 return
35 "<pre>" . print_r($result, true) . "</pre><br/>" .
36 $renderer->render($form);
37}
Class ilUIDemoFileUploadHandlerGUI.
global $DIC
Definition: feed.php:28
in_form()
Example of how to process passwords.
Definition: in_form.php:11