ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
18 function base()
19 {
20  global $DIC;
21 
22  // This example shows how to render a popover containing a list
23  $factory = $DIC->ui()->factory();
24  $renderer = $DIC->ui()->renderer();
25 
26  //Generate some List Items
27  $actions = $factory->dropdown()->standard(array(
28  $factory->button()->shy("ILIAS", "https://www.ilias.de"),
29  $factory->button()->shy("GitHub", "https://www.github.com")
30  ));
31 
32  $list_item1 = $factory->item()->standard("Item Title")
33  ->withProperties(array(
34  "Origin" => "Course Title 1",
35  "Last Update" => "24.11.2011",
36  "Location" => "Room 123, Main Street 44, 3012 Bern"))
37  ->withDescription("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
38 
39  $list_item2 = $factory->item()->standard("Item 2 Title")
40  ->withDescription("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
41 
42  $list_item3 = $factory->item()->standard("Item 3 Title")
43  ->withDescription("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
44 
45 
46  //Put the List Items Into the Listing Popover
47  $popover = $factory->popover()->listing([
48  $factory->item()->group("Subtitle 1", [$list_item1, $list_item2]),
49  $factory->item()->group("Subtitle 2", [$list_item3])
50  ])->withTitle('Listing');
51 
52  //Add a Button opening the Listing Popover on Click
53  $button = $factory->button()->standard('Show Listing', '#')
54  ->withOnClick($popover->getShowSignal());
55 
56  //Render the Listing Popover
57  return $renderer->render([$popover, $button]);
58 }
$renderer
base()
description: > Example for rendering a listing popover.
Definition: base.php:18
global $DIC
Definition: shib_login.php:25