ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 getBlockType ()
 
Returns
string
More...
 
 executeCommand ()
 execute command More...
 
 getHTML ()
 Handle config status. More...
 
 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
 getBlockType ()
 
 __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 getScreenMode ()
 Get Screen Mode for current command. More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

static $block_type = 'pdmail'
 

Protected Member Functions

 isRepositoryObject ()
 Returns whether block has a corresponding repository object.
Returns
bool
More...
 
 getMails ()
 Get Mails. More...
 
 getOverview ()
 Get overview. More...
 
 showMail ()
 show mail More...
 
 preloadData (array $data)
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 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$ @ilCtrl_IsCalledBy ilPDMailBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDMailBlockGUI::__construct ( )

Constructor.

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

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

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'));
75 }
user()
Definition: user.php:4
setLimit($a_limit)
Set Limit.
setImage($a_image)
Set Image.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteMail()

ilPDMailBlockGUI::deleteMail ( )

delete mail

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

282 {
283 $this->lng->loadLanguageModule('mail');
284
285 $umail = new ilMail($this->user->getId());
286 $mbox = new ilMailbox($this->user->getId());
287
288 if (!$_GET['mobj_id']) {
289 $_GET['mobj_id'] = $mbox->getInboxFolder();
290 }
291
292 if ($umail->moveMailsToFolder(array((int) $_GET['mail_id']), (int) $mbox->getTrashFolder())) {
293 \ilUtil::sendInfo($this->lng->txt('mail_moved_to_trash'), true);
294 } else {
295 \ilUtil::sendInfo($this->lng->txt('mail_move_error'), true);
296 }
297 $this->ctrl->redirectByClass('ilpersonaldesktopgui', 'show');
298 }
$_GET["client_id"]
Mail Box class Base class for creating and handling mail boxes.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

◆ executeCommand()

ilPDMailBlockGUI::executeCommand ( )

execute command

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

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

◆ fillDataSection()

ilPDMailBlockGUI::fillDataSection ( )

Fill data section.

Reimplemented from ilBlockGUI.

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

158 {
159 $this->getMails();
160 $this->setData($this->mails);
161
162 if ($this->getCurrentDetailLevel() > 1 && count($this->mails) > 0) {
163 $this->setRowTemplate("tpl.pd_mail_row.html", "Services/Mail");
164 if ($this->getCurrentDetailLevel() > 2) {
165 $this->setColSpan(2);
166 }
167 parent::fillDataSection();
168 } else {
169 $this->setEnableNumInfo(false);
170 if (count($this->mails) == 0) {
171 $this->setEnableDetailRow(false);
172 }
173 $this->setDataSection($this->getOverview());
174 }
175 }
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
getCurrentDetailLevel()
Get Current Detail Level.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
setData($a_data)
Set Data.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setColSpan($a_colspan)
Set Columns Span.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.

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

+ Here is the call graph for this function:

◆ fillRow()

ilPDMailBlockGUI::fillRow (   $mail)

get flat bookmark list for personal desktop

Reimplemented from ilBlockGUI.

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

