ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

Protected Attributes

 $lng
 
 $user
 
 $ctrl
 
 $rbacsystem
 
 $setting
 
 $mails = array()
 
 $inbox
 
- 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
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 

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 55 of file class.ilPDMailBlockGUI.php.

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

56  {
57  global $DIC;
58 
59  $this->lng = $DIC->language();
60  $this->user = $DIC->user();
61  $this->ctrl = $DIC->ctrl();
62  $this->setting = $DIC->settings();
63  $this->rbacsystem = $DIC->rbac()->system();
64 
65  include_once 'Services/User/classes/class.ilObjUser.php';
66  include_once 'Services/Mail/classes/class.ilMailbox.php';
67  include_once 'Services/Mail/classes/class.ilMail.php';
68 
69  parent::__construct();
70 
71  $this->setLimit(5);
72  $this->setImage(ilUtil::getImagePath('icon_mail.svg'));
73  $this->setTitle($this->lng->txt('mail'));
74  $this->setAvailableDetailLevels(3);
75  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
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.
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteMail()

ilPDMailBlockGUI::deleteMail ( )

delete mail

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

References $_GET, array, ilUtil\sendInfo(), and user().

284  {
285  $this->lng->loadLanguageModule('mail');
286 
287  $umail = new ilMail($this->user->getId());
288  $mbox = new ilMailBox($this->user->getId());
289 
290  if (!$_GET['mobj_id']) {
291  $_GET['mobj_id'] = $mbox->getInboxFolder();
292  }
293 
294  if ($umail->moveMailsToFolder(
295  array($_GET['mail_id']),
296  $mbox->getTrashFolder()
297  )
298  ) {
299  ilUtil::sendInfo($this->lng->txt('mail_moved_to_trash'), true);
300  } else {
301  ilUtil::sendInfo($this->lng->txt('mail_move_error'), true);
302  }
303  $this->ctrl->redirectByClass('ilpersonaldesktopgui', 'show');
304  }
$_GET["client_id"]
user()
Definition: user.php:4
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.
+ Here is the call graph for this function:

◆ executeCommand()

ilPDMailBlockGUI::executeCommand ( )

execute command

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

115  {
116  $cmd = $this->ctrl->getCmd('getHTML');
117 
118  return $this->$cmd();
119  }

◆ fillDataSection()

ilPDMailBlockGUI::fillDataSection ( )

Fill data section.

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

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

160  {
161  $this->getMails();
162  $this->setData($this->mails);
163 
164  if ($this->getCurrentDetailLevel() > 1 && count($this->mails) > 0) {
165  $this->setRowTemplate("tpl.pd_mail_row.html", "Services/Mail");
166  if ($this->getCurrentDetailLevel() > 2) {
167  $this->setColSpan(2);
168  }
169  parent::fillDataSection();
170  } else {
171  $this->setEnableNumInfo(false);
172  if (count($this->mails) == 0) {
173  $this->setEnableDetailRow(false);
174  }
175  $this->setDataSection($this->getOverview());
176  }
177  }
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 182 of file class.ilPDMailBlockGUI.php.

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

183  {
184  $user = ilMailUserCache::getUserObjectById($mail['sender_id']);
185 
186  if ($this->getCurrentDetailLevel() > 2) {
187  $this->tpl->touchBlock('usr_image_space');
188  if ($user && $user->getId() != ANONYMOUS_USER_ID) {
189  $this->tpl->setVariable('PUBLIC_NAME_LONG', $user->getPublicName());
190  $this->tpl->setVariable('IMG_SENDER', $user->getPersonalPicturePath('xxsmall'));
191  $this->tpl->setVariable('ALT_SENDER', htmlspecialchars($user->getPublicName()));
192  } elseif (!$user) {
193  $this->tpl->setVariable('PUBLIC_NAME_LONG', $mail['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
194 
195  $this->tpl->setCurrentBlock('image_container');
196  $this->tpl->touchBlock('image_container');
197  $this->tpl->parseCurrentBlock();
198  } else {
199  $this->tpl->setVariable('PUBLIC_NAME_LONG', ilMail::_getIliasMailerName());
200  $this->tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.svg'));
201  $this->tpl->setVariable('ALT_SENDER', htmlspecialchars(ilMail::_getIliasMailerName()));
202  }
203 
204  $this->tpl->setVariable('NEW_MAIL_DATE', ilDatePresentation::formatDate(new ilDate($mail['send_time'], IL_CAL_DATE)));
205  } else {
206  if ($user && $user->getId() != ANONYMOUS_USER_ID) {
207  $this->tpl->setVariable('PUBLIC_NAME_SHORT', $user->getPublicName());
208  } elseif (!$user) {
209  $this->tpl->setVariable('PUBLIC_NAME_SHORT', $mail['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
210  } else {
211  $this->tpl->setVariable('PUBLIC_NAME_SHORT', ilMail::_getIliasMailerName());
212  }
213  }
214 
215  $this->tpl->setVariable('NEW_MAIL_SUBJ', htmlentities($mail['m_subject'], ENT_NOQUOTES, 'UTF-8'));
216  $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
217  $this->ctrl->setParameter($this, 'mail_id', $mail['mail_id']);
218  $this->ctrl->setParameter($this, 'mail_mode', $this->mail_mode);
219  $this->tpl->setVariable('NEW_MAIL_LINK_READ', $this->ctrl->getLinkTarget($this, 'showMail'));
220  $this->ctrl->clearParameters($this);
221  }
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
Class for single dates.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getUserObjectById($usr_id)
const IL_CAL_DATE
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 81 of file class.ilPDMailBlockGUI.php.

82  {
83  return self::$block_type;
84  }

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

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

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

122  {
123  $umail = new ilMail($this->user->getId());
124  if (!$this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
125  return '';
126  }
127 
128  if ($this->getCurrentDetailLevel() == 0) {
129  return '';
130  } else {
131  $html = parent::getHTML();
132  return $html;
133  }
134  }
user()
Definition: user.php:4
This class handles base functions for mail handling.
$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 139 of file class.ilPDMailBlockGUI.php.

References array, ilMail\getMailsOfFolder(), ilObjMail\PD_SYS_MSG_MAIL_BLOCK, and user().

Referenced by fillDataSection().

140  {
141  require_once 'Services/Mail/classes/class.ilObjMail.php';
142 
143  $umail = new ilMail($this->user->getId());
144  $mbox = new ilMailBox($this->user->getId());
145  $this->inbox = $mbox->getInboxFolder();
146 
147  $this->mails = $umail->getMailsOfFolder(
148  $this->inbox,
149  array(
150  'status' => 'unread',
151  'type' => ((int) $this->setting->get('pd_sys_msg_mode')) != ilObjMail::PD_SYS_MSG_MAIL_BLOCK ? 'normal' : ''
152  )
153  );
154  }
user()
Definition: user.php:4
This class handles base functions for mail handling.
Create styles array
The data for the language used.
getMailsOfFolder($a_folder_id, $filter=array())
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 226 of file class.ilPDMailBlockGUI.php.

Referenced by fillDataSection().

227  {
228  return '<div class="small">' . ((int) count($this->mails)) . " " . $this->lng->txt("mails_pl") . "</div>";
229  }
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

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

References $_GET, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

99  {
100  switch ($_GET['cmd']) {
101  case 'showMail':
102  return IL_SCREEN_CENTER;
103  break;
104 
105  default:
106  return IL_SCREEN_SIDE;
107  break;
108  }
109  }
$_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 90 of file class.ilPDMailBlockGUI.php.

91  {
92  return false;
93  }

◆ preloadData()

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

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

References array, and ilMailUserCache\preloadUserObjects().

310  {
311  $usr_ids = array();
312 
313  foreach ($data as $mail) {
314  if ($mail['sender_id'] && $mail['sender_id'] != ANONYMOUS_USER_ID) {
315  $usr_ids[$mail['sender_id']] = $mail['sender_id'];
316  }
317  }
318 
320  }
static preloadUserObjects(array $usr_ids)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ showMail()

ilPDMailBlockGUI::showMail ( )
protected

show mail

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

References $_GET, and ilUtil\getImagePath().

235  {
236  include_once("./Services/Mail/classes/class.ilPDMailGUI.php");
237  $mail_gui = new ilPDMailGUI();
238 
239  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
240  $content_block = new ilPDContentBlockGUI();
241  $content_block->setContent($mail_gui->getPDMailHTML(
242  $_GET["mail_id"],
243  $_GET["mobj_id"]
244  ));
245  $content_block->setTitle($this->lng->txt("message"));
246  $content_block->setColSpan(2);
247  $content_block->setImage(ilUtil::getImagePath("icon_mail.svg"));
248  $content_block->addHeaderCommand(
249  $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui", "show"),
250  $this->lng->txt("selected_items_back")
251  );
252 
253  if ($_GET["mail_mode"] != "system") {
254  $content_block->addBlockCommand(
255  "ilias.php?baseClass=ilMailGUI&mail_id=" .
256  $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=reply",
257  $this->lng->txt("reply")
258  );
259  $content_block->addBlockCommand(
260  "ilias.php?baseClass=ilMailGUI&mail_id=" .
261  $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=read",
262  $this->lng->txt("inbox")
263  );
264 
265  $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
266  $content_block->addBlockCommand($this->ctrl->getLinkTarget($this, 'deleteMail'), $this->lng->txt('delete'));
267  } else {
268  $this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
269  $this->ctrl->setParameter($this, "mobj_id", $_GET["mobj_id"]);
270  $content_block->addBlockCommand(
271  $this->ctrl->getLinkTarget($this, "deleteMail"),
272  $this->lng->txt("delete")
273  );
274  $this->ctrl->clearParameters($this);
275  }
276 
277  return $content_block->getHTML();
278  }
$_GET["client_id"]
Mail User Interface class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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.

◆ $ctrl

ilPDMailBlockGUI::$ctrl
protected

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

◆ $inbox

ilPDMailBlockGUI::$inbox
protected

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

Referenced by ilPDSysMessageBlockGUI\getMails().

◆ $lng

ilPDMailBlockGUI::$lng
protected

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

◆ $mails

ilPDMailBlockGUI::$mails = array()
protected

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

◆ $rbacsystem

ilPDMailBlockGUI::$rbacsystem
protected

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

◆ $setting

ilPDMailBlockGUI::$setting
protected

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

◆ $user

ilPDMailBlockGUI::$user
protected

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

Referenced by fillRow().


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