ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 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 ()
 
 checkOffset (int $offset)
 
 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="", RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Member Functions

static getScreenMode ()
 
- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 

Static Public Attributes

static string $block_type = 'pdmail'
 

Protected Member Functions

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

Protected Attributes

ilRbacSystem $rbacsystem
 
ilSetting $setting
 
array $mails = []
 
int $inbox
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
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
 

Private Attributes

readonly GlobalHttpState $http
 
readonly Refinery $refinery
 
int $requestMailObjId = 0
 
bool $has_access = 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
 
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 ilPDMailBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDMailBlockGUI::__construct ( )

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

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\ctrl(), getMails(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilBlockGUI\setData(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setTitle(), and ILIAS\Repository\user().

45  {
46  global $DIC;
47  $this->lng = $DIC->language();
48  $this->user = $DIC->user();
49  $this->ctrl = $DIC->ctrl();
50  $this->setting = $DIC->settings();
51  $this->rbacsystem = $DIC->rbac()->system();
52  $this->http = $DIC->http();
53  $this->refinery = $DIC->refinery();
54 
56 
57  $this->setLimit(5);
58  $this->setTitle($this->lng->txt('mail'));
59  $this->setPresentation(self::PRES_SEC_LIST);
60 
61  $umail = new ilMail($this->user->getId());
62  if ($this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
63  $this->has_access = true;
64  $this->getMails();
65  $this->setData($this->mails);
66  }
67  }
setLimit(int $a_limit)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__construct(VocabulariesInterface $vocabularies)
setTitle(string $a_title)
setData(array $a_data)
setPresentation(int $type)
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteMail()

ilPDMailBlockGUI::deleteMail ( )

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

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

169  : void
170  {
171  $this->lng->loadLanguageModule('mail');
172 
173  $umail = new ilMail($this->user->getId());
174  $mbox = new ilMailbox($this->user->getId());
175 
176  $mailId = 0;
177  if ($this->http->wrapper()->query()->has('mail_id')) {
178  $mailId = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
179  }
180  $mobjId = 0;
181  if ($this->http->wrapper()->query()->has('mobj_id')) {
182  $mobjId = $this->http->wrapper()->query()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
183  }
184 
185  if ($mobjId) {
186  $this->requestMailObjId = $mbox->getInboxFolder();
187  }
188 
189  if ($umail->moveMailsToFolder(
190  [$mailId],
191  $mbox->getTrashFolder()
192  )) {
193  $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('mail_moved_to_trash'), true);
194  } else {
195  $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('mail_move_error'), true);
196  }
197  $this->ctrl->redirectByClass(ilDashboardGUI::class, 'show');
198  }
static http()
Fetches the global http state from ILIAS.
Mail Box class Base class for creating and handling mail boxes.
+ Here is the call graph for this function:

◆ executeCommand()

ilPDMailBlockGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

93  : string
94  {
95  $cmd = $this->ctrl->getCmd('getHTML');
96 
97  return $this->$cmd();
98  }
+ Here is the call graph for this function:

◆ getBlockType()

ilPDMailBlockGUI::getBlockType ( )

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

69  : string
70  {
71  return self::$block_type;
72  }

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

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

100  : string
101  {
102  if (!$this->has_access) {
103  return '';
104  }
105  return parent::getHTML();
106  }

◆ getListItemForData()

ilPDMailBlockGUI::getListItemForData ( array  $data)
protected

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

References Vendor\Package\$f, ilBlockGUI\$user, ilMail\_getIliasMailerName(), 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().

