ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
show_modal_on_button_click.php
Go to the documentation of this file.
1 <?php
3 {
4  global $DIC;
5  $factory = $DIC->ui()->factory();
6  $renderer = $DIC->ui()->renderer();
7  $ctrl = $DIC->ctrl();
8  $message = 'Are you sure you want to delete the following items?';
9  $ctrl->setParameterByClass('ilsystemstyledocumentationgui', 'modal_nr', 1);
10  $form_action = $ctrl->getFormActionByClass('ilsystemstyledocumentationgui');
11  $icon = $factory->image()->standard('./templates/default/images/icon_crs.svg', '');
12  $modal = $factory->modal()->interruptive('My Title', $message, $form_action)
13  ->withAffectedItems(array(
14  $factory->modal()->interruptiveItem(10, 'Course 1', $icon, 'Some description text'),
15  $factory->modal()->interruptiveItem(20, 'Course 2', $icon, 'Another description text'),
16  $factory->modal()->interruptiveItem(30, 'Course 3', $icon, 'Last but not least, a description'),
17  ));
18  $button = $factory->button()->standard('Show Modal', '')
19  ->withOnClick($modal->getShowSignal());
20 
21  $out = [$button, $modal];
22 
23  // Display POST data of affected items in a panel
24  if (isset($_POST['interruptive_items']) && @$_GET['modal_nr'] === '1') {
25  $panel = $factory->panel()->standard(
26  'Affected Items',
27  $factory->legacy(print_r($_POST['interruptive_items'], true))
28  );
29  $out[] = $panel;
30  }
31 
32  return $renderer->render($out);
33 }
$_GET["client_id"]
show_modal_on_button_click()
$DIC
Definition: xapitoken.php:46
$message
Definition: xapiexit.php:14
$_POST["username"]
$factory
Definition: metadata.php:58