ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPDSysMessageBlockGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Mail/classes/class.ilPDMailBlockGUI.php");
5 
15 {
16  public static $block_type = "pdsysmess";
17 
21  public function __construct()
22  {
23  parent::__construct();
24 
25  $this->setTitle($this->lng->txt("show_system_messages"));
26  $this->setAvailableDetailLevels(3);
27  $this->mail_mode = "system";
28  $this->allow_moving = false;
29  }
30 
34  public function getBlockType() : string
35  {
36  return self::$block_type;
37  }
38 
42  protected function isRepositoryObject() : bool
43  {
44  return false;
45  }
46 
47  public function getHTML()
48  {
49  if ($this->getCurrentDetailLevel() < 1) {
50  $this->setCurrentDetailLevel(1);
51  }
52 
53  $html = parent::getHTML();
54 
55  if (count($this->mails) == 0) {
56  return "";
57  } else {
58  return $html;
59  }
60  }
61 
65  public function getMails()
66  {
67  $umail = new ilMail($this->user->getId());
68  $mbox = new ilMailbox($this->user->getId());
69  $inbox = $mbox->getInboxFolder();
70 
71  $this->mails = $umail->getMailsOfFolder($inbox, array('status' => 'unread', 'type' => 'system'));
72  }
73 
77  public function getOverview()
78  {
79  return '<div class="small">' . ((int) count($this->mails)) . " " . $this->lng->txt("system_message") . "</div>";
80  }
81 }
BlockGUI class for Personal Desktop Mail block.
BlockGUI class for System Messages block on personal desktop.
user()
Definition: user.php:4
setTitle($a_title)
Set Title.
Mail Box class Base class for creating and handling mail boxes.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
getMailsOfFolder($a_folder_id, $filter=array())
setCurrentDetailLevel($a_currentdetaillevel)
Set Current Detail Level.
$html
Definition: example_001.php:87
getCurrentDetailLevel()
Get Current Detail Level.