24 require_once
'./Services/Registration/classes/class.ilRegistrationSettings.php';
50 $this->lng->loadLanguageModule(
'administration');
51 $this->lng->loadLanguageModule(
'registration');
53 $this->ref_id = (int)
$_GET[
'ref_id'];
60 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd();
79 function setSubTabs($activeTab =
'registration_settings')
83 $ilTabs->addSubTab(
"registration_settings",
84 $lng->txt(
"registration_tab_settings"),
85 $this->ctrl->getLinkTarget($this,
'view'));
87 $ilTabs->addSubTab(
"registration_codes",
88 $lng->txt(
"registration_tab_codes"),
89 $this->ctrl->getLinkTarget($this,
'listCodes'));
91 $ilTabs->activateSubTab($activeTab);
96 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
99 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
100 $this->form_gui->setTitle($this->lng->txt(
'reg_settings_header'));
105 $option->
setInfo($this->lng->txt(
'reg_direct_info'));
106 $cd =
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'),
'reg_codes_'.IL_REG_DIRECT);
107 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
108 $option->addSubItem($cd);
109 $reg_type->addOption($option);
111 $option->
setInfo($this->lng->txt(
'reg_approve_info'));
112 $cd =
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'),
'reg_codes_'.IL_REG_APPROVE);
113 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
114 $option->addSubItem($cd);
115 $reg_type->addOption($option);
117 $option->
setInfo($this->lng->txt(
'reg_type_confirmation_info'));
118 $lt =
new ilNumberInputGUI($this->lng->txt(
'reg_confirmation_hash_life_time'),
'reg_hash_life_time');
120 $lt->setMaxLength(5);
122 $lt->setRequired(
true);
123 $lt->setInfo($this->lng->txt(
'reg_confirmation_hash_life_time_info'));
124 $lt->setSuffix($this->lng->txt(
'seconds'));
125 $option->addSubItem($lt);
126 $cd =
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'),
'reg_codes_'.IL_REG_ACTIVATION);
127 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
128 $option->addSubItem($cd);
129 $reg_type->addOption($option);
131 $option->
setInfo($this->lng->txt(
'registration_reg_type_codes_info'));
132 $reg_type->addOption($option);
133 $this->form_gui->addItem($reg_type);
137 $pwd_gen->setInfo($this->lng->txt(
'reg_info_pwd'));
138 $this->form_gui->addItem($pwd_gen);
140 $approver =
new ilTextInputGUI($this->lng->txt(
'reg_notification'),
'reg_approver');
142 $approver->setMaxLength(50);
143 $approver->setInfo($this->lng->txt(
'reg_notification_info'));
144 $this->form_gui->addItem($approver);
149 $edit = $this->ctrl->getLinkTarget($this,
'editRoles');
152 $roles->addOption($option);
155 $edit = $this->ctrl->getLinkTarget($this,
'editEmailAssignments');
158 $roles->addOption($option);
159 $this->form_gui->addItem($roles);
161 $limit =
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'),
'reg_access_limitation');
164 $edit = $this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations');
167 $this->form_gui->addItem($limit);
169 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
174 if($this->registration_settings->roleSelectionEnabled())
178 else if ($this->registration_settings->automaticRoleAssignmentEnabled())
184 'reg_type' => $this->registration_settings->getRegistrationType(),
185 'reg_hash_life_time' => (int)$this->registration_settings->getRegistrationHashLifetime(),
186 'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
187 'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
188 'reg_role_type' => $role_type,
189 'reg_access_limitation' => $this->registration_settings->getAccessLimitation()
192 $allow_codes = $this->registration_settings->getAllowCodes();
193 $reg_type = $this->registration_settings->getRegistrationType();
196 $values[
'reg_codes_'.$reg_type] =
true;
199 $this->form_gui->setValuesByArray($values);
206 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
208 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
214 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
USER_FOLDER_ID);
215 $ilToolbar->addButton($this->lng->txt(
'registration_user_new_account_mail'),
216 $ilCtrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjuserfoldergui"),
"newAccountMail"));
217 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
$_GET[
"ref_id"]);
221 $this->tpl->setContent($this->form_gui->getHTML());
228 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
230 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
233 $this->registration_settings->setRegistrationType((
int)
$_POST[
'reg_type']);
234 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
235 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
236 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
237 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
239 $allow_codes =
false;
242 $allow_codes = (bool)$_POST[
'reg_codes_'.(
int)$_POST[
'reg_type']];
244 $this->registration_settings->setAllowCodes($allow_codes);
246 if(!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int)$_POST[
'reg_hash_life_time']))
251 if($error_code = $this->registration_settings->validate())
257 ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients').
' '.$this->registration_settings->getUnknown());
263 ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient').
' '.$this->registration_settings->getUnknown());
270 $this->registration_settings->save();
279 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
281 global $ilAccess,
$ilErr,$rbacreview;
283 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
285 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
288 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
290 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
291 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES",$this->lng->txt(
'reg_selectable_roles'));
293 $this->tpl->setVariable(
"ACTIONS",$this->lng->txt(
'actions'));
294 $this->tpl->setVariable(
"UPDATE",$this->lng->txt(
'save'));
295 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
298 foreach($rbacreview->getGlobalRoles() as $role)
300 if($role == SYSTEM_ROLE_ID or $role == ANONYMOUS_ROLE_ID)
304 $this->tpl->setCurrentBlock(
"roles");
310 $this->tpl->parseCurrentBlock();
317 global $ilAccess,
$ilErr,$rbacreview;
319 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
321 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
324 if(count(
$_POST[
'roles']) < 1)
331 foreach($rbacreview->getGlobalRoles() as $role)
335 $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
348 global $ilAccess,
$ilErr,$rbacreview;
350 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
352 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
357 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_email_role_assignments.html',
'Services/Registration');
358 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
359 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt(
'reg_email_role_assignment'));
360 $this->tpl->setVariable(
"TXT_MAIL",$this->lng->txt(
'reg_email'));
361 $this->tpl->setVariable(
"TXT_ROLE",$this->lng->txt(
'obj_role'));
362 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'reg_default'));
364 $this->tpl->setVariable(
"TXT_DOMAIN",$this->lng->txt(
'reg_domain'));
367 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
368 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
369 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
'reg_add_assignment'));
370 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
373 foreach($this->assignments_obj->getAssignments() as $assignment)
375 $this->tpl->setCurrentBlock(
"roles");
377 $this->tpl->setVariable(
"ASSIGN_ID",$assignment[
'id']);
378 $this->tpl->setVariable(
"DOMAIN",$assignment[
'domain']);
381 $this->tpl->parseCurrentBlock();
385 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'default'));
393 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
395 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
400 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
402 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
403 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",$lng->txt(
'reg_role_access_limitations'));
404 $this->tpl->setVariable(
"TXT_ROLE",$lng->txt(
'obj_role'));
405 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",$lng->txt(
'reg_access_limitation_mode'));
407 $this->tpl->setVariable(
"BTN_SAVE",$lng->txt(
'save'));
408 $this->tpl->setVariable(
"BTN_CANCEL",$lng->txt(
'cancel'));
411 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
415 $this->tpl->setCurrentBlock(
"roles");
417 $this->tpl->setVariable(
"ROLE_ID",$role[
'id']);
418 $this->tpl->setVariable(
"ROLE_TITLE",$role[
'title']);
420 $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE",($this->access_limitations_obj->getMode($role[
'id']) ==
'absolute') ?
'inline' :
'none');
421 $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE",($this->access_limitations_obj->getMode($role[
'id']) ==
'relative') ?
'inline' :
'none');
422 $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED",($this->access_limitations_obj->getMode($role[
'id']) ==
'unlimited') ?
'inline' :
'none');
423 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt(
'reg_access_limitation_none'));
425 $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
426 $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_'.$role[
'id'],$date[
'y'],$date[
'm'],$date[
'd'],
'2007'));
428 $this->tpl->setVariable(
"TXT_DAYS",$lng->txt(
'days'));
429 $this->tpl->setVariable(
"TXT_MONTHS",$lng->txt(
'months'));
430 $this->tpl->setVariable(
"TXT_YEARS",$lng->txt(
'years'));
432 $this->tpl->setVariable(
"DAYS",$this->access_limitations_obj->getRelative($role[
'id'],
'd'));
433 $this->tpl->setVariable(
"MONTHS",$this->access_limitations_obj->getRelative($role[
'id'],
'm'));
434 $this->tpl->setVariable(
"YEARS",$this->access_limitations_obj->getRelative($role[
'id'],
'y'));
435 $this->tpl->parseCurrentBlock();
441 global $ilAccess,
$ilErr,$rbacreview;
443 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
445 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
449 $this->assignments_obj->add();
459 global $ilAccess,
$ilErr,$rbacreview;
461 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
463 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
466 if(!count(
$_POST[
'del_assign']))
475 foreach(
$_POST[
'del_assign'] as $assignment_id)
477 $this->assignments_obj->delete($assignment_id);
488 global $ilAccess,
$ilErr,$rbacreview;
490 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
492 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
497 if (!is_array(
$_POST[
'domain']))
499 $_POST[
'domain'] = array();
507 $this->assignments_obj->setDefaultRole((
int)
$_POST[
'default_role']);
509 if($err = $this->assignments_obj->validate())
526 $this->assignments_obj->save();
534 global $ilAccess,
$ilErr,$rbacreview;
536 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
538 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
543 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
547 $this->access_limitations_obj->setMode(
$_POST[
'access_limitation_mode_'.$role[
'id']],$role[
'id']);
548 $this->access_limitations_obj->setAbsolute(
$_POST[
'access_limitation_absolute_'.$role[
'id']],$role[
'id']);
549 $this->access_limitations_obj->setRelative(
$_POST[
'access_limitation_relative_'.$role[
'id']],$role[
'id']);
554 if($err = $this->access_limitations_obj->validate())
571 $this->access_limitations_obj->save();
579 $tpl =
new ilTemplate(
'tpl.registration_roles.html',
true,
true,
'Services/Registration');
581 $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
582 $tpl->setVariable(
"LINK_EDIT", $url);
584 if (is_array($roles) &&
sizeof($roles))
586 foreach($roles as $role)
588 $tpl->setCurrentBlock(
"list_item");
589 $tpl->setVariable(
"LIST_ITEM_ITEM", $role);
590 $tpl->parseCurrentBlock();
595 $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
603 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
608 $all[] = $role[
'title'];
615 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
619 foreach($this->assignments_obj->getAssignments() as $assignment)
621 if(strlen($assignment[
'domain']) and $assignment[
'role'])
627 if(strlen($this->assignments_obj->getDefaultRole()))
629 $all[] = $this->lng->txt(
'reg_default').
' -> '.
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
641 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
646 switch ($this->access_limitations_obj->getMode($role[
'id']))
649 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_until');
650 $txt_access_value .=
" ".ilDatePresentation::formatDate(
new ilDateTime($this->access_limitations_obj->getAbsolute($role[
'id'],
IL_CAL_UNIX)));
654 $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
655 $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
656 $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
658 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_time').
" ";
662 $txt_access_value .= $years.
" ";
663 $txt_access_value .= ($years == 1) ? $lng->txt(
'year') : $lng->txt(
'years');
669 $txt_access_value .=
", ";
673 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
678 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
684 $txt_access_value .= $months.
" ";
685 $txt_access_value .= ($months == 1) ? $lng->txt(
'month') : $lng->txt(
'months');
689 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
695 $txt_access_value .= $days.
" ";
696 $txt_access_value .= ($days == 1) ? $lng->txt(
'day') : $lng->txt(
'days');
701 $txt_access_value = $lng->txt(
'reg_access_limitation_none');
705 $all[] = $role[
'title'].
' ('.$txt_access_value.
')';
713 if(is_object($this->assignments_obj))
718 include_once
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
725 if(is_object($this->access_limitations_obj))
730 include_once
'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
737 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
741 $assignments = $this->assignments_obj->getAssignments();
742 $selected = ($assignment_id > 0) ?
743 $assignments[$assignment_id][
'role'] :
744 $this->assignments_obj->getDefaultRole();
748 $roles[0] = $this->lng->txt(
'please_choose');
751 foreach($rbacreview->getGlobalRoles() as $role_id)
753 if($role_id == ANONYMOUS_ROLE_ID)
760 if($assignment_id > 0)
763 "role[$assignment_id][role]",
779 'null' => $lng->txt(
'please_choose'),
780 'unlimited' => $lng->txt(
'reg_access_limitation_mode_unlimited'),
781 'absolute' => $lng->txt(
'reg_access_limitation_mode_absolute'),
782 'relative' => $lng->txt(
'reg_access_limitation_mode_relative')
785 $attribs = array(
'onchange' =>
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_'.$a_role_id.
','.$a_role_id.
')');
787 $selected = $this->access_limitations_obj->getMode($a_role_id);
789 return ilUtil::formSelect($selected,
'access_limitation_mode_'.$a_role_id,$options,
false,
true,0,
"",$attribs);
797 $a_unix_time = time();
800 return array(
'y' => date(
'Y',$a_unix_time),
801 'm' => date(
'n',$a_unix_time),
802 'd' => date(
'd',$a_unix_time));
809 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
811 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
816 $ilToolbar->addButton($this->lng->txt(
"registration_codes_add"),
817 $this->ctrl->getLinkTarget($this,
"addCodes"));
819 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
821 $this->tpl->setContent($ctab->getHTML());
826 global $rbacreview, $ilObjDataCache,
$lng;
828 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
831 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'createCodes'));
832 $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
834 $count =
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'),
'reg_codes_number');
836 $count->setMaxLength(4);
837 $count->setMinValue(1);
838 $count->setMaxValue(1000);
839 $count->setRequired(
true);
840 $this->form_gui->addItem($count);
842 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
843 $options = array(
"" =>
"");
844 foreach($rbacreview->getGlobalRoles() as $role_id)
846 if(!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID)))
848 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
851 $roles =
new ilSelectInputGUI($this->lng->txt(
"registration_codes_roles"),
"reg_codes_role");
854 $this->form_gui->addItem($roles);
856 $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
863 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
865 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
871 $this->tpl->setContent($this->form_gui->getHTML());
878 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
880 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
886 if($this->form_gui->checkInput())
888 $number = $this->form_gui->getInput(
'reg_codes_number');
889 $role = $this->form_gui->getInput(
'reg_codes_role');
891 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
894 for($loop = 1; $loop <= $number; $loop++)
900 $this->ctrl->redirect($this,
"listCodes");
904 $this->form_gui->setValuesByPost();
905 $this->tpl->setContent($this->form_gui->getHtml());
911 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
915 $this->ctrl->redirect($this,
"listCodes");
924 $ilErr->raiseError($this->lng->txt(
"no_checkbox"), $ilErr->MESSAGE);
929 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
931 $gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
932 $gui->setCancel($this->lng->txt(
"cancel"),
"listCodes");
933 $gui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
934 $gui->setFormAction($this->ctrl->getFormAction($this,
"deleteCodes"));
936 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
938 foreach(
$data as $code)
940 $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
943 $this->tpl->setContent($gui->getHTML());
948 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
950 $utab->resetOffset();
951 $utab->resetFilter();
958 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
960 $utab->resetOffset();
961 $utab->writeFilterToSession();
970 if(!$ilAccess->checkAccess(
'read',
'', $this->ref_id))
972 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"), $ilErr->MESSAGE);
975 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
978 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
983 ilUtil::deliverData(implode(
"\r\n", $codes),
"ilias_registration_codes_".date(
"d-m-Y").
".txt",
"text/plain");