ILIAS  release_7 Revision v7.30-3-g800a261c036
standard.php
Go to the documentation of this file.
1<?php
11function standard()
12{
13 global $DIC;
14 $f = $DIC->ui()->factory();
15 $renderer = $DIC->ui()->renderer();
16
17 //Creating a mail Notification Item, note that Additional Content is only to be used
18 //if content needs to be provided, for which no UI Component yet exists.
19 $mail_icon = $f->symbol()->icon()->standard("mail", "mail");
20 $mail_title = $f->link()->standard("Inbox", "link_to_inbox");
21 $mail_notification_item = $f->item()->notification($mail_title, $mail_icon)
22 ->withDescription("You have 23 unread mails in your inbox")
23 ->withProperties(["Time" => "3 days ago"])
24 ->withAdditionalContent($f->legacy("<b>Additional Content</b>"));
25
26 //Creating a badge Notification Item with a specific close action here.
27 $close_url = $_SERVER['REQUEST_URI'] . '&badge_closed=true';
28 if ($_GET['badge_closed']) {
29 //Whatever needs to be done, if the badge notification is closed
30 exit;
31 } else {
32 $badge_icon = $f->symbol()->icon()->standard("bdga", "mail");
33 $badge_title = $f->link()->standard("Badges", "link_to_achievement_badges");
34 $badge_notification_item1 = $f->item()->notification($badge_title, $badge_icon)
35 ->withDescription("You received 1 Badge.")
36 ->withProperties(["Time" => "2 days ago"])
37 ->withCloseAction($close_url);
38 $badge_icon = $f->symbol()->icon()->standard("bdga", "mail");
39 $badge_title = $f->link()->standard("Badges 2", "link_to_achievement_badges");
40 $close_url = $_SERVER['REQUEST_URI'] . '&badge_closed=true';
41 $badge_notification_item2 = $f->item()->notification($badge_title, $badge_icon)
42 ->withDescription("You received 1 Badge.")
43 ->withProperties(["Time" => "2 days ago"])
44 ->withCloseAction($close_url);
45 }
46 //Some generic notification Items
47 $generic_icon1 = $f->symbol()->icon()->standard("cal", "generic");
48 $generic_title1 = $f->link()->standard("Generic 1", "link_to_generic_repo");
49 $generic_item1 = $f->item()->notification($generic_title1, $generic_icon1)
50 ->withDescription("Some description.")
51 ->withProperties(["Property 1" => "Content 1", "Property 2" => "Content 2"])
52 ->withActions(
53 $f->dropdown()->standard([
54 $f->button()->shy("Possible Action of this Item", "https://www.ilias.de"),
55 $f->button()->shy("Other Possible Action of this Item", "https://www.github.com")
56 ])
57 );
58 $generic_item1_with_aggregates = $generic_item1->withAggregateNotifications([$mail_notification_item]);
59 $generic_title2 = $f->link()->standard("Generic 2", "just_opens_the_list_of_aggregates");
60 $generic_item2 = $f->item()->notification($generic_title2, $generic_icon1)
61 ->withDescription("Some description describing the aggregates attached.")
62 ->withProperties(["Property 1" => "Content 1", "Property 2" => "Content 2"])
63 ->withAggregateNotifications([$generic_item1, $generic_item1]);
64
65 //Now, one could fill the Notification Slates for those 3 Services (normally done by global screen)
66 $mail_slate = $f->mainControls()->slate()->notification("Mail", [$mail_notification_item]);
67 $badge_slate = $f->mainControls()->slate()->notification("Badge", [$badge_notification_item1, $badge_notification_item2]);
68 $generic_slate = $f->mainControls()->slate()->notification("Generic", [
69 $generic_item1_with_aggregates,
70 $generic_item2
71 ]);
72
73 //Add them to the center which is added to the top bar.
74 $notification_center = $f->mainControls()->slate()->combined(
75 "Notification Center",
76 $f->symbol()->icon()->standard("notification", "notification")
77 )
78 ->withEngaged(true)
79 ->withAdditionalEntry($mail_slate)
80 ->withAdditionalEntry($badge_slate)
81 ->withAdditionalEntry($generic_slate);
82 return $renderer->render($notification_center);
83}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
global $DIC
Definition: goto.php:24
exit
Definition: login.php:29
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
Definition: standard.php:11