ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
show_popover_with_async_loaded_content.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
8 if (isset($_GET['renderPopoverAsync']) && $_GET['renderPopoverAsync']) {
9 // This is the ajax request to load the content of the popover. During the ajax request,
10 // a loading spinner is presented to the user. Check the code below on how to construct the popover,
11 // e.g. using Popover::withAsyncContentUrl().
12 $content = $factory->legacy('This text is rendered async');
13 echo $renderer->render($content);
14 exit();
15 }
16
17 $async_url = $_SERVER['REQUEST_URI'] . '&renderPopoverAsync=1';
18 $popover = $factory->popover()->standard($factory->legacy(''))
19 ->withTitle('Popover')
20 ->withAsyncContentUrl($async_url);
21 $button = $factory->button()->standard('Show Popover', '#')
22 ->withOnClick($popover->getShowSignal());
23
24 return $renderer->render([$popover, $button]);
25}
$factory
Definition: metadata.php:43
exit
Definition: backend.php:16
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
global $DIC
Definition: saml.php:7
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']