ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $message = 'Are you sure you want to delete the following items?';
8 $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
9 $icon = $factory->image()->standard('./templates/default/images/icon_crs.svg', '');
10 $modal = $factory->modal()->interruptive('My Title', $message, $form_action)
11 ->withAffectedItems(array(
12 $factory->modal()->interruptiveItem(10, 'Course 1', $icon, 'Some description text'),
13 $factory->modal()->interruptiveItem(20, 'Course 2', $icon, 'Another description text'),
14 $factory->modal()->interruptiveItem(30, 'Course 3', $icon, 'Last but not least, a description'),
15 ));
16 $button = $factory->button()->standard('Show Modal', '')
17 ->withOnClick($modal->getShowSignal());
18
19 // Display POST data of affected items in a panel
20 $panel = '';
21 if (isset($_POST['interruptive_items'])) {
22 $panel = $factory->panel()->standard(
23 'Affected Items',
24 $factory->legacy(print_r($_POST['interruptive_items'], true))
25 );
26 $panel = $renderer->render($panel);
27 }
28
29 return $renderer->render([$button, $modal]) . $panel;
30}
$factory
Definition: metadata.php:47
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
catch(Exception $e) $message
global $DIC
Definition: saml.php:7
show_modal_on_button_click()