181 {
182 $user = ilMailUserCache::getUserObjectById($mail['sender_id']);
183
184 if ($this->getCurrentDetailLevel() > 2) {
185 $this->tpl->touchBlock('usr_image_space');
186 if ($user && $user->getId() != ANONYMOUS_USER_ID) {
187 $this->tpl->setVariable('PUBLIC_NAME_LONG', $user->getPublicName());
188 $this->tpl->setVariable('IMG_SENDER', $user->getPersonalPicturePath('xxsmall'));
189 $this->tpl->setVariable('ALT_SENDER', htmlspecialchars($user->getPublicName()));
190 } elseif (!$user) {
191 $this->tpl->setVariable('PUBLIC_NAME_LONG', $mail['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
192
193 $this->tpl->setCurrentBlock('image_container');
194 $this->tpl->touchBlock('image_container');
195 $this->tpl->parseCurrentBlock();
196 } else {
197 $this->tpl->setVariable('PUBLIC_NAME_LONG', ilMail::_getIliasMailerName());
198 $this->tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.svg'));
199 $this->tpl->setVariable('ALT_SENDER', htmlspecialchars(ilMail::_getIliasMailerName()));
200 }
201
202 $this->tpl->setVariable('NEW_MAIL_DATE', ilDatePresentation::formatDate(new ilDate($mail['send_time'], IL_CAL_DATE)));
203 } else {
204 if ($user && $user->getId() != ANONYMOUS_USER_ID) {
205 $this->tpl->setVariable('PUBLIC_NAME_SHORT', $user->getPublicName());
206 } elseif (!$user) {
207 $this->tpl->setVariable('PUBLIC_NAME_SHORT', $mail['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
208 } else {
209 $this->tpl->setVariable('PUBLIC_NAME_SHORT', ilMail::_getIliasMailerName());
210 }
211 }
212
213 $this->tpl->setVariable('NEW_MAIL_SUBJ', htmlentities($mail['m_subject'], ENT_NOQUOTES, 'UTF-8'));
214 $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
215 $this->ctrl->setParameter($this, 'mail_id', $mail['mail_id']);
216 $this->ctrl->setParameter($this, 'mail_mode', $this->mail_mode);
217 $this->tpl->setVariable('NEW_MAIL_LINK_READ', $this->ctrl->getLinkTarget($this, 'showMail'));
218 $this->ctrl->clearParameters($this);
219 }
const IL_CAL_DATE
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
Class for single dates.
static getUserObjectById($usr_id)

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

+ Here is the call graph for this function:

◆ getBlockType()

ilPDMailBlockGUI::getBlockType ( )

Returns
string

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

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

80 : string
81 {
82 return self::$block_type;
83 }

References $block_type.

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

Handle config status.

Get HTML.

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

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

120 {
121 $umail = new ilMail($this->user->getId());
122 if (!$this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
123 return '';
124 }
125
126 if ($this->getCurrentDetailLevel() == 0) {
127 return '';
128 } else {
129 $html = parent::getHTML();
130 return $html;
131 }
132 }
$html
Definition: example_001.php:87

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

+ Here is the call graph for this function:

◆ getMails()

ilPDMailBlockGUI::getMails ( )
protected

Get Mails.

Reimplemented in ilPDSysMessageBlockGUI.

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

138 {
139 require_once 'Services/Mail/classes/class.ilObjMail.php';
140
141 $umail = new ilMail($this->user->getId());
142 $mbox = new ilMailbox($this->user->getId());
143 $this->inbox = $mbox->getInboxFolder();
144
145 $this->mails = $umail->getMailsOfFolder(
146 $this->inbox,
147 array(
148 'status' => 'unread',
149 'type' => ((int) $this->setting->get('pd_sys_msg_mode')) != ilObjMail::PD_SYS_MSG_MAIL_BLOCK ? 'normal' : ''
150 )
151 );
152 }
const PD_SYS_MSG_MAIL_BLOCK

References ilObjMail\PD_SYS_MSG_MAIL_BLOCK, and user().

Referenced by fillDataSection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverview()

ilPDMailBlockGUI::getOverview ( )
protected

Get overview.

Reimplemented in ilPDSysMessageBlockGUI.

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

225 {
226 return '<div class="small">' . ((int) count($this->mails)) . " " . $this->lng->txt("mails_pl") . "</div>";
227 }

Referenced by fillDataSection().

+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Reimplemented from ilBlockGUI.

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

97 {
98 switch ($_GET['cmd']) {
99 case 'showMail':
100 return IL_SCREEN_CENTER;
101 break;
102
103 default:
104 return IL_SCREEN_SIDE;
105 break;
106 }
107 }
const IL_SCREEN_SIDE
const IL_SCREEN_CENTER

References $_GET, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

◆ isRepositoryObject()

ilPDMailBlockGUI::isRepositoryObject ( )
protected

Returns whether block has a corresponding repository object.

Returns
bool

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

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

88 : bool
89 {
90 return false;
91 }

◆ preloadData()

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

Reimplemented from ilBlockGUI.

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

304 {
305 $usr_ids = array();
306
307 foreach ($data as $mail) {
308 if ($mail['sender_id'] && $mail['sender_id'] != ANONYMOUS_USER_ID) {
309 $usr_ids[$mail['sender_id']] = $mail['sender_id'];
310 }
311 }
312
314 }
static preloadUserObjects(array $usr_ids)

References ilBlockGUI\$data, and ilMailUserCache\preloadUserObjects().

+ Here is the call graph for this function:

◆ showMail()

ilPDMailBlockGUI::showMail ( )
protected

show mail

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

233 {
234 include_once("./Services/Mail/classes/class.ilPDMailGUI.php");
235 $mail_gui = new ilPDMailGUI();
236
237 include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
238 $content_block = new ilPDContentBlockGUI();
239 $content_block->setContent($mail_gui->getPDMailHTML(
240 $_GET["mail_id"],
241 $_GET["mobj_id"]
242 ));
243 $content_block->setTitle($this->lng->txt("message"));
244 $content_block->setColSpan(2);
245 $content_block->setImage(ilUtil::getImagePath("icon_mail.svg"));
246 $content_block->addHeaderCommand(
247 $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui", "show"),
248 $this->lng->txt("selected_items_back")
249 );
250
251 if ($_GET["mail_mode"] != "system") {
252 $content_block->addBlockCommand(
253 "ilias.php?baseClass=ilMailGUI&mail_id=" .
254 $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=reply",
255 $this->lng->txt("reply")
256 );
257 $content_block->addBlockCommand(
258 "ilias.php?baseClass=ilMailGUI&mail_id=" .
259 $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=read",
260 $this->lng->txt("inbox")
261 );
262
263 $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
264 $content_block->addBlockCommand($this->ctrl->getLinkTarget($this, 'deleteMail'), $this->lng->txt('delete'));
265 } else {
266 $this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
267 $this->ctrl->setParameter($this, "mobj_id", $_GET["mobj_id"]);
268 $content_block->addBlockCommand(
269 $this->ctrl->getLinkTarget($this, "deleteMail"),
270 $this->lng->txt("delete")
271 );
272 $this->ctrl->clearParameters($this);
273 }
274
275 return $content_block->getHTML();
276 }
BlockGUI class for (centered) Content on Personal Desktop.
Mail User Interface class.

References $_GET, and ilUtil\getImagePath().

+ 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.

Referenced by getBlockType().

◆ $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: