/** * Shows current folder. Current Folder is determined by $_GET["mobj_id"] */ public function showFolder($a_show_confirmation = false) { /** * @var $ilUser ilObjUser * @var $ilToolbar ilToolbarGUI */ global $ilUser, $ilToolbar; $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail.html', 'Services/Mail'); $this->tpl->setTitle($this->lng->txt('mail')); $sentFolderId = $this->mbox->getSentFolder(); $draftsFolderId = $this->mbox->getDraftsFolder(); $isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder(); $isSentFolder = $_GET['mobj_id'] == $sentFolderId; $isDraftFolder = $_GET['mobj_id'] == $draftsFolderId; if ($this->current_selected_cmd == 'deleteMails' && !$this->errorDelete && $this->current_selected_cmd != 'confirm' && $isTrashFolder) { if (isset($_REQUEST['mail_id']) && !is_array($_REQUEST['mail_id'])) { $_REQUEST['mail_id'] = array($_REQUEST['mail_id']); } $confirmation = new ilConfirmationGUI(); $confirmation->setHeaderText($this->lng->txt('mail_sure_delete')); $this->ctrl->setParameter($this, 'mail_id', implode(',', (array) $_REQUEST['mail_id'])); $confirmation->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteMails')); $confirmation->setConfirm($this->lng->txt('confirm'), 'confirmDeleteMails'); $confirmation->setCancel($this->lng->txt('cancel'), 'cancelDeleteMails'); $this->tpl->setVariable('CONFIRMATION', $confirmation->getHTML()); $a_show_confirmation = true; } $folders = $this->mbox->getSubFolders(); $mtree = new ilTree($ilUser->getId()); $mtree->setTableNames('mail_tree', 'mail_obj_data'); $check_uf = false; $check_local = false; if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $folder_d = $mtree->getNodeData($_GET['mobj_id']); if ($folder_d['m_type'] == 'user_folder') { $check_uf = true; } else { if ($folder_d['m_type'] == 'local') { $check_local = true; } } } $mailtable = new ilMailFolderTableGUI($this, (int) $_GET['mobj_id'], 'showFolder'); $mailtable->isSentFolder($isSentFolder)->isDraftFolder($isDraftFolder)->isTrashFolder($isTrashFolder)->initFilter(); $mailtable->setSelectedItems($_POST['mail_id']); try { $mailtable->prepareHTML(); } catch (Exception $e) { ilUtil::sendFailure($this->lng->txt($e->getMessage()) != '-' . $e->getMessage() . '-' ? $this->lng->txt($e->getMessage()) : $e->getMessage()); } $table_html = $mailtable->getHtml(); $folder_options = array(); if ('tree' != ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { foreach ($folders as $folder) { $folder_d = $mtree->getNodeData($folder['obj_id']); if ($folder['obj_id'] == $_GET['mobj_id']) { if ($folder['type'] == 'user_folder') { $check_uf = true; } else { if ($folder['type'] == 'local') { $check_local = true; $check_uf = false; } } } if ($folder['type'] == 'user_folder') { $pre = ''; for ($i = 2; $i < $folder_d['depth'] - 1; $i++) { $pre .= ' '; } if ($folder_d['depth'] > 1) { $pre .= '+'; } $folder_options[$folder['obj_id']] = $pre . ' ' . $folder['title']; } else { $folder_options[$folder['obj_id']] = $this->lng->txt('mail_' . $folder['title']); } } } if ($a_show_confirmation == false && $this->askForConfirmation == false) { if ('tree' != ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $ilToolbar->addText($this->lng->txt('mail_change_to_folder')); include_once './Services/Form/classes/class.ilSelectInputGUI.php'; $si = new ilSelectInputGUI("", "mobj_id"); $si->setOptions($folder_options); $si->setValue($_GET['mobj_id']); $ilToolbar->addInputItem($si); $ilToolbar->addFormButton($this->lng->txt('change'), 'showFolder'); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showFolder')); } if ($check_local == true || $check_uf == true) { $this->addSubfolderCommands($check_uf); } } // END SHOW_FOLDER if ($mailtable->isTrashFolder() && $mailtable->getNumerOfMails() > 0 && $this->askForConfirmation) { $confirmation = new ilConfirmationGUI(); $confirmation->setHeaderText($this->lng->txt('mail_empty_trash_confirmation')); $confirmation->setFormAction($this->ctrl->getFormAction($this, 'performEmptyTrash')); $confirmation->setConfirm($this->lng->txt('confirm'), 'performEmptyTrash'); $confirmation->setCancel($this->lng->txt('cancel'), 'cancelEmptyTrash'); $this->tpl->setVariable('CONFIRMATION', $confirmation->getHTML()); } $this->tpl->setVariable('MAIL_TABLE', $table_html); $this->tpl->show(); }
/** * Shows current folder. Current Folder is determined by $_GET["mobj_id"] */ public function showFolder($a_show_confirmation = false) { /** * @var $ilUser ilObjUser * @var $ilToolbar ilToolbarGUI */ global $ilUser, $ilToolbar; $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail.html', 'Services/Mail'); $this->tpl->setTitle($this->lng->txt('mail')); include_once 'Services/Mail/classes/class.ilMailFolderTableGUI.php'; $sentFolderId = $this->mbox->getSentFolder(); $draftsFolderId = $this->mbox->getDraftsFolder(); $isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder(); $isSentFolder = $_GET['mobj_id'] == $sentFolderId; $isDraftFolder = $_GET['mobj_id'] == $draftsFolderId; // BEGIN CONFIRM_DELETE if ($this->current_selected_cmd == 'deleteMails' && !$this->errorDelete && $this->current_selected_cmd != 'confirm' && $isTrashFolder) { if (isset($_REQUEST['mail_id']) && !is_array($_REQUEST['mail_id'])) { $_REQUEST['mail_id'] = array($_REQUEST['mail_id']); } foreach ((array) $_REQUEST['mail_id'] as $id) { $this->tpl->setCurrentBlock('mail_ids'); $this->tpl->setVariable('MAIL_ID_VALUE', $id); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('confirm_delete'); $this->tpl->setVariable('ACTION', $this->ctrl->getFormAction($this, 'confirmDeleteMails')); $this->tpl->setVariable('BUTTON_CONFIRM', $this->lng->txt('confirm')); $this->tpl->setVariable('BUTTON_CANCEL', $this->lng->txt('cancel')); $this->tpl->parseCurrentBlock(); } $folders = $this->mbox->getSubFolders(); $mtree = new ilTree($ilUser->getId()); $mtree->setTableNames('mail_tree', 'mail_obj_data'); $check_uf = false; $check_local = false; if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $folder_d = $mtree->getNodeData($_GET['mobj_id']); if ($folder_d['m_type'] == 'user_folder') { $check_uf = true; } else { if ($folder_d['m_type'] == 'local') { $check_local = true; } } } $mailtable = new ilMailFolderTableGUI($this, (int) $_GET['mobj_id'], 'showFolder'); $mailtable->isSentFolder($isSentFolder)->isDraftFolder($isDraftFolder)->isTrashFolder($isTrashFolder)->setSelectedItems($_POST['mail_id'])->prepareHTML(); $folder_options = array(); if ('tree' != ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { foreach ($folders as $folder) { $folder_d = $mtree->getNodeData($folder['obj_id']); if ($folder['obj_id'] == $_GET['mobj_id']) { if ($folder['type'] == 'user_folder') { $check_uf = true; } else { if ($folder['type'] == 'local') { $check_local = true; $check_uf = false; } } } if ($folder['type'] == 'user_folder') { $pre = ''; for ($i = 2; $i < $folder_d['depth'] - 1; $i++) { $pre .= ' '; } if ($folder_d['depth'] > 1) { $pre .= '+'; } $folder_options[$folder['obj_id']] = $pre . ' ' . $folder['title']; } else { $folder_options[$folder['obj_id']] = $this->lng->txt('mail_' . $folder['title']); } } } if ($a_show_confirmation == false) { if ('tree' != ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $ilToolbar->addText($this->lng->txt('mail_change_to_folder')); include_once './Services/Form/classes/class.ilSelectInputGUI.php'; $si = new ilSelectInputGUI("", "mobj_id"); $si->setOptions($folder_options); $si->setValue($_GET['mobj_id']); $ilToolbar->addInputItem($si); $ilToolbar->addFormButton($this->lng->txt('change'), 'showFolder'); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showFolder')); } if ($check_local == true || $check_uf == true) { $this->addSubfolderCommands($check_uf); } } // END SHOW_FOLDER // BEGIN Trash delete confirmation if ($mailtable->isTrashFolder() && $mailtable->getNumerOfMails() > 0) { if ($this->askForConfirmation == true) { $this->tpl->setCurrentBlock('confirm_empty_trash'); $this->tpl->setVariable('ACTION_EMPTY_TRASH_CONFIRMATION', $this->ctrl->getFormAction($this, 'performEmptyTrash')); $this->tpl->setVariable('BUTTON_CONFIRM_EMPTY_TRASH', $this->lng->txt('confirm')); $this->tpl->setVariable('BUTTON_CANCEL_EMPTY_TRASH', $this->lng->txt('cancel')); $this->tpl->parseCurrentBlock(); } } // END Trash delete confirmation $this->tpl->setVariable('MAIL_TABLE', $mailtable->getHtml()); $this->tpl->show(); }