ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
base.php
Go to the documentation of this file.
1<?php
6function base()
7{
8 //Step 0: Declare dependencies
9 global $DIC;
10 $ui = $DIC->ui()->factory();
11 $renderer = $DIC->ui()->renderer();
12 $ctrl = $DIC->ctrl();
13 $request = $DIC->http()->request();
14
15 //Step 1: Define the textarea input field
16 $textarea_input = $ui->input()->field()->textarea("Textarea Input", "Just a textarea input.");
17
18 //Step 2: Define the form and form actions.
19 $ctrl->setParameterByClass(
20 'ilsystemstyledocumentationgui',
21 'example_name',
22 'textarea'
23 );
24 $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
25 $form = $ui->input()->container()->form()->standard($form_action, [$textarea_input]);
26
27 //Step 3: implement some form data processing.
28 if ($request->getMethod() == "POST"
29 && $request->getQueryParams()['example_name'] == "textarea") {
30 $form = $form->withRequest($request);
31 $result = $form->getData();
32 } else {
33 $result = "No result yet.";
34 }
35
36 //Step 4: Render the form with the text input field
37 return
38 "<pre>" . print_r($result, true) . "</pre><br/>" .
39 $renderer->render($form);
40}
base()
Definition: base.php:2
$result
foreach($paths as $path) $request
Definition: asyncclient.php:32
An exception for terminatinating execution or to throw for unit testing.
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7