ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
closable.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
18 function closable()
19 {
20  global $DIC;
21  $refinery = $DIC->refinery();
22  $request_wrapper = $DIC->http()->wrapper()->query();
23 
24  $close_url = $_SERVER['REQUEST_URI'] . '&mail_closed=true';
25 
26  //If closed, an ajax request is fired to the set close_url
27  if ($request_wrapper->has('mail_closed') && $request_wrapper->retrieve('mail_closed', $refinery->kindlyTo()->bool())) {
28  //Do Some Magic needed to be done, when this item is closed.
29  exit;
30  }
31 
32  //Creating a closable Mail Notification Item
33  $f = $DIC->ui()->factory();
34  $renderer = $DIC->ui()->renderer();
35 
36  $mail_icon = $f->symbol()->icon()->standard("mail", "mail");
37  $mail_title = $f->link()->standard("Inbox", "#");
38  $mail_notification_item = $f->item()->notification($mail_title, $mail_icon)
39  ->withDescription("You have 23 unread mails in your inbox")
40  ->withProperties(["Time" => "3 days ago"])
41  ->withCloseAction($close_url);
42 
43 
44  return $renderer->render($mail_notification_item);
45 }
$renderer
closable()
description: > Example for rendering a closable notification item.
Definition: closable.php:18
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
global $DIC
Definition: shib_login.php:25