ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPDMailBlockGUI Class Reference

BlockGUI class for Personal Desktop Mail block. More...

+ Inheritance diagram for ilPDMailBlockGUI:
+ Collaboration diagram for ilPDMailBlockGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 getHTML ()
 
 fillDataSection ()
 Fill data section. More...
 
 fillRow ($mail)
 get flat bookmark list for personal desktop More...
 
 deleteMail ()
 delete mail More...
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ($a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Get block type. More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

static $block_type = 'pdmail'
 

Protected Member Functions

 getMails ()
 Get Mails. More...
 
 getOverview ()
 Get overview. More...
 
 showMail ()
 show mail More...
 
 preloadData (array $data)
 
- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 

Detailed Description

BlockGUI class for Personal Desktop Mail block.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ ilPDMailBlockGUI: ilColumnGUI

Definition at line 13 of file class.ilPDMailBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDMailBlockGUI::__construct ( )

Constructor.

Definition at line 20 of file class.ilPDMailBlockGUI.php.

References $lng, ilUtil\getImagePath(), ilBlockGUI\setAvailableDetailLevels(), ilBlockGUI\setImage(), ilBlockGUI\setLimit(), and ilBlockGUI\setTitle().

21  {
22  global $lng;
23 
24  include_once 'Services/User/classes/class.ilObjUser.php';
25  include_once 'Services/Mail/classes/class.ilMailbox.php';
26  include_once 'Services/Mail/classes/class.ilMail.php';
27 
28  parent::__construct();
29 
30  $this->setLimit(5);
31  $this->setImage(ilUtil::getImagePath('icon_mail.svg'));
32  $this->setTitle($lng->txt('mail'));
33  $this->setAvailableDetailLevels(3);
34  }
setImage($a_image)
Set Image.
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setLimit($a_limit)
Set Limit.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteMail()

ilPDMailBlockGUI::deleteMail ( )

delete mail

Definition at line 273 of file class.ilPDMailBlockGUI.php.

References $_GET, $GLOBALS, $ilCtrl, $lng, array, and ilUtil\sendInfo().

274  {
275  global $lng, $ilCtrl;
276 
277  $lng->loadLanguageModule('mail');
278 
279  $umail = new ilMail($GLOBALS['DIC']['ilUser']->getId());
280  $mbox = new ilMailBox($GLOBALS['DIC']['ilUser']->getId());
281 
282  if(!$_GET['mobj_id'])
283  {
284  $_GET['mobj_id'] = $mbox->getInboxFolder();
285  }
286 
287  if($umail->moveMailsToFolder(array($_GET['mail_id']),
288  $mbox->getTrashFolder())
289  )
290  {
291  ilUtil::sendInfo($lng->txt('mail_moved_to_trash'), true);
292  }
293  else
294  {
295  ilUtil::sendInfo($lng->txt('mail_move_error'), true);
296  }
297  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
298  }
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class handles base functions for mail handling.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ executeCommand()

ilPDMailBlockGUI::executeCommand ( )

execute command

Definition at line 74 of file class.ilPDMailBlockGUI.php.

References $cmd, and $ilCtrl.

75  {
76  global $ilCtrl;
77 
78  $cmd = $ilCtrl->getCmd('getHTML');
79 
80  return $this->$cmd();
81  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ fillDataSection()

ilPDMailBlockGUI::fillDataSection ( )

Fill data section.

Definition at line 129 of file class.ilPDMailBlockGUI.php.

References ilBlockGUI\getCurrentDetailLevel(), getMails(), getOverview(), ilBlockGUI\setColSpan(), ilBlockGUI\setData(), ilBlockGUI\setDataSection(), ilBlockGUI\setEnableDetailRow(), ilBlockGUI\setEnableNumInfo(), and ilBlockGUI\setRowTemplate().

130  {
131  $this->getMails();
132  $this->setData($this->mails);
133 
134  if($this->getCurrentDetailLevel() > 1 && count($this->mails) > 0)
135  {
136  $this->setRowTemplate("tpl.pd_mail_row.html", "Services/Mail");
137  if($this->getCurrentDetailLevel() > 2)
138  {
139  $this->setColSpan(2);
140  }
141  parent::fillDataSection();
142  }
143  else
144  {
145  $this->setEnableNumInfo(false);
146  if(count($this->mails) == 0)
147  {
148  $this->setEnableDetailRow(false);
149  }
150  $this->setDataSection($this->getOverview());
151  }
152  }
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
setColSpan($a_colspan)
Set Columns Span.
setData($a_data)
Set Data.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
getCurrentDetailLevel()
Get Current Detail Level.
getOverview()
Get overview.
+ Here is the call graph for this function:

◆ fillRow()

ilPDMailBlockGUI::fillRow (   $mail)

get flat bookmark list for personal desktop

Definition at line 157 of file class.ilPDMailBlockGUI.php.

References $ilCtrl, $lng, ilDatePresentation\formatDate(), ilBlockGUI\getCurrentDetailLevel(), ilUtil\getImagePath(), ilMailUserCache\getUserObjectById(), and IL_CAL_DATE.

158  {
159  global $ilCtrl, $lng;
160 
161  $user = ilMailUserCache::getUserObjectById($mail['sender_id']);
162 
163  if($this->getCurrentDetailLevel() > 2)
164  {
165  $this->tpl->touchBlock('usr_image_space');
166  if($user && $user->getId() != ANONYMOUS_USER_ID)
167  {
168  $this->tpl->setVariable('PUBLIC_NAME_LONG', $user->getPublicName());
169  $this->tpl->setVariable('IMG_SENDER', $user->getPersonalPicturePath('xxsmall'));
170  $this->tpl->setVariable('ALT_SENDER', htmlspecialchars($user->getPublicName()));
171  }
172  else if(!$user)
173  {
174  $this->tpl->setVariable('PUBLIC_NAME_LONG', $mail['import_name'] . ' (' . $lng->txt('user_deleted') . ')');
175 
176  $this->tpl->setCurrentBlock('image_container');
177  $this->tpl->touchBlock('image_container');
178  $this->tpl->parseCurrentBlock();
179  }
180  else
181  {
182  $this->tpl->setVariable('PUBLIC_NAME_LONG', ilMail::_getIliasMailerName());
183  $this->tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.svg'));
184  $this->tpl->setVariable('ALT_SENDER', htmlspecialchars(ilMail::_getIliasMailerName()));
185  }
186 
187  $this->tpl->setVariable('NEW_MAIL_DATE', ilDatePresentation::formatDate(new ilDate($mail['send_time'], IL_CAL_DATE)));
188  }
189  else
190  {
191  if($user && $user->getId() != ANONYMOUS_USER_ID)
192  {
193  $this->tpl->setVariable('PUBLIC_NAME_SHORT', $user->getPublicName());
194  }
195  else if(!$user)
196  {
197  $this->tpl->setVariable('PUBLIC_NAME_SHORT', $mail['import_name'] . ' (' . $lng->txt('user_deleted') . ')');
198  }
199  else
200  {
201  $this->tpl->setVariable('PUBLIC_NAME_SHORT', ilMail::_getIliasMailerName());
202  }
203  }
204 
205  $this->tpl->setVariable('NEW_MAIL_SUBJ', htmlentities($mail['m_subject'], ENT_NOQUOTES, 'UTF-8'));
206  $ilCtrl->setParameter($this, 'mobj_id', $this->inbox);
207  $ilCtrl->setParameter($this, 'mail_id', $mail['mail_id']);
208  $ilCtrl->setParameter($this, 'mail_mode', $this->mail_mode);
209  $this->tpl->setVariable('NEW_MAIL_LINK_READ', $ilCtrl->getLinkTarget($this, 'showMail'));
210  $ilCtrl->clearParameters($this);
211  }
global $ilCtrl
Definition: ilias.php:18
Class for single dates.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date)
Format a date public.
static getUserObjectById($usr_id)
const IL_CAL_DATE
global $lng
Definition: privfeed.php:17
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getBlockType()

static ilPDMailBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

Definition at line 40 of file class.ilPDMailBlockGUI.php.

41  {
42  return self::$block_type;
43  }

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

Definition at line 83 of file class.ilPDMailBlockGUI.php.

References $html, $ilUser, and ilBlockGUI\getCurrentDetailLevel().

84  {
85  global $ilUser, $rbacsystem;
86 
87  $umail = new ilMail($ilUser->getId());
88  if(!$rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()))
89  {
90  return '';
91  }
92 
93  if($this->getCurrentDetailLevel() == 0)
94  {
95  return '';
96  }
97  else
98  {
99  $html = parent::getHTML();
100  return $html;
101  }
102  }
This class handles base functions for mail handling.
$ilUser
Definition: imgupload.php:18
$html
Definition: example_001.php:87
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getMails()

