4 require_once
'Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Services/Mail/classes/class.ilMailUserCache.php';
35 public function __construct($a_parent_obj, $a_current_folder_id, $a_parent_cmd =
'')
46 $this->_currentFolderId = $a_current_folder_id;
47 $this->_parentObject = $a_parent_obj;
49 $this->
setId(
'mail_folder_tbl');
54 $this->
setFormAction($this->ctrl->getFormAction($this->_parentObject,
'showFolder'));
62 $this->
setRowTemplate(
'tpl.mail_folder_row.html',
'Services/Mail');
77 $this->
addColumn($this->lng->txt(
'personal_picture'),
'',
'10%');
79 $this->
addColumn($this->lng->txt(
'recipient'),
'rcp_to',
'25%');
81 $this->
addColumn($this->lng->txt(
'sender'),
'from',
'25%');
82 $this->
addColumn($this->lng->txt(
'subject'),
'm_subject',
'40%');
83 $this->
addColumn($this->lng->txt(
'date'),
'send_time',
'20%');
86 $mtree =
new ilTree($ilUser->getId());
88 $this->_folderNode = $mtree->getNodeData($this->_currentFolderId);
97 $this->
initMultiCommands($this->_parentObject->mbox->getActions($this->_currentFolderId));
116 $this->_isDraftsFolder = $a_bool;
135 $this->_isSentFolder = $a_bool;
154 $this->_isTrashFolder = $a_bool;
168 if($this->_folderNode[
'm_type'] ==
'trash' && $this->
getNumerOfMails() > 0)
170 $this->
addCommandButton(
'askForEmptyTrash', $this->lng->txt(
'mail_empty_trash'));
185 foreach($actions as $key => $action)
187 if($key ==
'moveMails')
189 $folders = $this->_parentObject->mbox->getSubFolders();
190 foreach($folders as $folder)
192 if($folder[
'type'] !=
'trash' ||
196 if($folder[
'type'] !=
'user_folder')
198 $label = $action .
' ' . $this->lng->txt(
'mail_' . $folder[
'title']) .
199 ($folder[
'type'] ==
'trash' ?
' (' . $this->lng->txt(
'delete') .
')' :
'');
203 $this->
addMultiCommand($folder[
'obj_id'], $action .
' ' . $folder[
'title']);
226 $this->_selectedItems = $a_selected_items;
254 require_once
'Services/Mail/classes/class.ilMailBoxQuery.php';
276 foreach(
$data[
'set'] as $mail)
278 if($mail[
'sender_id'] && $mail[
'sender_id'] != ANONYMOUS_USER_ID)
280 $user_ids[$mail[
'sender_id']] = $mail[
'sender_id'];
284 ilMailUserCache::preloadUserObjects($user_ids);
288 foreach(
$data[
'set'] as $key => $mail)
294 $mail[
'checked'] =
' checked="checked" ';
299 $mail[
'rcp_to'] = $mail[
'mail_login'] = $this->_parentObject->umail->formatNamesForOutput($mail[
'rcp_to']);
303 if($mail[
'sender_id'] == ANONYMOUS_USER_ID)
306 $mail[
'from'] = $mail[
'mail_login'] = $mail[
'alt_sender'] = ilMail::_getIliasMailerName();
313 $mail[
'img_sender'] = $user->getPersonalPicturePath(
'xxsmall');
314 $mail[
'from'] = $mail[
'mail_login'] = $mail[
'alt_sender'] = $user->getPublicName();
318 $mail[
'from'] = $mail[
'mail_login'] = $mail[
'import_name'] .
' (' . $this->lng->txt(
'user_deleted') .
')';
322 $mail[
'mailclass'] = $mail[
'm_status'] ==
'read' ?
'mailread' :
'mailunread';
326 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mail_id', $mail[
'mail_id']);
327 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'draft');
328 $mail[
'mail_link_read'] = $this->ctrl->getLinkTargetByClass(
'ilmailformgui');
329 $this->ctrl->clearParametersByClass(
'ilmailformgui');
333 $this->ctrl->setParameter($this->_parentObject,
'mail_id', $mail[
'mail_id']);
334 $mail[
'mail_link_read'] = $this->ctrl->getLinkTarget($this->_parentObject,
'showMail');
335 $this->ctrl->clearParameters($this->_parentObject);
338 $mail[
'mail_subject'] = htmlspecialchars($mail[
'm_subject']);
341 $data[
'set'][$key] = $mail;
351 if($this->_folderNode[
'm_type'] ==
'user_folder')
353 $txt_folder = $this->_folderNode[
'title'];
354 $img_folder =
'icon_user_folder.png';
358 $txt_folder = $this->lng->txt(
'mail_' . $this->_folderNode[
'title']);
359 $img_folder =
'icon' . substr($this->_folderNode[
'title'], 1) .
'.png';
376 protected function setTitleData($folderLabel, $mailCount, $unreadCount, $imgFolder)
378 $titleTemplate =
new ilTemplate(
'tpl.mail_folder_title.html',
true,
true,
'Services/Mail');
379 $titleTemplate->setVariable(
'TXT_FOLDER', $folderLabel);
380 $titleTemplate->setVariable(
'MAIL_COUNT', $mailCount);
381 $titleTemplate->setVariable(
'TXT_MAIL_S', $this->lng->txt(
'mail_s'));
382 $titleTemplate->setVariable(
'MAIL_COUNT_UNREAD', $unreadCount);
383 $titleTemplate->setVariable(
'TXT_UNREAD', $this->lng->txt(
'unread'));
399 $this->_number_of_mails = $a_number_of_mails;
423 foreach($a_set as $key => $value)
425 $this->tpl->setVariable(strtoupper($key), $value);