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);
125 $sh->setTitle($this->lng->txt(
'mail').
' ('.$this->lng->txt(
'internal_system').
')');
126 $this->form->addItem($sh);
129 $ti =
new ilTextInputGUI($this->lng->txt(
'mail_maxsize_attach'),
'mail_maxsize_attach');
130 $ti->
setInfo($this->lng->txt(
'kb'));
131 $ti->setMaxLength(10);
133 $this->form->addItem($ti);
135 $this->form->addCommandButton(
'save', $this->lng->txt(
'save'));
140 $settings = $this->ilias->getAllSettings();
141 $is_pear_mail_installed = @include_once
'Mail/RFC822.php';
143 $this->form->setValuesByArray(array(
144 'mail_subject_prefix' => $settings[
'mail_subject_prefix'] ? $settings[
'mail_subject_prefix'] :
'[ILIAS]',
145 'mail_incoming_mail' => (
int)$settings[
'mail_incoming_mail'],
146 'pear_mail_enable' => ($settings[
'pear_mail_enable'] ==
'y' && $is_pear_mail_installed) ?
true :
false,
147 'mail_external_sender_noreply' => $settings[
'mail_external_sender_noreply'],
148 'prevent_smtp_globally' => ($settings[
'prevent_smtp_globally'] ==
'1') ?
true :
false,
149 'mail_maxsize_attach' => $settings[
'mail_maxsize_attach']
157 if(!$ilAccess->checkAccess(
'write,read',
'', $this->object->getRefId()))
159 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->WARNING);
163 if($this->form->checkInput())
165 $this->ilias->setSetting(
'mail_subject_prefix',$this->form->getInput(
'mail_subject_prefix'));
166 $this->ilias->setSetting(
'mail_incoming_mail', (
int)$this->form->getInput(
'mail_incoming_mail'));
167 $this->ilias->setSetting(
'mail_maxsize_attach', $this->form->getInput(
'mail_maxsize_attach'));
168 $this->ilias->setSetting(
'pear_mail_enable', $this->form->getInput(
'pear_mail_enable'));
169 $this->ilias->setSetting(
'mail_external_sender_noreply', $this->form->getInput(
'mail_external_sender_noreply'));
170 $this->ilias->setSetting(
'prevent_smtp_globally', (
int)$this->form->getInput(
'prevent_smtp_globally'));
174 $this->form->setValuesByPost();
176 $this->tpl->setContent($this->form->getHTML());
181 global $rbacsystem,
$lng;
183 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
185 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
187 #$this->getTemplateFile("import");
188 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_import.html",
"Services/Mail");
192 if($this->file_obj->findXMLFile())
194 $this->tpl->setVariable(
"TXT_IMPORTED_FILE",$lng->txt(
"checked_files"));
195 $this->tpl->setVariable(
"XML_FILE",basename($this->file_obj->getXMLFile()));
197 $this->tpl->setVariable(
"BTN_IMPORT",$this->lng->txt(
"import"));
200 $this->tpl->setVariable(
"FORMACTION",
201 $this->ctrl->getFormAction($this));
202 $this->tpl->setVariable(
"TXT_IMPORT_MAIL",$this->lng->txt(
"table_mail_import"));
203 $this->tpl->setVariable(
"TXT_IMPORT_FILE",$this->lng->txt(
"mail_import_file"));
204 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
205 $this->tpl->setVariable(
"BTN_UPLOAD",$this->lng->txt(
"upload"));
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);
219 $this->file_obj->findXMLFile();
221 $this->parser_obj->startParsing();
222 $number = $this->parser_obj->getCountImported();
225 $this->ctrl->redirect($this,
"import");
232 global $rbacsystem,
$lng;
234 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
236 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
240 if(!$this->file_obj->storeUploadedFile($_FILES[
"importFile"]))
242 $this->message = $lng->txt(
"import_file_not_valid");
243 $this->file_obj->unlinkLast();
245 else if(!$this->file_obj->unzip())
247 $this->message = $lng->txt(
"cannot_unzip_file");
248 $this->file_obj->unlinkLast();
250 else if(!$this->file_obj->findXMLFile())
252 $this->message = $lng->txt(
"cannot_find_xml");
253 $this->file_obj->unlinkLast();
257 $this->message = $lng->txt(
"error_parser");
259 else if(!$this->parser_obj->startParsing())
261 $this->message = $lng->txt(
"users_not_imported").
":<br/>";
262 $this->message .= $this->parser_obj->getNotAssignableUsers();
267 $this->message = $lng->txt(
"uploaded_and_checked");
271 $this->ctrl->redirect($this,
"import");
277 include_once
"./classes/class.ilFileDataImportMail.php";
285 include_once
"Services/Mail/classes/class.ilMailImportParser.php";
299 $next_class = $this->ctrl->getNextClass($this);
300 $cmd = $this->ctrl->getCmd();
305 case 'ilpermissiongui':
306 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
308 $ret =& $this->ctrl->forwardCommand($perm_gui);
338 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
340 $tabs_gui->addTarget(
"settings",
341 $this->ctrl->getLinkTarget($this,
"view"), array(
"view",
'save',
""),
"",
"");
344 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
346 $tabs_gui->addTarget(
"perm_settings",
347 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
360 if($rbacsystem->checkAccess(
'mail_visible', $mail->getMailObjectReferenceId()))
367 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
369 $_GET[
"cmd"] =
"frameset";
370 $_GET[
"target"] =
"";
371 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
374 include(
"repository.php");
378 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);