ilPDMailBlockGUI::getMails ( )
protected

Get Mails.

Definition at line 107 of file class.ilPDMailBlockGUI.php.

References $ilSetting, $ilUser, array, ilMail\getMailsOfFolder(), and ilObjMail\PD_SYS_MSG_MAIL_BLOCK.

Referenced by fillDataSection().

108  {
109  global $ilUser, $ilSetting;
110 
111  require_once 'Services/Mail/classes/class.ilObjMail.php';
112 
113  $umail = new ilMail($ilUser->getId());
114  $mbox = new ilMailBox($ilUser->getId());
115  $this->inbox = $mbox->getInboxFolder();
116 
117  $this->mails = $umail->getMailsOfFolder(
118  $this->inbox,
119  array(
120  'status' => 'unread',
121  'type' => ((int)$ilSetting->get('pd_sys_msg_mode')) != ilObjMail::PD_SYS_MSG_MAIL_BLOCK ? 'normal' : ''
122  )
123  );
124  }
This class handles base functions for mail handling.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
getMailsOfFolder($a_folder_id, $filter=array())
global $ilSetting
Definition: privfeed.php:17
const PD_SYS_MSG_MAIL_BLOCK
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverview()

ilPDMailBlockGUI::getOverview ( )
protected

Get overview.

