37 public function __construct($a_data, $a_id, $a_call_by_reference)
42 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
44 $this->tabs = $DIC->tabs();
45 $this->rbacsystem = $DIC->rbac()->system();
48 $this->lng->loadLanguageModule(
'mail');
56 $next_class = $this->ctrl->getNextClass($this);
57 $cmd = $this->ctrl->getCmd();
60 switch ($next_class) {
61 case 'ilpermissiongui':
63 $this->ctrl->forwardCommand($perm_gui);
66 case 'ilmailtemplategui':
68 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->WARNING);
91 return $this->rbacsystem->checkAccess(
'write', $this->object->getRefId());
99 return $this->rbacsystem->checkAccess(
'read', $this->object->getRefId());
107 return $this->rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId());
124 $this->tabs->addTarget(
126 $this->ctrl->getLinkTarget($this,
'view'),
131 'showExternalSettingsForm',
132 'saveExternalSettingsForm',
142 $this->tabs->addTarget(
144 $this->ctrl->getLinkTargetByClass(
'ilmailtemplategui',
'showTemplates'),
151 $this->tabs->addTarget(
153 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'),
154 array(
'perm',
'info',
'owner'),
166 $this->tabs->addSubTab(
167 self::SETTINGS_SUB_TAB_ID_GENERAL,
168 $this->lng->txt(
'mail_settings_general_tab'),
169 $this->ctrl->getLinkTarget($this,
'view')
172 if ($this->
settings->get(
'mail_allow_external')) {
173 $this->tabs->addSubTab(
174 self::SETTINGS_SUB_TAB_ID_EXTERNAL,
175 $this->lng->txt(
'mail_settings_external_tab'),
176 $this->ctrl->getLinkTarget($this,
'showExternalSettingsForm')
180 $this->tabs->activateSubTab($activeSubTab);
198 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->WARNING);
203 if (
$form === null) {
208 $this->tpl->setContent(
$form->getHTML());
218 $form->setFormAction($this->ctrl->getFormAction($this,
'save'));
219 $form->setTitle($this->lng->txt(
'general_settings'));
221 $cb =
new ilCheckboxInputGUI($this->lng->txt(
'mail_allow_external'),
'mail_allow_external');
222 $cb->
setInfo($this->lng->txt(
'mail_allow_external_info'));
227 include_once
'Services/Mail/classes/Form/class.ilIncomingMailInputGUI.php';
230 $this->ctrl->setParameterByClass(
'ilobjuserfoldergui',
'ref_id',
USER_FOLDER_ID);
231 $incoming_mail_gui->setInfo(sprintf(
232 $this->lng->txt(
'mail_settings_incoming_type_see_also'),
233 $this->ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'settings')
235 $this->ctrl->clearParametersByClass(
'ilobjuserfoldergui');
236 $form->addItem($incoming_mail_gui);
238 $show_mail_settings_gui =
new ilCheckboxInputGUI($this->lng->txt(
'show_mail_settings'),
'show_mail_settings');
239 $show_mail_settings_gui->
setInfo($this->lng->txt(
'show_mail_settings_info'));
240 $show_mail_settings_gui->setValue(1);
241 $form->addItem($show_mail_settings_gui);
243 $ti =
new ilNumberInputGUI($this->lng->txt(
'mail_maxsize_attach'),
'mail_maxsize_attach');
245 $ti->setInfo($this->lng->txt(
'mail_max_size_attachments_total'));
246 $ti->setMaxLength(10);
252 $mn->setTitle($this->lng->txt(
'mail_member_notification'));
255 $cron_mail =
new ilSelectInputGUI($this->lng->txt(
'cron_mail_notification'),
'mail_notification');
256 $cron_options = array(
257 0 => $this->lng->txt(
'cron_mail_notification_never'),
258 1 => $this->lng->txt(
'cron_mail_notification_cron')
261 $cron_mail->setInfo(sprintf(
262 $this->lng->txt(
'cron_mail_notification_desc'),
263 $this->lng->txt(
'mail_allow_external')
266 $form->addItem($cron_mail);
275 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
287 'mail_allow_external' => $this->
settings->get(
'mail_allow_external'),
288 'incoming_type' => (int) $this->
settings->get(
'mail_incoming_mail'),
291 'show_mail_settings' => $this->
settings->get(
'show_mail_settings', 1),
292 'mail_maxsize_attach' => $this->
settings->get(
'mail_maxsize_attach'),
293 'mail_notification' => $this->
settings->get(
'mail_notification')
303 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->WARNING);
307 if (
$form->checkInput()) {
308 $incoming_type = (int)
$form->getInput(
'incoming_type');
312 $mail_address_option = (int)
$form->getInput(
'mail_address_option');
315 $mail_address_option = (int)
$form->getInput(
'mail_address_option_both');
319 $this->
settings->set(
'mail_allow_external', (
int)
$form->getInput(
'mail_allow_external'));
320 $this->
settings->set(
'mail_incoming_mail', $incoming_type);
321 $this->
settings->set(
'show_mail_settings', (
int)
$form->getInput(
'show_mail_settings'));
323 $this->
settings->set(
'mail_address_option', $mail_address_option);
324 $this->
settings->set(
'mail_maxsize_attach',
$form->getInput(
'mail_maxsize_attach'));
325 $this->
settings->set(
'mail_notification', (
int)
$form->getInput(
'mail_notification'));
327 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
328 $this->ctrl->redirect($this);
331 $form->setValuesByPost();
341 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->WARNING);
346 if (
$form === null) {
353 $btn->setUrl($this->ctrl->getLinkTarget($this,
'sendTestUserMail'));
354 $btn->setCaption(
'mail_external_send_test_usr');
355 $GLOBALS[
'DIC']->toolbar()->addButtonInstance($btn);
358 $btn->setUrl($this->ctrl->getLinkTarget($this,
'sendTestSystemMail'));
359 $btn->setCaption(
'mail_external_send_test_sys');
360 $GLOBALS[
'DIC']->toolbar()->addButtonInstance($btn);
363 $this->tpl->setContent(
$form->getHTML());
382 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->WARNING);
389 if ($is_manual_mail) {
391 $type = array(
'normal');
393 $mail =
new ilMail(ANONYMOUS_USER_ID);
394 $type = array(
'system');
397 $mail->setSaveInSentbox(
false);
398 $mail->appendInstallationSignature(
true);
399 $mail->sendMail(
$GLOBALS[
'DIC']->
user()->getEmail(),
'',
'',
'Test Subject',
'Test Body', array(),
$type);
401 ilUtil::sendSuccess($this->lng->txt(
'mail_external_test_sent'));
412 $form->setFormAction($this->ctrl->getFormAction($this,
'saveExternalSettingsForm'));
413 $form->setTitle($this->lng->txt(
'mail_settings_external_frm_head'));
415 $smtp =
new ilCheckboxInputGUI($this->lng->txt(
'mail_smtp_status'),
'mail_smtp_status');
416 $smtp->
setInfo($this->lng->txt(
'mail_smtp_status_info'));
419 $form->addItem($smtp);
421 $host =
new ilTextInputGUI($this->lng->txt(
'mail_smtp_host'),
'mail_smtp_host');
422 $host->
setInfo($this->lng->txt(
'mail_smtp_host_info'));
423 $host->setRequired(
true);
425 $smtp->addSubItem($host);
427 $port =
new ilNumberInputGUI($this->lng->txt(
'mail_smtp_port'),
'mail_smtp_port');
428 $port->
setInfo($this->lng->txt(
'mail_smtp_port_info'));
429 $port->allowDecimals(
false);
430 $port->setMinValue(0);
431 $port->setMinValue(0);
432 $port->setRequired(
true);
434 $smtp->addSubItem($port);
436 $encryption =
new ilSelectInputGUI($this->lng->txt(
'mail_smtp_encryption'),
'mail_smtp_encryption');
437 $encryptionOptions = array(
438 '' => $this->lng->txt(
'please_choose'),
439 'tls' => $this->lng->txt(
'mail_smtp_encryption_tls'),
440 'ssl' => $this->lng->txt(
'mail_smtp_encryption_ssl')
445 $smtp->addSubItem($encryption);
449 $smtp->addSubItem(
$user);
457 $pre =
new ilTextInputGUI($this->lng->txt(
'mail_subject_prefix'),
'mail_subject_prefix');
459 $pre->setMaxLength(32);
460 $pre->setInfo($this->lng->txt(
'mail_subject_prefix_info'));
462 $form->addItem($pre);
464 $send_html =
new ilCheckboxInputGUI($this->lng->txt(
'mail_send_html'),
'mail_send_html');
465 $send_html->
setInfo($this->lng->txt(
'mail_send_html_info'));
466 $send_html->setValue(1);
468 $form->addItem($send_html);
471 $sh->setTitle($this->lng->txt(
'mail_settings_user_frm_head'));
475 $this->lng->txt(
'mail_system_usr_from_addr'),
476 'mail_system_usr_from_addr' 478 $user_from_address->
setInfo($this->lng->txt(
'mail_system_usr_from_addr_info'));
479 $user_from_address->setRequired(
true);
481 $form->addItem($user_from_address);
483 $user_from_name =
new ilTextInputGUI($this->lng->txt(
'mail_system_usr_from_name'),
'mail_system_usr_from_name');
484 $user_from_name->
setInfo($this->lng->txt(
'mail_system_usr_from_name_info'));
485 $user_from_name->setRequired(
true);
487 $form->addItem($user_from_name);
490 $this->lng->txt(
'mail_system_usr_env_from_addr'),
491 'mail_system_usr_env_from_addr' 493 $user_envelope_from_addr->
setInfo($this->lng->txt(
'mail_system_usr_env_from_addr_info'));
495 $form->addItem($user_envelope_from_addr);
498 $sh->setTitle($this->lng->txt(
'mail_settings_system_frm_head'));
502 $this->lng->txt(
'mail_system_sys_from_addr'),
503 'mail_system_sys_from_addr' 505 $system_from_addr->
setInfo($this->lng->txt(
'mail_system_sys_from_addr_info'));
506 $system_from_addr->setRequired(
true);
508 $form->addItem($system_from_addr);
511 $this->lng->txt(
'mail_system_sys_from_name'),
512 'mail_system_sys_from_name' 516 $form->addItem($system_from_name);
519 $this->lng->txt(
'mail_system_sys_reply_to_addr'),
520 'mail_system_sys_reply_to_addr' 524 $form->addItem($system_reply_to_addr);
527 $this->lng->txt(
'mail_system_sys_env_from_addr'),
528 'mail_system_sys_env_from_addr' 530 $system_return_path->
setInfo($this->lng->txt(
'mail_system_sys_env_from_addr_info'));
532 $form->addItem($system_return_path);
534 $signature =
new ilTextAreaInputGUI($this->lng->txt(
'mail_system_sys_signature'),
'mail_system_sys_signature');
537 $form->addItem($signature);
541 array(
'placeholder' =>
'CLIENT_NAME',
'label' => $this->lng->txt(
'mail_nacc_client_name')),
542 array(
'placeholder' =>
'CLIENT_DESC',
'label' => $this->lng->txt(
'mail_nacc_client_desc')),
543 array(
'placeholder' =>
'CLIENT_URL',
'label' => $this->lng->txt(
'mail_nacc_ilias_url'))
544 ) as
$key => $value) {
545 $placeholders->addPlaceholder($value[
'placeholder'], $value[
'label']);
548 $form->addItem($placeholders);
551 $form->addCommandButton(
'saveExternalSettingsForm', $this->lng->txt(
'save'));
562 $subjectPrefix = $this->
settings->get(
'mail_subject_prefix');
563 if (
false === $subjectPrefix) {
568 'mail_smtp_status' => (
bool) $this->
settings->get(
'mail_smtp_status'),
569 'mail_smtp_host' => $this->
settings->get(
'mail_smtp_host'),
570 'mail_smtp_port' => (int) $this->
settings->get(
'mail_smtp_port'),
571 'mail_smtp_user' => $this->
settings->get(
'mail_smtp_user'),
572 'mail_smtp_password' => strlen($this->
settings->get(
'mail_smtp_password')) > 0 ? self::PASSWORD_PLACE_HOLDER :
'',
573 'mail_smtp_encryption' => $this->
settings->get(
'mail_smtp_encryption'),
574 'mail_subject_prefix' => $subjectPrefix,
575 'mail_send_html' => (int) $this->
settings->get(
'mail_send_html'),
576 'mail_system_usr_from_addr' => $this->
settings->get(
'mail_system_usr_from_addr'),
577 'mail_system_usr_from_name' => $this->
settings->get(
'mail_system_usr_from_name'),
578 'mail_system_usr_env_from_addr' => $this->
settings->get(
'mail_system_usr_env_from_addr'),
579 'mail_system_sys_from_addr' => $this->
settings->get(
'mail_system_sys_from_addr'),
580 'mail_system_sys_from_name' => $this->
settings->get(
'mail_system_sys_from_name'),
581 'mail_system_sys_reply_to_addr' => $this->
settings->get(
'mail_system_sys_reply_to_addr'),
582 'mail_system_sys_env_from_addr' => $this->
settings->get(
'mail_system_sys_env_from_addr'),
583 'mail_system_sys_signature' => $this->
settings->get(
'mail_system_sys_signature')
593 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->WARNING);
597 $isFormValid =
$form->checkInput();
600 $form->setValuesByPost();
605 $isSmtpEnabled = (bool)
$form->getInput(
'mail_smtp_status');
606 if ($isSmtpEnabled &&
$form->getInput(
'mail_smtp_user') && !
$form->getInput(
'mail_smtp_password')) {
607 $form->getItemByPostVar(
'mail_smtp_password')->setRequired(
true);
608 $form->getItemByPostVar(
'mail_smtp_password')->setAlert($this->lng->txt(
'mail_smtp_password_req'));
609 $form->setValuesByPost();
614 $this->
settings->set(
'mail_smtp_status', (
int)
$form->getInput(
'mail_smtp_status'));
615 $this->
settings->set(
'mail_smtp_host',
$form->getInput(
'mail_smtp_host'));
616 $this->
settings->set(
'mail_smtp_port', (
int)
$form->getInput(
'mail_smtp_port'));
617 $this->
settings->set(
'mail_smtp_user',
$form->getInput(
'mail_smtp_user'));
618 if (
$form->getInput(
'mail_smtp_password') != self::PASSWORD_PLACE_HOLDER) {
619 $this->
settings->set(
'mail_smtp_password',
$form->getInput(
'mail_smtp_password'));
621 $this->
settings->set(
'mail_smtp_encryption',
$form->getInput(
'mail_smtp_encryption'));
623 $this->
settings->set(
'mail_send_html',
$form->getInput(
'mail_send_html'));
624 $this->
settings->set(
'mail_subject_prefix',
$form->getInput(
'mail_subject_prefix'));
625 $this->
settings->set(
'mail_system_usr_from_addr',
$form->getInput(
'mail_system_usr_from_addr'));
626 $this->
settings->set(
'mail_system_usr_from_name',
$form->getInput(
'mail_system_usr_from_name'));
627 $this->
settings->set(
'mail_system_usr_env_from_addr',
$form->getInput(
'mail_system_usr_env_from_addr'));
628 $this->
settings->set(
'mail_system_sys_from_addr',
$form->getInput(
'mail_system_sys_from_addr'));
629 $this->
settings->set(
'mail_system_sys_from_name',
$form->getInput(
'mail_system_sys_from_name'));
630 $this->
settings->set(
'mail_system_sys_reply_to_addr',
$form->getInput(
'mail_system_sys_reply_to_addr'));
631 $this->
settings->set(
'mail_system_sys_env_from_addr',
$form->getInput(
'mail_system_sys_env_from_addr'));
632 $this->
settings->set(
'mail_system_sys_signature',
$form->getInput(
'mail_system_sys_signature'));
634 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
635 $this->ctrl->redirect($this,
'showExternalSettingsForm');
641 public static function _goto($a_target)
645 $mail =
new ilMail($DIC->user()->getId());
647 if ($DIC->rbac()->system()->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId())) {
650 if ($DIC->access()->checkAccess(
'read',
'', ROOT_FOLDER_ID)) {
651 $_GET[
'cmd'] =
'frameset';
652 $_GET[
'target'] =
'';
653 $_GET[
'ref_id'] = ROOT_FOLDER_ID;
654 $_GET[
'baseClass'] =
'ilRepositoryGUI';
657 $DIC->language()->txt(
'msg_no_perm_read_item'),
668 $DIC[
'ilErr']->raiseError($DIC->language()->txt(
'msg_no_perm_read'), $DIC[
'ilErr']->FATAL);
populateGeneralSettingsForm(ilPropertyFormGUI $form)
isPermissionChangeAllowed()
const PASSWORD_PLACE_HOLDER
static _lookupTitle($a_id)
lookup object title
__construct($a_data, $a_id, $a_call_by_reference)
ilObjMailGUI constructor.
const MAIL_SUBJECT_PREFIX
const SETTINGS_SUB_TAB_ID_EXTERNAL
prepareOutput($a_show_subobjects=true)
prepare output
sendTestSystemMailObject()
sendTestMail($is_manual_mail=false)
saveExternalSettingsFormObject()
buildSettingsSubTabs($activeSubTab)
showExternalSettingsFormObject(ilPropertyFormGUI $form=null)
if(isset($_POST['submit'])) $form
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
setSize($a_size)
Set Size.
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
showGeneralSettingsForm(ilPropertyFormGUI $form=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const SETTINGS_SUB_TAB_ID_GENERAL
setRows($a_rows)
Set Rows.
This class represents a text area property in a property form.
const USER_FOLDER_ID
Class ilObjUserFolder.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static redirect($a_script)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
getExternalSettingsForm()
populateExternalSettingsForm(ilPropertyFormGUI $form)