ILIAS  Release_4_0_x_branch Revision 61816
 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  $mail_data = $umail->getMailsOfFolder($inbox);
105  $mail_counter = $umail->getMailCounterData();
106  $unreadmails = 0;
107 
108  $this->mails = array();
109  foreach ($mail_data as $mail)
110  {
111  //ONLY NEW MAILS WOULD BE ON THE PERONAL DESKTOP
112  if($mail["m_status"] == 'unread' &&
113  in_array('system',$mail['m_type']))
114  {
115  $this->mails[] = $mail;
116  }
117  }
118  }
119 
123  function getOverview()
124  {
125  global $ilUser, $lng, $ilCtrl;
126 
127  return '<div class="small">'.((int) count($this->mails))." ".$lng->txt("system_message")."</div>";
128  }
129 
130 }
131 
132 ?>