Definition at line 216 of file class.ilPDMailBlockGUI.php.

References $lng.

Referenced by fillDataSection().

217  {
218  global $lng;
219 
220  return '<div class="small">' . ((int)count($this->mails)) . " " . $lng->txt("mails_pl") . "</div>";
221  }
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Definition at line 57 of file class.ilPDMailBlockGUI.php.

References $_GET, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

58  {
59  switch($_GET['cmd'])
60  {
61  case 'showMail':
62  return IL_SCREEN_CENTER;
63  break;
64 
65  default:
66  return IL_SCREEN_SIDE;
67  break;
68  }
69  }
$_GET["client_id"]
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ isRepositoryObject()

static ilPDMailBlockGUI::isRepositoryObject ( )
static

Get block type.

Returns
string Block type.

Definition at line 49 of file class.ilPDMailBlockGUI.php.

50  {
51  return false;
52  }

◆ preloadData()

ilPDMailBlockGUI::preloadData ( array  $data)
protected
Parameters
array$data

Definition at line 303 of file class.ilPDMailBlockGUI.php.

References array.

304  {
305  $usr_ids = array();
306 
307  foreach($data as $mail)
308  {
309  if($mail['sender_id'] && $mail['sender_id'] != ANONYMOUS_USER_ID)
310  {
311  $usr_ids[$mail['sender_id']] = $mail['sender_id'];
312  }
313  }
314 
315  ilMailUserCache::preloadUserObjects($usr_ids);
316  }
Create styles array
The data for the language used.

◆ showMail()

ilPDMailBlockGUI::showMail ( )
protected

show mail

Definition at line 226 of file class.ilPDMailBlockGUI.php.

References $_GET, $ilCtrl, $lng, and ilUtil\getImagePath().

227  {
228  global $lng, $ilCtrl;
229 
230  include_once("./Services/Mail/classes/class.ilPDMailGUI.php");
231  $mail_gui = new ilPDMailGUI();
232 
233  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
234  $content_block = new ilPDContentBlockGUI();
235  $content_block->setContent($mail_gui->getPDMailHTML($_GET["mail_id"],
236  $_GET["mobj_id"]));
237  $content_block->setTitle($lng->txt("message"));
238  $content_block->setColSpan(2);
239  $content_block->setImage(ilUtil::getImagePath("icon_mail.svg"));
240  $content_block->addHeaderCommand($ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "show"),
241  $lng->txt("selected_items_back"));
242 
243  if($_GET["mail_mode"] != "system")
244  {
245  $content_block->addBlockCommand("ilias.php?baseClass=ilMailGUI&mail_id=" .
246  $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=reply",
247  $lng->txt("reply"));
248  $content_block->addBlockCommand("ilias.php?baseClass=ilMailGUI&mail_id=" .
249  $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=read",
250  $lng->txt("inbox"));
251 
252  $ilCtrl->setParameter($this, 'mail_id', (int)$_GET['mail_id']);
253  $content_block->addBlockCommand($ilCtrl->getLinkTarget($this, 'deleteMail'), $lng->txt('delete'));
254 
255 
256  }
257  else
258  {
259  $ilCtrl->setParameter($this, "mail_id", $_GET["mail_id"]);
260  $ilCtrl->setParameter($this, "mobj_id", $_GET["mobj_id"]);
261  $content_block->addBlockCommand(
262  $ilCtrl->getLinkTarget($this, "deleteMail"),
263  $lng->txt("delete"));
264  $ilCtrl->clearParameters($this);
265  }
266 
267  return $content_block->getHTML();
268  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
Mail User Interface class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $lng
Definition: privfeed.php:17
BlockGUI class for (centered) Content on Personal Desktop.
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

ilPDMailBlockGUI::$block_type = 'pdmail'
static

Definition at line 15 of file class.ilPDMailBlockGUI.php.


The documentation for this class was generated from the following file: