ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 Get HTML. More...
 
 fillDataSection ()
 Fill data section. More...
 
 fillRow ($mail)
 get flat list for personal desktop More...
 
 deleteMail ()
 delete mail More...
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setPresentation (int $type)
 Set presentation. More...
 
 getPresentation ()
 Get presentation type. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. 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...
 
 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 (bool $a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. 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 ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 getHTML ()
 Get HTML. 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...
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 Get HTML. 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)
 
 getListItemForData (array $mail)
 Get list item for data array.
Parameters
array$data
Returns
null|\ILIAS\UI\Component\Item\Item
More...
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 initCommands ()
 Init commands. More...
 
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getViewControls ()
 Get view controls. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getNoItemFoundContent ()
 No item entry. More...
 

Protected Attributes

 $lng
 
 $user
 
 $ctrl
 
 $rbacsystem
 
 $setting
 
 $mails = array()
 
 $inbox
 
 $new_rendering = true
 
- Protected Attributes inherited from ilBlockGUI
 $ui
 
 $data = array()
 
 $enablenuminfo = true
 
 $footer_links = array()
 
 $block_id = 0
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $title = ""
 
 $admincommands = false
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 
 $presentation
 
 $new_rendering = false
 

Additional Inherited Members

- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 

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.

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
70
71 $this->setLimit(5);
72 $this->setTitle($this->lng->txt('mail'));
73 $this->setPresentation(self::PRES_SEC_LIST);
74 }
user()
Definition: user.php:4
setLimit($a_limit)
Set Limit.
setPresentation(int $type)
Set presentation.
setTitle($a_title)
Set Title.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setTitle(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteMail()

ilPDMailBlockGUI::deleteMail ( )

delete mail

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

244 {
245 $this->lng->loadLanguageModule('mail');
246
247 $umail = new ilMail($this->user->getId());
248 $mbox = new ilMailbox($this->user->getId());
249
250 if (!$_GET['mobj_id']) {
251 $_GET['mobj_id'] = $mbox->getInboxFolder();
252 }
253
254 if ($umail->moveMailsToFolder(array((int) $_GET['mail_id']), (int) $mbox->getTrashFolder())) {
255 \ilUtil::sendInfo($this->lng->txt('mail_moved_to_trash'), true);
256 } else {
257 \ilUtil::sendInfo($this->lng->txt('mail_move_error'), true);
258 }
259 $this->ctrl->redirectByClass('ildashboardgui', 'show');
260 }
$_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 111 of file class.ilPDMailBlockGUI.php.

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

◆ fillDataSection()

ilPDMailBlockGUI::fillDataSection ( )

Fill data section.

Reimplemented from ilBlockGUI.

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

154 {
155 $this->getMails();
156 $this->setData($this->mails);
157
158 if (count($this->mails) > 0) {
159 $this->setRowTemplate("tpl.pd_mail_row.html", "Services/Mail");
160 parent::fillDataSection();
161 } else {
162 $this->setEnableNumInfo(false);
163 $this->setDataSection($this->getOverview());
164 }
165 }
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setData($a_data)
Set Data.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.

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

+ Here is the call graph for this function:

◆ fillRow()

ilPDMailBlockGUI::fillRow (   $mail)

get flat list for personal desktop

Reimplemented from ilBlockGUI.

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

171 {
172 $user = ilMailUserCache::getUserObjectById($mail['sender_id']);
173
174 $this->tpl->touchBlock('usr_image_space');
175 if ($user && $user->getId() != ANONYMOUS_USER_ID) {
176 $this->tpl->setVariable('PUBLIC_NAME_LONG', $user->getPublicName());
177 $this->tpl->setVariable('IMG_SENDER', $user->getPersonalPicturePath('xxsmall'));
178 $this->tpl->setVariable('ALT_SENDER', htmlspecialchars($user->getPublicName()));
179 } elseif (!$user) {
180 $this->tpl->setVariable('PUBLIC_NAME_LONG', $mail['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
181
182 $this->tpl->setCurrentBlock('image_container');
183 $this->tpl->touchBlock('image_container');
184 $this->tpl->parseCurrentBlock();
185 } else {
186 $this->tpl->setVariable('PUBLIC_NAME_LONG', ilMail::_getIliasMailerName());
187 $this->tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.svg'));
188 $this->tpl->setVariable('ALT_SENDER', htmlspecialchars(ilMail::_getIliasMailerName()));
189 }
190
191 $this->tpl->setVariable('NEW_MAIL_DATE', ilDatePresentation::formatDate(new ilDate($mail['send_time'], IL_CAL_DATE)));
192
193 $this->tpl->setVariable('NEW_MAIL_SUBJ', htmlentities($mail['m_subject'], ENT_NOQUOTES, 'UTF-8'));
194 $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
195 $this->ctrl->setParameter($this, 'mail_id', $mail['mail_id']);
196 $this->tpl->setVariable('NEW_MAIL_LINK_READ', $this->ctrl->getLinkTarget($this, 'showMail'));
197 $this->ctrl->clearParameters($this);
198 }
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)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const ANONYMOUS_USER_ID
Definition: constants.php:25

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

+ Here is the call graph for this function:

◆ getBlockType()

ilPDMailBlockGUI::getBlockType ( )

Returns
string

Reimplemented from ilBlockGUI.

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

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

References $block_type.

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

Get HTML.

Reimplemented from ilBlockGUI.

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

119 {
120 $umail = new ilMail($this->user->getId());
121 if (!$this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
122 return '';
123 }
124
125 $this->getMails();
126 $this->setData($this->mails);
127
128 return parent::getHTML();
129 }

References getMails(), ilBlockGUI\setData(), and user().

+ Here is the call graph for this function:

◆ getListItemForData()

ilPDMailBlockGUI::getListItemForData ( array  $mail)
protected

Get list item for data array.

Parameters
array$data
Returns
null|\ILIAS\UI\Component\Item\Item

Reimplemented from ilBlockGUI.

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

289 {
290 $f = $this->ui->factory();
291
292 $user = ilMailUserCache::getUserObjectById($mail['sender_id']);
293
294 if ($user && $user->getId() != ANONYMOUS_USER_ID) {
295 $public_name_long = $user->getPublicName();
296 $img_sender = $user->getPersonalPicturePath('xxsmall');
297 $alt_sender = htmlspecialchars($user->getPublicName());
298 } elseif (!$user) {
299 $public_name_long = $mail['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')';
300 $img_sender = "";
301 $alt_sender = "";
302 } else {
303 $public_name_long = ilMail::_getIliasMailerName();
304 $img_sender = ilUtil::getImagePath('HeaderIconAvatar.svg');
305 $alt_sender = htmlspecialchars(ilMail::_getIliasMailerName());
306 }
307
308 $new_mail_date = ilDatePresentation::formatDate(new ilDate($mail['send_time'], IL_CAL_DATE));
309 $new_mail_subj = htmlentities($mail['m_subject'], ENT_NOQUOTES, 'UTF-8');
310 $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
311 $this->ctrl->setParameter($this, 'mail_id', $mail['mail_id']);
312 $new_mail_link = $this->ctrl->getLinkTarget($this, 'showMail', "", false, false);
313 $this->ctrl->clearParameters($this);
314
315
316 $button = $f->button()->shy($new_mail_subj, $new_mail_link);
317
318 $item = $f->item()->standard($button)->withDescription($new_mail_date);
319 if ($img_sender != "") {
320 $item = $item->withLeadImage($f->image()->standard($img_sender, $alt_sender));
321 }
322
323 return $item;
324 }
Common interface to all items.
Definition: Item.php:11
ui()
Definition: ui.php:5

References Vendor\Package\$f, $user, ANONYMOUS_USER_ID, ilDatePresentation\formatDate(), ilUtil\getImagePath(), ilMailUserCache\getUserObjectById(), IL_CAL_DATE, and ui().

+ Here is the call graph for this function:

◆ getMails()

ilPDMailBlockGUI::getMails ( )
protected

Get Mails.

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

135 {
136 require_once 'Services/Mail/classes/class.ilObjMail.php';
137
138 $umail = new ilMail($this->user->getId());
139 $mbox = new ilMailbox($this->user->getId());
140 $this->inbox = $mbox->getInboxFolder();
141
142 $this->mails = $umail->getMailsOfFolder(
143 $this->inbox,
144 array(
145 'status' => 'unread'
146 )
147 );
148 }

References user().

Referenced by fillDataSection(), and getHTML().

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

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

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

96 {
97 switch ($_GET['cmd']) {
98 case 'showMail':
99 return IL_SCREEN_CENTER;
100 break;
101
102 default:
103 return IL_SCREEN_SIDE;
104 break;
105 }
106 }
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.

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

87 : bool
88 {
89 return false;
90 }

◆ preloadData()

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

Reimplemented from ilBlockGUI.

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

266 {
267 $usr_ids = array();
268
269 foreach ($data as $mail) {
270 if ($mail['sender_id'] && $mail['sender_id'] != ANONYMOUS_USER_ID) {
271 $usr_ids[$mail['sender_id']] = $mail['sender_id'];
272 }
273 }
274
276 }
static preloadUserObjects(array $usr_ids)

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

+ Here is the call graph for this function:

◆ showMail()

ilPDMailBlockGUI::showMail ( )
protected

show mail

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

212 {
213 include_once("./Services/Mail/classes/class.ilPDMailGUI.php");
214 $mail_gui = new ilPDMailGUI();
215
216 $content_block = new ilDashboardContentBlockGUI();
217 $content_block->setContent($mail_gui->getPDMailHTML(
218 $_GET["mail_id"],
219 $_GET["mobj_id"]
220 ));
221 $content_block->setTitle($this->lng->txt("message"));
222
223 $content_block->addBlockCommand(
224 "ilias.php?baseClass=ilMailGUI&mail_id=" .
225 $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=reply",
226 $this->lng->txt("reply")
227 );
228 $content_block->addBlockCommand(
229 "ilias.php?baseClass=ilMailGUI&mail_id=" .
230 $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=read",
231 $this->lng->txt("inbox")
232 );
233
234 $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
235 $content_block->addBlockCommand($this->ctrl->getLinkTarget($this, 'deleteMail'), $this->lng->txt('delete'));
236
237 return $content_block->getHTML();
238 }
BlockGUI class for (centered) Content on Personal Desktop.
Mail User Interface class.

References $_GET.

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.

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

◆ $new_rendering

ilPDMailBlockGUI::$new_rendering = true
protected

Definition at line 282 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(), and getListItemForData().


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