ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  static $block_type = "pdsysmess";
17 
21  public function __construct()
22  {
23  global $lng;
25  $this->setImage(ilUtil::getImagePath("icon_sysmess_s.png"));
26  $this->setTitle($lng->txt("show_system_messages"));
27  $this->setAvailableDetailLevels(3, 1);
28  $this->mail_mode = "system";
29  $this->allow_moving = false;
30  }
31 
37  static function getBlockType()
38  {
39  return self::$block_type;
40  }
41 
47  static function isRepositoryObject()
48  {
49  return false;
50  }
51 
52  function getHTML()
53  {
54  if ($this->getCurrentDetailLevel() < 1)
55  {
56  $this->setCurrentDetailLevel(1);
57  }
58 
59  $html = parent::getHTML();
60 
61  if (count($this->mails) == 0)
62  {
63  return "";
64  }
65  else
66  {
67  return $html;
68  }
69  }
70 
74  function getMails()
75  {
76  global $ilUser;
77 
78  // BEGIN MAILS
79  $umail = new ilMail($_SESSION["AccountId"]);
80  $mbox = new ilMailBox($_SESSION["AccountId"]);
81  $inbox = $mbox->getInboxFolder();
82 
83  //SHOW MAILS FOR EVERY USER
84  $this->mails = $umail->getMailsOfFolder($inbox, array('status' => 'unread', 'type' => 'system'));
85  }
86 
90  function getOverview()
91  {
92  global $ilUser, $lng, $ilCtrl;
93 
94  return '<div class="small">'.((int) count($this->mails))." ".$lng->txt("system_message")."</div>";
95  }
96 
97 }
98 
99 ?>