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);
120 $sh->setTitle($this->lng->txt(
'mail').
' ('.$this->lng->txt(
'internal_system').
')');
121 $this->form->addItem($sh);
124 $ti =
new ilTextInputGUI($this->lng->txt(
'mail_maxsize_attach'),
'mail_maxsize_attach');
125 $ti->
setInfo($this->lng->txt(
'kb'));
126 $ti->setMaxLength(10);
128 $this->form->addItem($ti);
130 $this->form->addCommandButton(
'save', $this->lng->txt(
'save'));
135 $settings = $this->ilias->getAllSettings();
136 $is_pear_mail_installed = @include_once
'Mail/RFC822.php';
138 $this->form->setValuesByArray(array(
139 'mail_subject_prefix' => $settings[
'mail_subject_prefix'] ? $settings[
'mail_subject_prefix'] :
'[ILIAS]',
140 'mail_incoming_mail' => (
int)$settings[
'mail_incoming_mail'],
141 'pear_mail_enable' => ($settings[
'pear_mail_enable'] ==
'y' && $is_pear_mail_installed) ?
true :
false,
142 'mail_external_sender_noreply' => $settings[
'mail_external_sender_noreply'],
143 'mail_maxsize_attach' => $settings[
'mail_maxsize_attach']
151 if(!$ilAccess->checkAccess(
'write,read',
'', $this->object->getRefId()))
153 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->WARNING);
157 if($this->form->checkInput())
159 $this->ilias->setSetting(
'mail_subject_prefix',$this->form->getInput(
'mail_subject_prefix'));
160 $this->ilias->setSetting(
'mail_incoming_mail', (
int)$this->form->getInput(
'mail_incoming_mail'));
161 $this->ilias->setSetting(
'mail_maxsize_attach', $this->form->getInput(
'mail_maxsize_attach'));
162 $this->ilias->setSetting(
'pear_mail_enable', $this->form->getInput(
'pear_mail_enable'));
163 $this->ilias->setSetting(
'mail_external_sender_noreply', $this->form->getInput(
'mail_external_sender_noreply'));
167 $this->form->setValuesByPost();
169 $this->tpl->setContent($this->form->getHTML());
174 global $rbacsystem,
$lng;
176 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
178 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
180 #$this->getTemplateFile("import");
181 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_import.html",
"Services/Mail");
185 if($this->file_obj->findXMLFile())
187 $this->tpl->setVariable(
"TXT_IMPORTED_FILE",$lng->txt(
"checked_files"));
188 $this->tpl->setVariable(
"XML_FILE",basename($this->file_obj->getXMLFile()));
190 $this->tpl->setVariable(
"BTN_IMPORT",$this->lng->txt(
"import"));
193 $this->tpl->setVariable(
"FORMACTION",
194 $this->ctrl->getFormAction($this));
195 $this->tpl->setVariable(
"TXT_IMPORT_MAIL",$this->lng->txt(
"table_mail_import"));
196 $this->tpl->setVariable(
"TXT_IMPORT_FILE",$this->lng->txt(
"mail_import_file"));
197 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
198 $this->tpl->setVariable(
"BTN_UPLOAD",$this->lng->txt(
"upload"));
205 global $rbacsystem,
$lng;
207 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
209 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
212 $this->file_obj->findXMLFile();
214 $this->parser_obj->startParsing();
215 $number = $this->parser_obj->getCountImported();
218 $this->ctrl->redirect($this,
"import");
225 global $rbacsystem,
$lng;
227 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
229 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
233 if(!$this->file_obj->storeUploadedFile($_FILES[
"importFile"]))
235 $this->message = $lng->txt(
"import_file_not_valid");
236 $this->file_obj->unlinkLast();
238 else if(!$this->file_obj->unzip())
240 $this->message = $lng->txt(
"cannot_unzip_file");
241 $this->file_obj->unlinkLast();
243 else if(!$this->file_obj->findXMLFile())
245 $this->message = $lng->txt(
"cannot_find_xml");
246 $this->file_obj->unlinkLast();
250 $this->message = $lng->txt(
"error_parser");
252 else if(!$this->parser_obj->startParsing())
254 $this->message = $lng->txt(
"users_not_imported").
":<br/>";
255 $this->message .= $this->parser_obj->getNotAssignableUsers();
260 $this->message = $lng->txt(
"uploaded_and_checked");
264 $this->ctrl->redirect($this,
"import");
270 include_once
"./classes/class.ilFileDataImportMail.php";
278 include_once
"Services/Mail/classes/class.ilMailImportParser.php";
292 $next_class = $this->ctrl->getNextClass($this);
293 $cmd = $this->ctrl->getCmd();
298 case 'ilpermissiongui':
299 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
301 $ret =& $this->ctrl->forwardCommand($perm_gui);
331 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
333 $tabs_gui->addTarget(
"settings",
334 $this->ctrl->getLinkTarget($this,
"view"), array(
"view",
'save',
""),
"",
"");
337 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
339 $tabs_gui->addTarget(
"perm_settings",
340 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');