213  : ?Item
214  {
215  $f = $this->ui->factory();
216 
218 
219  if ($user && $user->getId() !== ANONYMOUS_USER_ID) {
220  $public_name_long = $user->getPublicName();
221  $img_sender = $user->getPersonalPicturePath('xxsmall');
222  $alt_sender = htmlspecialchars($user->getPublicName());
223  } elseif (!$user instanceof ilObjUser) {
224  $public_name_long = trim(($data['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')');
225  $img_sender = "";
226  $alt_sender = "";
227  } else {
228  $public_name_long = ilMail::_getIliasMailerName();
229  $img_sender = ilUtil::getImagePath('logo/HeaderIconAvatar.svg');
230  $alt_sender = htmlspecialchars(ilMail::_getIliasMailerName());
231  }
232 
233  $new_mail_date = ilDatePresentation::formatDate(new ilDate($data['send_time'], IL_CAL_DATE));
234  $new_mail_subj = htmlentities($data['m_subject'], ENT_NOQUOTES, 'UTF-8');
235  $this->ctrl->setParameter($this, 'mobj_id', $this->inbox);
236  $this->ctrl->setParameter($this, 'mail_id', $data['mail_id']);
237  $new_mail_link = $this->ctrl->getLinkTarget($this, 'showMail');
238  $this->ctrl->clearParameters($this);
239 
240 
241  $button = $f->button()->shy($new_mail_subj, $new_mail_link);
242 
243  $item = $f->item()->standard($button)->withDescription($new_mail_date);
244  if ($img_sender !== "") {
245  $item = $item->withLeadImage($f->image()->standard($img_sender, $alt_sender));
246  }
247 
248  return $item;
249  }
ilObjUser $user
const ANONYMOUS_USER_ID
Definition: constants.php:27
static getUserObjectById(int $usr_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _getIliasMailerName()
getPublicName()
returns firstname lastname and login if profile is public, login otherwise
Common interface to all items.
Definition: Item.php:31
getPersonalPicturePath(string $a_size="small", bool $a_force_pic=false)
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getMails()

ilPDMailBlockGUI::getMails ( )
protected

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

References ilMail\getMailsOfFolder(), and ILIAS\Repository\user().

Referenced by __construct().

108  : void
109  {
110  $umail = new ilMail($this->user->getId());
111  $mbox = new ilMailbox($this->user->getId());
112  $this->inbox = $mbox->getInboxFolder();
113 
114  $this->mails = $umail->getMailsOfFolder(
115  $this->inbox,
116  [
117  'status' => 'unread',
118  ]
119  );
120  $this->max_count = count($this->mails);
121  }
getMailsOfFolder(int $a_folder_id, array $filter=[])
Mail Box class Base class for creating and handling mail boxes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverview()

ilPDMailBlockGUI::getOverview ( )
protected

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

References ILIAS\Repository\lng().

123  : string
124  {
125  return '<div class="small">' . (count($this->mails)) . " " . $this->lng->txt("mails_pl") . "</div>";
126  }
+ Here is the call graph for this function:

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

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

References $DIC, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

79  : string
80  {
81  global $DIC;
82  $cmd = "";
83  if ($DIC->http()->wrapper()->query()->has('cmd')) {
84  $cmd = $DIC->http()->wrapper()->query()->retrieve('cmd', $DIC->refinery()->kindlyTo()->string());
85  }
86  if ($cmd === 'showMail') {
87  return IL_SCREEN_CENTER;
88  }
89 
90  return IL_SCREEN_SIDE;
91  }
global $DIC
Definition: feed.php:28
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ isRepositoryObject()

ilPDMailBlockGUI::isRepositoryObject ( )
protected

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

74  : bool
75  {
76  return false;
77  }

◆ preloadData()

ilPDMailBlockGUI::preloadData ( array  $data)
protected

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

References ANONYMOUS_USER_ID, and ilMailUserCache\preloadUserObjects().

200  : void
201  {
202  $usr_ids = [];
203 
204  foreach ($data as $mail) {
205  if ($mail['sender_id'] && $mail['sender_id'] !== ANONYMOUS_USER_ID) {
206  $usr_ids[$mail['sender_id']] = $mail['sender_id'];
207  }
208  }
209 
211  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
static preloadUserObjects(array $usr_ids)
+ Here is the call graph for this function:

◆ showMail()

ilPDMailBlockGUI::showMail ( )
protected

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

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

128  : string
129  {
130  $mail_gui = new ilPDMailGUI();
131 
132  $content_block = new ilDashboardContentBlockGUI();
133  $mailId = 0;
134  if ($this->http->wrapper()->query()->has('mail_id')) {
135  $mailId = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
136  }
137  $mobjId = $this->requestMailObjId;
138  if ($this->http->wrapper()->query()->has('mobj_id')) {
139  $mobjId = $this->http->wrapper()->query()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
140  }
141  $content_block->setContent($mail_gui->getPDMailHTML(
142  $mailId,
143  $mobjId
144  ));
145  $content_block->setTitle($this->lng->txt("message"));
146 
147  $content_block->addBlockCommand(
148  "ilias.php?baseClass=ilMailGUI&mail_id=" .
149  $mailId . "&mobj_id="
150  . $mobjId . "&type=reply",
151  $this->lng->txt("reply")
152  );
153  $content_block->addBlockCommand(
154  "ilias.php?baseClass=ilMailGUI&mail_id=" .
155  $mailId . "&mobj_id="
156  . $mobjId . "&type=read",
157  $this->lng->txt("inbox")
158  );
159 
160  $this->ctrl->setParameter($this, 'mail_id', $mailId);
161  $content_block->addBlockCommand(
162  $this->ctrl->getLinkTarget($this, 'deleteMail'),
163  $this->lng->txt('delete')
164  );
165 
166  return $content_block->getHTML();
167  }
Mail User Interface class.
static http()
Fetches the global http state from ILIAS.
+ 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.

◆ $has_access

bool ilPDMailBlockGUI::$has_access = false
private

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

◆ $http

readonly GlobalHttpState ilPDMailBlockGUI::$http
private

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

◆ $inbox

int ilPDMailBlockGUI::$inbox
protected

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

◆ $mails

array ilPDMailBlockGUI::$mails = []
protected

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

◆ $rbacsystem

ilRbacSystem ilPDMailBlockGUI::$rbacsystem
protected

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

◆ $refinery

readonly Refinery ilPDMailBlockGUI::$refinery
private

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

◆ $requestMailObjId

int ilPDMailBlockGUI::$requestMailObjId = 0
private

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

Referenced by showMail().

◆ $setting

ilSetting ilPDMailBlockGUI::$setting
protected

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


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