24 require_once
"./classes/class.ilObjectGUI.php";
43 public function __construct($a_data,$a_id,$a_call_by_reference)
48 $this->lng->loadLanguageModule(
'mail');
55 if(!$ilAccess->checkAccess(
'write,read',
'', $this->object->getRefId()))
57 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->WARNING);
62 $this->tpl->setContent($this->form->getHTML());
67 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
70 $this->form->setFormAction($this->ctrl->getFormAction($this,
'save'));
71 $this->form->setTitle($this->lng->txt(
'general_settings'));
74 $pre =
new ilTextInputGUI($this->lng->txt(
'mail_subject_prefix'),
'mail_subject_prefix');
76 $pre->setMaxLength(32);
77 $pre->setInfo($this->lng->txt(
'mail_subject_prefix_info'));
78 $this->form->addItem($pre);
81 include_once
'Services/Mail/classes/class.ilMailOptions.php';
87 $si =
new ilSelectInputGUI($this->lng->txt(
'mail_incoming'),
'mail_incoming_mail');
89 $this->ctrl->setParameterByClass(
'ilobjuserfoldergui',
'ref_id',
USER_FOLDER_ID);
90 $si->setInfo(sprintf($this->lng->txt(
'mail_settings_incoming_type_see_also'), $this->ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'settings')));
91 $this->ctrl->clearParametersByClass(
'ilobjuserfoldergui');
92 $this->form->addItem($si);
95 $ti =
new ilTextInputGUI($this->lng->txt(
'mail_external_sender_noreply'),
'mail_external_sender_noreply');
96 $ti->
setInfo($this->lng->txt(
'info_mail_external_sender_noreply'));
97 $ti->setMaxLength(255);
98 $this->form->addItem($ti);
104 $is_pear_mail_installed = @include_once
'Mail/RFC822.php';
105 $cb =
new ilCheckboxInputGUI($this->lng->txt(
'mail_use_pear_mail'),
'pear_mail_enable');
106 if($is_pear_mail_installed)
108 $cb->
setInfo($this->lng->txt(
'mail_use_pear_mail_info'));
112 $cb->setInfo($this->lng->txt(
'mail_use_pear_mail_info').
' '.
113 $this->lng->txt(
'mail_pear_mail_needed'));
116 $this->form->addItem($cb);
119 $cb =
new ilCheckboxInputGUI($this->lng->txt(
'mail_prevent_smtp_globally'),
'prevent_smtp_globally');
121 $this->form->addItem($cb);
123 $cron_mail =
new ilSelectInputGUI($this->lng->txt(
'cron_mail_notification'),
'mail_notification');
124 $cron_options = array(
125 0 => $this->lng->txt(
'cron_mail_notification_never'),
126 1 => $this->lng->txt(
'cron_mail_notification_cron')
130 $cron_mail->setInfo($this->lng->txt(
'cron_mail_notification_desc'));
131 $this->form->addItem($cron_mail);
135 $sh->setTitle($this->lng->txt(
'mail').
' ('.$this->lng->txt(
'internal_system').
')');
136 $this->form->addItem($sh);
139 $ti =
new ilTextInputGUI($this->lng->txt(
'mail_maxsize_attach'),
'mail_maxsize_attach');
140 $ti->
setInfo($this->lng->txt(
'kb'));
141 $ti->setMaxLength(10);
143 $this->form->addItem($ti);
147 $mn->setTitle($this->lng->txt(
'mail_member_notification'));
148 $this->form->addItem($mn);
151 $cn =
new ilCheckboxInputGUI($this->lng->txt(
'mail_enable_crs_member_notification'),
'mail_crs_member_notification');
152 $cn->
setInfo($this->lng->txt(
'mail_enable_crs_member_notification_info'));
153 $this->form->addItem($cn);
156 $gn =
new ilCheckboxInputGUI($this->lng->txt(
'mail_enable_grp_member_notification'),
'mail_grp_member_notification');
157 $gn->
setInfo($this->lng->txt(
'mail_enable_grp_member_notification_info'));
158 $this->form->addItem($gn);
160 $this->form->addCommandButton(
'save', $this->lng->txt(
'save'));
165 $settings = $this->ilias->getAllSettings();
166 $is_pear_mail_installed = @include_once
'Mail/RFC822.php';
168 $this->form->setValuesByArray(array(
169 'mail_subject_prefix' => $settings[
'mail_subject_prefix'] ? $settings[
'mail_subject_prefix'] :
'[ILIAS]',
170 'mail_incoming_mail' => (
int)$settings[
'mail_incoming_mail'],
171 'pear_mail_enable' => ($settings[
'pear_mail_enable'] && $is_pear_mail_installed) ?
true :
false,
172 'mail_external_sender_noreply' => $settings[
'mail_external_sender_noreply'],
173 'prevent_smtp_globally' => ($settings[
'prevent_smtp_globally'] ==
'1') ?
true :
false,
174 'mail_maxsize_attach' => $settings[
'mail_maxsize_attach'],
175 'mail_notification' => $settings[
'mail_notification'],
176 'mail_crs_member_notification' => isset($settings[
'mail_crs_member_notification']) ? $settings[
'mail_crs_member_notification'] : 1,
177 'mail_grp_member_notification' => isset($settings[
'mail_grp_member_notification']) ? $settings[
'mail_grp_member_notification'] : 1
185 if(!$ilAccess->checkAccess(
'write,read',
'', $this->object->getRefId()))
187 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->WARNING);
191 if($this->form->checkInput())
193 $this->ilias->setSetting(
'mail_subject_prefix',$this->form->getInput(
'mail_subject_prefix'));
194 $this->ilias->setSetting(
'mail_incoming_mail', (
int)$this->form->getInput(
'mail_incoming_mail'));
195 $this->ilias->setSetting(
'mail_maxsize_attach', $this->form->getInput(
'mail_maxsize_attach'));
196 $this->ilias->setSetting(
'pear_mail_enable', (
int)$this->form->getInput(
'pear_mail_enable'));
197 $this->ilias->setSetting(
'mail_external_sender_noreply', $this->form->getInput(
'mail_external_sender_noreply'));
198 $this->ilias->setSetting(
'prevent_smtp_globally', (
int)$this->form->getInput(
'prevent_smtp_globally'));
199 $this->ilias->setSetting(
'mail_notification', (
int)$this->form->getInput(
'mail_notification'));
200 $ilSetting->set(
'mail_crs_member_notification', (
int) $this->form->getInput(
'mail_crs_member_notification'));
201 $ilSetting->set(
'mail_grp_member_notification', (
int) $this->form->getInput(
'mail_grp_member_notification'));
205 $this->form->setValuesByPost();
207 $this->tpl->setContent($this->form->getHTML());
212 global $rbacsystem,
$lng;
214 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
216 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
218 #$this->getTemplateFile("import");
219 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_import.html",
"Services/Mail");
223 if($this->file_obj->findXMLFile())
225 $this->tpl->setVariable(
"TXT_IMPORTED_FILE",$lng->txt(
"checked_files"));
226 $this->tpl->setVariable(
"XML_FILE",basename($this->file_obj->getXMLFile()));
228 $this->tpl->setVariable(
"BTN_IMPORT",$this->lng->txt(
"import"));
231 $this->tpl->setVariable(
"FORMACTION",
232 $this->ctrl->getFormAction($this));
233 $this->tpl->setVariable(
"TXT_IMPORT_MAIL",$this->lng->txt(
"table_mail_import"));
234 $this->tpl->setVariable(
"TXT_IMPORT_FILE",$this->lng->txt(
"mail_import_file"));
235 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
236 $this->tpl->setVariable(
"BTN_UPLOAD",$this->lng->txt(
"upload"));
243 global $rbacsystem,
$lng;
245 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
247 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
250 $this->file_obj->findXMLFile();
252 $this->parser_obj->startParsing();
253 $number = $this->parser_obj->getCountImported();
256 $this->ctrl->redirect($this,
"import");
263 global $rbacsystem,
$lng;
265 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
267 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
271 if(!$this->file_obj->storeUploadedFile($_FILES[
"importFile"]))
273 $this->message = $lng->txt(
"import_file_not_valid");
274 $this->file_obj->unlinkLast();
276 else if(!$this->file_obj->unzip())
278 $this->message = $lng->txt(
"cannot_unzip_file");
279 $this->file_obj->unlinkLast();
281 else if(!$this->file_obj->findXMLFile())
283 $this->message = $lng->txt(
"cannot_find_xml");
284 $this->file_obj->unlinkLast();
288 $this->message = $lng->txt(
"error_parser");
290 else if(!$this->parser_obj->startParsing())
292 $this->message = $lng->txt(
"users_not_imported").
":<br/>";
293 $this->message .= $this->parser_obj->getNotAssignableUsers();
298 $this->message = $lng->txt(
"uploaded_and_checked");
302 $this->ctrl->redirect($this,
"import");
308 include_once
"./classes/class.ilFileDataImportMail.php";
316 include_once
"Services/Mail/classes/class.ilMailImportParser.php";
330 $next_class = $this->ctrl->getNextClass($this);
331 $cmd = $this->ctrl->getCmd();
336 case 'ilpermissiongui':
337 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
339 $ret =& $this->ctrl->forwardCommand($perm_gui);
369 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
371 $tabs_gui->addTarget(
"settings",
372 $this->ctrl->getLinkTarget($this,
"view"), array(
"view",
'save',
""),
"",
"");
375 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
377 $tabs_gui->addTarget(
"perm_settings",
378 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
389 require_once
'Services/Mail/classes/class.ilMail.php';
391 if($rbacsystem->checkAccess(
'mail_visible', $mail->getMailObjectReferenceId()))
398 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
400 $_GET[
"cmd"] =
"frameset";
401 $_GET[
"target"] =
"";
402 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
405 include(
"repository.php");
409 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);