ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPDSysMessageBlockGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("Services/Mail/classes/class.ilPDMailBlockGUI.php");
25 
35 {
36  static $block_type = "pdsysmess";
37 
42  {
43  global $ilCtrl, $lng, $ilUser;
45  $this->setImage(ilUtil::getImagePath("icon_sysmess_s.gif"));
46  $this->setTitle($lng->txt("show_system_messages"));
47  $this->setAvailableDetailLevels(3, 1);
48  $this->mail_mode = "system";
49  $this->allow_moving = false;
50  }
51 
57  static function getBlockType()
58  {
59  return self::$block_type;
60  }
61 
67  static function isRepositoryObject()
68  {
69  return false;
70  }
71 
72  function getHTML()
73  {
74  if ($this->getCurrentDetailLevel() < 1)
75  {
76  $this->setCurrentDetailLevel(1);
77  }
78 
79  $html = parent::getHTML();
80 
81  if (count($this->mails) == 0)
82  {
83  return "";
84  }
85  else
86  {
87  return $html;
88  }
89  }
90 
94  function getMails()
95  {
96  global $ilUser;
97 
98  // BEGIN MAILS
99  $umail = new ilMail($_SESSION["AccountId"]);
100  $mbox = new ilMailBox($_SESSION["AccountId"]);
101  $inbox = $mbox->getInboxFolder();
102 
103  //SHOW MAILS FOR EVERY USER
104  $this->mails = $umail->getMailsOfFolder($inbox, array('status' => 'unread', 'type' => 'system'));
105  }
106 
110  function getOverview()
111  {
112  global $ilUser, $lng, $ilCtrl;
113 
114  return '<div class="small">'.((int) count($this->mails))." ".$lng->txt("system_message")."</div>";
115  }
116 
117 }
118 
119 ?>