ILIAS  release_8 Revision v8.24
ilPDMailBlockGUI Class Reference

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

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

Public Member Functions

 __construct ()
 
 getBlockType ()
 
 executeCommand ()
 
 getHTML ()
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow (array $a_set)
 
 deleteMail ()
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 correctOffset ()
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="")
 
 getBlockCommands ()
 
 getHTML ()
 
 fillHeaderCommands ()
 
 fillHeaderTitleBlock ()
 
 setDataSection (string $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 (array $a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 
 setPreviousNextLinks ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 
 getNoItemFoundContent ()
 

Static Public Member Functions

static getScreenMode ()
 
static getScreenMode ()
 

Static Public Attributes

static string $block_type = 'pdmail'
 

Protected Member Functions

 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 getMails ()
 
 getOverview ()
 
 showMail ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 fillRowColor (string $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...
 
 send (string $output)
 Send. More...
 

Protected Attributes

ilRbacSystem $rbacsystem
 
ilSetting $setting
 
array $mails = []
 
int $inbox
 
bool $new_rendering = true
 
- Protected Attributes inherited from ilBlockGUI
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 
bool $new_rendering = false
 

Private Attributes

GlobalHttpState $http
 
Refinery $refinery
 
int $requestMailObjId = 0
 

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
 
const PRES_MAIN_TILE = 4
 

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 @ilCtrl_IsCalledBy ilPDMailBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDMailBlockGUI::__construct ( )

Reimplemented from ilBlockGUI.

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

43 {
44 global $DIC;
45 $this->lng = $DIC->language();
46 $this->user = $DIC->user();
47 $this->ctrl = $DIC->ctrl();
48 $this->setting = $DIC->settings();
49 $this->rbacsystem = $DIC->rbac()->system();
50 $this->http = $DIC->http();
51 $this->refinery = $DIC->refinery();
52
54
55 $this->setLimit(5);
56 $this->setTitle($this->lng->txt('mail'));
57 $this->setPresentation(self::PRES_SEC_LIST);
58 }
setTitle(string $a_title)
setPresentation(int $type)
setLimit(int $a_limit)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setTitle(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteMail()

ilPDMailBlockGUI::deleteMail ( )

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

217 : void
218 {
219 $this->lng->loadLanguageModule('mail');
220
221 $umail = new ilMail($this->user->getId());
222 $mbox = new ilMailbox($this->user->getId());
223
224 $mailId = 0;
225 if ($this->http->wrapper()->query()->has('mail_id')) {
226 $mailId = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
227 }
228 $mobjId = 0;
229 if ($this->http->wrapper()->query()->has('mobj_id')) {
230 $mobjId = $this->http->wrapper()->query()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
231 }
232
233 if ($mobjId) {
234 $this->requestMailObjId = $mbox->getInboxFolder();
235 }
236
237 if ($umail->moveMailsToFolder(
238 [$mailId],
239 $mbox->getTrashFolder()
240 )) {
241 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('mail_moved_to_trash'), true);
242 } else {
243 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('mail_move_error'), true);
244 }
245 $this->ctrl->redirectByClass(ilDashboardGUI::class, 'show');
246 }
Mail Box class Base class for creating and handling mail boxes.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ executeCommand()

ilPDMailBlockGUI::executeCommand ( )

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

84 : string
85 {
86 $cmd = $this->ctrl->getCmd('getHTML');
87
88 return $this->$cmd();
89 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ fillDataSection()

ilPDMailBlockGUI::fillDataSection ( )

Standard implementation for row based data.

Overwrite this and call setContent for other data.

Reimplemented from ilBlockGUI.

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

118 : void
119 {
120 $this->getMails();
121 $this->setData($this->mails);
122
123 if (count($this->mails) > 0) {
124 $this->setRowTemplate("tpl.pd_mail_row.html", "Services/Mail");
125 parent::fillDataSection();
126 } else {
127 $this->setEnableNumInfo(false);
128 $this->setDataSection($this->getOverview());
129 }
130 }
setData(array $a_data)
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setEnableNumInfo(bool $a_enablenuminfo)
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.

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

+ Here is the call graph for this function:

◆ fillRow()

ilPDMailBlockGUI::fillRow ( array  $a_set)

Reimplemented from ilBlockGUI.

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

132 : void
133 {
134 $user = ilMailUserCache::getUserObjectById((int) $a_set['sender_id']);
135
136 $this->tpl->touchBlock('usr_image_space');
137 if ($user && $user->getId() !== ANONYMOUS_USER_ID) {
138 $this->tpl->setVariable('PUBLIC_NAME_LONG', $user->getPublicName());
139 $this->tpl->setVariable('IMG_SENDER', $user->getPersonalPicturePath('xxsmall'));
140 $this->tpl->setVariable('ALT_SENDER', htmlspecialchars($user->getPublicName()));
141 } elseif (!$user) {
142 $this->tpl->setVariable(
143 'PUBLIC_NAME_LONG',
144 trim(($a_set['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')')
145 );
146
147 $this->tpl->setCurrentBlock('image_container');
148 $this->tpl->touchBlock('image_container');
149 $this->tpl->parseCurrentBlock();
150 } else {
151 $this->tpl->setVariable('PUBLIC_NAME_LONG', ilMail::_getIliasMailerName());
152 $this->tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.svg'));
153 $this->tpl->setVariable('ALT_SENDER', htmlspecialchars(ilMail::_getIliasMailerName()));
154 }
155
156 $this->tpl->setVariable(
157 'NEW_MAIL_DATE',
158 ilDatePresentation::formatDate(new ilDate($a_set['send_time'], IL_CAL_DATE))
159 );
160
161 $this->tpl->setVariable(
162 'NEW_MAIL_SUBJ',
163 htmlentities($a_set['m_subject'], ENT_NOQUOTES, 'UTF-8')
164 );
165 $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
166 $this->ctrl->setParameter($this, 'mail_id', $a_set['mail_id']);
167 $this->tpl->setVariable('NEW_MAIL_LINK_READ', $this->ctrl->getLinkTarget($this, 'showMail'));
168 $this->ctrl->clearParameters($this);
169 }
const IL_CAL_DATE
ilObjUser $user
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
Class for single dates.
static getUserObjectById(int $usr_id)
getPersonalPicturePath(string $a_size="small", bool $a_force_pic=false)
getPublicName()
returns firstname lastname and login if profile is public, login otherwise
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
const ANONYMOUS_USER_ID
Definition: constants.php:27

References ilBlockGUI\$user, ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilObject\getId(), ilUtil\getImagePath(), ilObjUser\getPersonalPicturePath(), ilObjUser\getPublicName(), ilMailUserCache\getUserObjectById(), IL_CAL_DATE, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getBlockType()

ilPDMailBlockGUI::getBlockType ( )

Reimplemented from ilBlockGUI.

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

60 : string
61 {
62 return self::$block_type;
63 }

References $block_type.

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

Reimplemented from ilBlockGUI.

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

91 : string
92 {
93 $umail = new ilMail($this->user->getId());
94 if (!$this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
95 return '';
96 }
97
98 $this->getMails();
99 $this->setData($this->mails);
100
101 return parent::getHTML();
102 }

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

+ Here is the call graph for this function:

◆ getListItemForData()

ilPDMailBlockGUI::getListItemForData ( array  $data)
protected

Get list item for data array.

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

Reimplemented from ilBlockGUI.

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

267 : ?Item
268 {
269 $f = $this->ui->factory();
270
272
273 if ($user && $user->getId() !== ANONYMOUS_USER_ID) {
274 $public_name_long = $user->getPublicName();
275 $img_sender = $user->getPersonalPicturePath('xxsmall');
276 $alt_sender = htmlspecialchars($user->getPublicName());
277 } elseif (!$user) {
278 $public_name_long = trim(($data['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')');
279 $img_sender = "";
280 $alt_sender = "";
281 } else {
282 $public_name_long = ilMail::_getIliasMailerName();
283 $img_sender = ilUtil::getImagePath('HeaderIconAvatar.svg');
284 $alt_sender = htmlspecialchars(ilMail::_getIliasMailerName());
285 }
286
287 $new_mail_date = ilDatePresentation::formatDate(new ilDate($data['send_time'], IL_CAL_DATE));
288 $new_mail_subj = htmlentities($data['m_subject'], ENT_NOQUOTES, 'UTF-8');
289 $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
290 $this->ctrl->setParameter($this, 'mail_id', $data['mail_id']);
291 $new_mail_link = $this->ctrl->getLinkTarget($this, 'showMail');
292 $this->ctrl->clearParameters($this);
293
294
295 $button = $f->button()->shy($new_mail_subj, $new_mail_link);
296
297 $item = $f->item()->standard($button)->withDescription($new_mail_date);
298 if ($img_sender !== "") {
299 $item = $item->withLeadImage($f->image()->standard($img_sender, $alt_sender));
300 }
301
302 return $item;
303 }
Common interface to all items.
Definition: Item.php:32

References ilBlockGUI\$data, Vendor\Package\$f, ilBlockGUI\$user, ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilObject\getId(), ilUtil\getImagePath(), ilObjUser\getPersonalPicturePath(), ilObjUser\getPublicName(), ilMailUserCache\getUserObjectById(), IL_CAL_DATE, ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getMails()

ilPDMailBlockGUI::getMails ( )
protected

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

104 : void
105 {
106 $umail = new ilMail($this->user->getId());
107 $mbox = new ilMailbox($this->user->getId());
108 $this->inbox = $mbox->getInboxFolder();
109
110 $this->mails = $umail->getMailsOfFolder(
111 $this->inbox,
112 [
113 'status' => 'unread',
114 ]
115 );
116 }

References ILIAS\Repository\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

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

171 : string
172 {
173 return '<div class="small">' . (count($this->mails)) . " " . $this->lng->txt("mails_pl") . "</div>";
174 }

References ILIAS\Repository\lng().

Referenced by fillDataSection().

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

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

Reimplemented from ilBlockGUI.

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

70 : string
71 {
72 global $DIC;
73 $cmd = "";
74 if ($DIC->http()->wrapper()->query()->has('cmd')) {
75 $cmd = $DIC->http()->wrapper()->query()->retrieve('cmd', $DIC->refinery()->kindlyTo()->string());
76 }
77 if ($cmd === 'showMail') {
78 return IL_SCREEN_CENTER;
79 }
80
81 return IL_SCREEN_SIDE;
82 }
const IL_SCREEN_SIDE
const IL_SCREEN_CENTER

References $DIC, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

◆ isRepositoryObject()

ilPDMailBlockGUI::isRepositoryObject ( )
protected

Returns whether block has a corresponding repository object.

Reimplemented from ilBlockGUI.

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

65 : bool
66 {
67 return false;
68 }

◆ preloadData()

ilPDMailBlockGUI::preloadData ( array  $data)
protected

Can be overwritten in subclasses.

Only the visible part of the complete data was passed so a preload of the visible data is possible.

Parameters
array$data

Reimplemented from ilBlockGUI.

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

248 : void
249 {
250 $usr_ids = [];
251
252 foreach ($data as $mail) {
253 if ($mail['sender_id'] && $mail['sender_id'] !== ANONYMOUS_USER_ID) {
254 $usr_ids[$mail['sender_id']] = $mail['sender_id'];
255 }
256 }
257
259 }
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

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

176 : string
177 {
178 $mail_gui = new ilPDMailGUI();
179
180 $content_block = new ilDashboardContentBlockGUI();
181 $mailId = 0;
182 if ($this->http->wrapper()->query()->has('mail_id')) {
183 $mailId = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
184 }
185 $mobjId = $this->requestMailObjId;
186 if ($this->http->wrapper()->query()->has('mobj_id')) {
187 $mobjId = $this->http->wrapper()->query()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
188 }
189 $content_block->setContent($mail_gui->getPDMailHTML(
190 $mailId,
191 $mobjId
192 ));
193 $content_block->setTitle($this->lng->txt("message"));
194
195 $content_block->addBlockCommand(
196 "ilias.php?baseClass=ilMailGUI&mail_id=" .
197 $mailId . "&mobj_id="
198 . $mobjId . "&type=reply",
199 $this->lng->txt("reply")
200 );
201 $content_block->addBlockCommand(
202 "ilias.php?baseClass=ilMailGUI&mail_id=" .
203 $mailId . "&mobj_id="
204 . $mobjId . "&type=read",
205 $this->lng->txt("inbox")
206 );
207
208 $this->ctrl->setParameter($this, 'mail_id', $mailId);
209 $content_block->addBlockCommand(
210 $this->ctrl->getLinkTarget($this, 'deleteMail'),
211 $this->lng->txt('delete')
212 );
213
214 return $content_block->getHTML();
215 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Mail User Interface class.

References $requestMailObjId, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Field Documentation

◆ $block_type

string ilPDMailBlockGUI::$block_type = 'pdmail'
static

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

Referenced by getBlockType().

◆ $http

GlobalHttpState ilPDMailBlockGUI::$http
private

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

◆ $inbox

int ilPDMailBlockGUI::$inbox
protected

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

◆ $mails

array ilPDMailBlockGUI::$mails = []
protected

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

◆ $new_rendering

bool ilPDMailBlockGUI::$new_rendering = true
protected

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

◆ $rbacsystem

ilRbacSystem ilPDMailBlockGUI::$rbacsystem
protected

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

◆ $refinery

Refinery ilPDMailBlockGUI::$refinery
private

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

◆ $requestMailObjId

int ilPDMailBlockGUI::$requestMailObjId = 0
private

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

Referenced by showMail().

◆ $setting

ilSetting ilPDMailBlockGUI::$setting
protected

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


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