ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\UI\examples\Item\Notification Namespace Reference

Functions

 base ()
 
 closable ()
 
 include_aggregates ()
 

Function Documentation

◆ base()

ILIAS\UI\examples\Item\Notification\base ( )

description: > Example for rendering a notification item.

expected output: > ILIAS shows a box titled "Inbox" on a white background and including following text: "You have 23 unread mails in <h2>your inbox". A dashed line and a time indication (Time 3 days ago) are displayed below.

Definition at line 33 of file base.php.

34{
35 global $DIC;
36 $f = $DIC->ui()->factory();
37 $renderer = $DIC->ui()->renderer();
38
39 //Creating a Mail Notification Item
40 $mail_icon = $f->symbol()->icon()->standard("mail", "mail");
41 $mail_title = $f->link()->standard("Inbox", "#");
42 $mail_notification_item = $f->item()->notification($mail_title, $mail_icon)
43 ->withDescription("You have 23 unread mails in your inbox")
44 ->withProperties(["Time" => "3 days ago"]);
45
46
47 return $renderer->render($mail_notification_item);
48}
$renderer
global $DIC
Definition: shib_login.php:26

References $DIC, Vendor\Package\$f, and $renderer.

◆ closable()

ILIAS\UI\examples\Item\Notification\closable ( )

description: > Example for rendering a closable notification item.

expected output: > ILIAS shows a box titled "Inbox" on a white background and including following text: "You have 23 unread mails in your inbox". A dashed line and a time indication (Time 3 days ago) are displayed below. Additionally a "X" is rendered

on the right side of the box. Clicking the "X" will close the box.

Definition at line 34 of file closable.php.

35{
36 global $DIC;
37 $refinery = $DIC->refinery();
38 $request_wrapper = $DIC->http()->wrapper()->query();
39
40 $close_url = $_SERVER['REQUEST_URI'] . '&mail_closed=true';
41
42 //If closed, an ajax request is fired to the set close_url
43 if ($request_wrapper->has('mail_closed') && $request_wrapper->retrieve('mail_closed', $refinery->kindlyTo()->bool())) {
44 //Do Some Magic needed to be done, when this item is closed.
45 exit;
46 }
47
48 //Creating a closable Mail Notification Item
49 $f = $DIC->ui()->factory();
50 $renderer = $DIC->ui()->renderer();
51
52 $mail_icon = $f->symbol()->icon()->standard("mail", "mail");
53 $mail_title = $f->link()->standard("Inbox", "#");
54 $mail_notification_item = $f->item()->notification($mail_title, $mail_icon)
55 ->withDescription("You have 23 unread mails in your inbox")
56 ->withProperties(["Time" => "3 days ago"])
57 ->withCloseAction($close_url);
58
59
60 return $renderer->render($mail_notification_item);
61}
exit
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26

References $_SERVER, $DIC, Vendor\Package\$f, ILIAS\UI\examples\Layout\Page\Standard\$refinery, $renderer, ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, and exit.

◆ include_aggregates()

ILIAS\UI\examples\Item\Notification\include_aggregates ( )

description: > Example for rendering a notificication item including aggregates.

expected output: > ILIAS shows a box titled "Item" on a white background and following text: "Notification Item with Aggregates". Clicking the item's heading will collapse another field with the same content. On the right side an "X" for closing the boxes is displayed. Additionally you can see two dropdown fields on the right side including two entries each.

On the top the heading "<Back" is displayed. Clicking "Back" will fold up the boxes.

Definition at line 35 of file include_aggregates.php.

36{
37 global $DIC;
38 $f = $DIC->ui()->factory();
39 $renderer = $DIC->ui()->renderer();
40 $refinery = $DIC->refinery();
41 $request_wrapper = $DIC->http()->wrapper()->query();
42
43 $close_url = $_SERVER['REQUEST_URI'] . '&aggregate_closed=true';
44
45 //If closed, an ajax request is fired to the set close_url
46 if (
47 $request_wrapper->has('aggregate_closed') &&
48 $request_wrapper->retrieve('aggregate_closed', $refinery->kindlyTo()->bool())
49 ) {
50 //Do Some Magic needed to be done, when this item is closed.
51 exit;
52 }
53
54 //Some generic notification Items
55 $generic_icon1 = $f->symbol()->icon()->standard("cal", "generic");
56 $generic_title1 = $f->link()->standard("Aggregate of Item", "#");
57 $generic_item1 = $f->item()->notification($generic_title1, $generic_icon1)
58 ->withDescription("Is shown when top item is clicked")
59 ->withProperties(["Property 1" => "Content 1", "Property 2" => "Content 2"])
60 ->withActions(
61 $f->dropdown()->standard([
62 $f->button()->shy("Link to ilias.de", "https://www.ilias.de"),
63 $f->button()->shy("Link to github", "https://www.github.com")
64 ])
65 )
66 ->withCloseAction($close_url);
67
68 $generic_title2 = $f->link()->standard("Item", "just_opens_the_list_of_aggregates");
69 $generic_item2 = $f->item()->notification($generic_title2, $generic_icon1)
70 ->withDescription("Notification Item with Aggregates")
71 ->withProperties(["Property 1" => "Content 1", "Property 2" => "Content 2"])
72 ->withAggregateNotifications([$generic_item1, $generic_item1]);
73
74
75 return $renderer->render($generic_item2);
76}

References $_SERVER, $DIC, Vendor\Package\$f, ILIAS\UI\examples\Layout\Page\Standard\$refinery, $renderer, ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, and exit.