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