ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
show_form_in_modal.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
34 {
35  global $DIC;
36 
37  $renderer = $DIC->ui()->renderer();
38  $request = $DIC->http()->request();
39  $factory = $DIC->ui()->factory();
40 
41  // declare roundtrip with inputs and form action.
42  $modal = $factory->modal()->roundtrip(
43  'roundtrip with form',
44  null,
45  [
46  $factory->input()->field()->text('some text'),
47  $factory->input()->field()->numeric('some numbere'),
48  ],
49  '#'
50  );
51 
52  // declare something that triggers the modal.
53  $open = $factory->button()->standard('open modal', '#')->withOnClick($modal->getShowSignal());
54 
55  // please use ilCtrl to generate an appropriate link target
56  // and check it's command instead of this.
57  if ('POST' === $request->getMethod()) {
58  $modal = $modal->withRequest($request);
59  $data = $modal->getData();
60  } else {
61  $data = 'no results yet.';
62  }
63 
64  return
65  '<pre>' . print_r($data, true) . '</pre>' .
66  $renderer->render([$open, $modal]);
67 }
$renderer
show_form_in_modal()
description: > Example for rendering a round trip modal.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22