ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
show_popover_with_async_loaded_content.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
34 {
35  global $DIC;
36  $factory = $DIC->ui()->factory();
37  $renderer = $DIC->ui()->renderer();
38  $refinery = $DIC->refinery();
39  $request_wrapper = $DIC->http()->wrapper()->query();
40 
41  if (
42  $request_wrapper->has('renderPopoverAsync') &&
43  $request_wrapper->retrieve('renderPopoverAsync', $refinery->kindlyTo()->bool())
44  ) {
45  // This is the ajax request to load the content of the popover. During the ajax request,
46  // a loading spinner is presented to the user. Check the code below on how to construct the popover,
47  // e.g. using Popover::withAsyncContentUrl().
48  $content = $factory->legacy()->content('This text is rendered async');
49  echo $renderer->render($content);
50  exit();
51  }
52 
53  $async_url = $_SERVER['REQUEST_URI'] . '&renderPopoverAsync=1';
54  $popover = $factory->popover()->standard($factory->legacy()->content(''))
55  ->withTitle('Popover')
56  ->withAsyncContentUrl($async_url);
57  $button = $factory->button()->standard('Show Popover', '#')
58  ->withOnClick($popover->getShowSignal());
59 
60  return $renderer->render([$popover, $button]);
61 }
$renderer
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
global $DIC
Definition: shib_login.php:22
show_popover_with_async_loaded_content()
description: > Example for rendering a standard popover with asynchronous loaded content...
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...