ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
base.php
Go to the documentation of this file.
1 <?php
5 function base()
6 {
7 
8  //Step 0: Declare dependencies
9  global $DIC;
10 
11  $ui = $DIC->ui()->factory();
12  $renderer = $DIC->ui()->renderer();
13  $request = $DIC->http()->request();
14  $ctrl = $DIC->ctrl();
15 
16  //Define the options.
17  $options = array(
18  "1" => "Pick 1",
19  "2" => "Pick 2",
20  "3" => "Pick 3",
21  "4" => "Pick 4",
22  );
23 
24  //Step 1: define the select
25  $multi = $ui->input()->field()->multiselect("Take your picks", $options, "This is the byline text")
26  ->withRequired(true);
27 
28  //Step 2: define form and form actions
29  $form = $ui->input()->container()->form()->standard('#', ['multi' => $multi]);
30 
31  //Step 3: implement some form data processing.
32  if ($request->getMethod() == "POST") {
33  $form = $form->withRequest($request);
34  $result = $form->getData();
35  } else {
36  $result = "No result yet.";
37  }
38 
39  //Step 4: Render the select with the enclosing form.
40  return
41  "<pre>" . print_r($result, true) . "</pre><br/>" .
42  $renderer->render($form);
43 }
$result
base()
Definition: base.php:4
global $DIC
Definition: goto.php:24