ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
closable.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
34 function closable()
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 }
$renderer
closable()
description: > Example for rendering a closable notification item.
Definition: closable.php:34
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
global $DIC
Definition: shib_login.php:22
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...