ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
show_modal_on_button_click.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
8 {
9  global $DIC;
10  $factory = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12  $refinery = $DIC->refinery();
13  $request_wrapper = $DIC->http()->wrapper()->query();
14  $post_wrapper = $DIC->http()->wrapper()->post();
15  $ctrl = $DIC->ctrl();
16 
17  $message = 'Are you sure you want to delete the following items?';
18  $ctrl->setParameterByClass('ilsystemstyledocumentationgui', 'modal_nr', 1);
19  $form_action = $ctrl->getFormActionByClass('ilsystemstyledocumentationgui');
20  $icon = $factory->image()->standard('./templates/default/images/icon_crs.svg', '');
21  $modal = $factory->modal()->interruptive('My Title', $message, $form_action)
22  ->withAffectedItems(array(
23  $factory->modal()->interruptiveItem('10', 'Course 1', $icon, 'Some description text'),
24  $factory->modal()->interruptiveItem('20', 'Course 2', $icon, 'Another description text'),
25  $factory->modal()->interruptiveItem('30', 'Course 3', $icon, 'Last but not least, a description'),
26  ));
27  $button = $factory->button()->standard('Show Modal', '')
28  ->withOnClick($modal->getShowSignal());
29 
30  $out = [$button, $modal];
31 
32  // Display POST data of affected items in a panel
33  if (
34  $request_wrapper->has('interruptive_items') &&
35  $request_wrapper->retrieve('modal_nr', $refinery->kindlyTo()->string()) === '1'
36  ) {
37  $panel = $factory->panel()->standard(
38  'Affected Items',
39  $factory->legacy(print_r($post_wrapper->retrieve('interruptive_items', $refinery->kindlyTo()->string()), true))
40  );
41  $out[] = $panel;
42  }
43 
44  return $renderer->render($out);
45 }
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
global $DIC
Definition: feed.php:28
$out
Definition: buildRTE.php:24
$message
Definition: xapiexit.php:32
$factory
Definition: metadata.php:75
Refinery Factory $refinery