4 require_once
'Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Services/Mail/classes/class.ilMailUserCache.php';
6 require_once
'Services/Mail/classes/class.ilMailBoxQuery.php';
46 public function __construct($a_parent_obj, $a_current_folder_id, $a_parent_cmd =
'')
57 $this->_currentFolderId = $a_current_folder_id;
58 $this->_parentObject = $a_parent_obj;
60 $this->
setId(
'mail_folder_tbl_'.$a_current_folder_id);
70 $this->
setFormAction($this->ctrl->getFormAction($this->_parentObject,
'showFolder'));
74 $this->
setRowTemplate(
'tpl.mail_folder_row.html',
'Services/Mail');
92 $this->
addColumn($this->lng->txt(
'personal_picture'),
'',
'10%');
94 $this->
addColumn($this->lng->txt(
'recipient'),
'rcp_to',
'25%');
96 $this->
addColumn($this->lng->txt(
'sender'),
'from',
'25%');
100 $this->
addColumn($this->lng->txt(
'search_content'),
'',
'40%');
104 $this->
addColumn($this->lng->txt(
'subject'),
'm_subject',
'40%');
106 $this->
addColumn($this->lng->txt(
'date'),
'send_time',
'20%');
109 $mtree =
new ilTree($ilUser->getId());
111 $this->_folderNode = $mtree->getNodeData($this->_currentFolderId);
114 $this->fetchTableData();
120 $this->
initMultiCommands($this->_parentObject->mbox->getActions($this->_currentFolderId));
139 $this->_isDraftsFolder = $a_bool;
158 $this->_isSentFolder = $a_bool;
177 $this->_isTrashFolder = $a_bool;
191 if($this->_folderNode[
'm_type'] ==
'trash' && $this->
getNumerOfMails() > 0)
193 $this->
addCommandButton(
'askForEmptyTrash', $this->lng->txt(
'mail_empty_trash'));
208 foreach($actions as $key => $action)
210 if($key ==
'moveMails')
212 $folders = $this->_parentObject->mbox->getSubFolders();
213 foreach($folders as $folder)
215 if($folder[
'type'] !=
'trash' ||
219 if($folder[
'type'] !=
'user_folder')
221 $label = $action .
' ' . $this->lng->txt(
'mail_' . $folder[
'title']) .
222 ($folder[
'type'] ==
'trash' ?
' (' . $this->lng->txt(
'delete') .
')' :
'');
226 $this->
addMultiCommand($folder[
'obj_id'], $action .
' ' . $folder[
'title']);
249 $this->_selectedItems = $a_selected_items;
270 include_once
'Services/Search/classes/class.ilSearchSettings.php';
283 protected function fetchTableData()
291 if($this->_folderNode[
'm_type'] ==
'user_folder')
293 $txt_folder = $this->_folderNode[
'title'];
294 $img_folder =
'icon_user_folder.png';
298 $txt_folder = $this->lng->txt(
'mail_' . $this->_folderNode[
'title']);
299 $img_folder =
'icon' . substr($this->_folderNode[
'title'], 1) .
'.png';
306 include_once
'Services/Mail/classes/class.ilMailLuceneQueryParser.php';
308 $query_parser->setFields(array(
309 'title' => (
bool)$this->filter[
'mail_filter_subject'],
310 'content' => (
bool)$this->filter[
'mail_filter_body'],
311 'mattachment' => (
bool)$this->filter[
'mail_filter_attach'],
312 'msender' => (
bool)$this->filter[
'mail_filter_sender'],
313 'mrcp' => (
bool)$this->filter[
'mail_filter_recipients']
315 $query_parser->parse();
317 require_once
'Services/Mail/classes/class.ilMailLuceneSearcher.php';
318 require_once
'Services/Mail/classes/class.ilMailSearchResult.php';
344 $data = ilMailBoxQuery::_getMailBoxListData();
352 $data = ilMailBoxQuery::_getMailBoxListData();
359 if(
'mail_search_empty_result' == $e->getMessage())
361 $data[
'set'] = array();
373 foreach(
$data[
'set'] as $mail)
375 if($mail[
'sender_id'] && $mail[
'sender_id'] != ANONYMOUS_USER_ID)
377 $user_ids[$mail[
'sender_id']] = $mail[
'sender_id'];
381 ilMailUserCache::preloadUserObjects($user_ids);
385 foreach(
$data[
'set'] as $key => $mail)
391 $mail[
'checked'] =
' checked="checked" ';
396 $mail[
'rcp_to'] = $mail[
'mail_login'] = $this->_parentObject->umail->formatNamesForOutput($mail[
'rcp_to']);
400 if($mail[
'sender_id'] == ANONYMOUS_USER_ID)
403 $mail[
'from'] = $mail[
'mail_login'] = $mail[
'alt_sender'] = ilMail::_getIliasMailerName();
410 $mail[
'img_sender'] = $user->getPersonalPicturePath(
'xxsmall');
411 $mail[
'from'] = $mail[
'mail_login'] = $mail[
'alt_sender'] = $user->getPublicName();
415 $mail[
'from'] = $mail[
'mail_login'] = $mail[
'import_name'] .
' (' . $this->lng->txt(
'user_deleted') .
')';
422 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mail_id', $mail[
'mail_id']);
423 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'draft');
424 $link_mark_as_read = $this->ctrl->getLinkTargetByClass(
'ilmailformgui');
425 $this->ctrl->clearParametersByClass(
'ilmailformgui');
429 $this->ctrl->setParameter($this->_parentObject,
'mail_id', $mail[
'mail_id']);
430 $link_mark_as_read = $this->ctrl->getLinkTarget($this->_parentObject,
'showMail');
431 $this->ctrl->clearParameters($this->_parentObject);
433 $css_class = $mail[
'm_status'] ==
'read' ?
'mailread' :
'mailunread';
437 $search_result = array();
438 foreach(
$result->getFields($mail[
'mail_id']) as $content)
440 if(
'title' == $content[0])
442 $mail[
'msr_subject_link_read'] = $link_mark_as_read;
443 $mail[
'msr_subject_mailclass'] = $css_class;
444 $mail[
'msr_subject'] = $content[1];
448 $search_result[] = $content[1];
451 $mail[
'msr_data'] = implode(
'', array_map(
function($value) {
452 return '<p>'.$value.
'</p>';
455 if(!$mail[
'msr_subject'])
457 $mail[
'msr_subject_link_read'] = $link_mark_as_read;
458 $mail[
'msr_subject_mailclass'] = $css_class;
459 $mail[
'msr_subject'] = htmlspecialchars($mail[
'm_subject']);
464 $mail[
'mail_link_read'] = $link_mark_as_read;
465 $mail[
'mailclass'] = $css_class;
466 $mail[
'mail_subject'] = htmlspecialchars($mail[
'm_subject']);
471 $data[
'set'][$key] = $mail;
493 protected function setTitleData($folderLabel, $mailCount, $unreadCount, $imgFolder)
495 $titleTemplate =
new ilTemplate(
'tpl.mail_folder_title.html',
true,
true,
'Services/Mail');
496 $titleTemplate->setVariable(
'TXT_FOLDER', $folderLabel);
497 $titleTemplate->setVariable(
'MAIL_COUNT', $mailCount);
498 $titleTemplate->setVariable(
'TXT_MAIL_S', $this->lng->txt(
'mail_s'));
499 $titleTemplate->setVariable(
'MAIL_COUNT_UNREAD', $unreadCount);
500 $titleTemplate->setVariable(
'TXT_UNREAD', $this->lng->txt(
'unread'));
516 $this->_number_of_mails = $a_number_of_mails;
540 foreach($a_set as $key => $value)
542 $this->tpl->setVariable(strtoupper($key), $value);
548 $this->filter = array();
550 include_once
'Services/Mail/classes/Form/class.ilMailQuickFilterInputGUI.php';
554 $ti->readFromSession();
555 $this->filter[
'mail_filter'] = $ti->getValue();
557 include_once
'Services/Form/classes/class.ilCheckboxInputGUI.php';
561 $this->sub_filter[] = $ci =
new ilCheckboxInputGUI($this->lng->txt(
'mail_filter_recipients'),
'mail_filter_recipients');
564 $ti->addSubItem($ci);
565 $ci->setParent($this);
566 $ci->readFromSession();
567 $this->filter[
'mail_filter_recipients'] = (int)$ci->getChecked();
571 $this->sub_filter[] = $ci =
new ilCheckboxInputGUI($this->lng->txt(
'mail_filter_sender'),
'mail_filter_sender');
574 $ti->addSubItem($ci);
575 $ci->setParent($this);
576 $ci->readFromSession();
577 $this->filter[
'mail_filter_sender'] = (int)$ci->getChecked();
580 $this->sub_filter[] = $ci =
new ilCheckboxInputGUI($this->lng->txt(
'mail_filter_subject'),
'mail_filter_subject');
583 $ti->addSubItem($ci);
584 $ci->setParent($this);
585 $ci->readFromSession();
586 $this->filter[
'mail_filter_subject'] = (int)$ci->getChecked();
588 $this->sub_filter[] = $ci =
new ilCheckboxInputGUI($this->lng->txt(
'mail_filter_body'),
'mail_filter_body');
591 $ti->addSubItem($ci);
592 $ci->setParent($this);
593 $ci->readFromSession();
594 $this->filter[
'mail_filter_body'] = (int)$ci->getChecked();
596 $this->sub_filter[] = $ci =
new ilCheckboxInputGUI($this->lng->txt(
'mail_filter_attach'),
'mail_filter_attach');
599 $ti->addSubItem($ci);
600 $ci->setParent($this);
601 $ci->readFromSession();
602 $this->filter[
'mail_filter_attach'] = (int)$ci->getChecked();
612 foreach($this->sub_filter as $item)
614 if($item->checkInput())
616 $item->setValueByArray(
$_POST);
617 $item->writeToSession();
629 foreach($this->sub_filter as $item)
631 if($item->checkInput())
633 $item->setValueByArray(
$_POST);
634 $item->clearFromSession();