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(6);
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 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
141 $cap =
new ilCheckboxInputGUI($this->lng->txt(
'adm_captcha_anonymous_short'),
'activate_captcha_anonym');
142 $cap->
setInfo($this->lng->txt(
'adm_captcha_anonymous_reg'));
146 $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
148 $this->form_gui->addItem($cap);
150 $approver =
new ilTextInputGUI($this->lng->txt(
'reg_notification'),
'reg_approver');
152 $approver->setMaxLength(50);
153 $approver->setInfo($this->lng->txt(
'reg_notification_info'));
154 $this->form_gui->addItem($approver);
159 $edit = $this->ctrl->getLinkTarget($this,
'editRoles');
162 $roles->addOption($option);
165 $edit = $this->ctrl->getLinkTarget($this,
'editEmailAssignments');
168 $roles->addOption($option);
169 $roles->setInfo($this->lng->txt(
'registration_codes_override_global_info'));
170 $this->form_gui->addItem($roles);
172 $limit =
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'),
'reg_access_limitation');
175 $edit = $this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations');
177 $list->
setInfo($this->lng->txt(
'registration_codes_override_global_info'));
178 $limit->addSubItem($list);
179 $this->form_gui->addItem($limit);
181 $domains =
new ilTextInputGUI($this->lng->txt(
'reg_allowed_domains'),
'reg_allowed_domains');
182 $domains->
setInfo($this->lng->txt(
'reg_allowed_domains_info'));
183 $this->form_gui->addItem($domains);
185 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
190 if($this->registration_settings->roleSelectionEnabled())
194 else if ($this->registration_settings->automaticRoleAssignmentEnabled())
199 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
201 'reg_type' => $this->registration_settings->getRegistrationType(),
202 'reg_hash_life_time' => (int)$this->registration_settings->getRegistrationHashLifetime(),
203 'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
204 'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
205 'reg_role_type' => $role_type,
206 'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
207 'reg_allowed_domains' => implode(
';', $this->registration_settings->getAllowedDomains()),
208 'activate_captcha_anonym' => ilCaptchaUtil::isActiveForRegistration()
211 $allow_codes = $this->registration_settings->getAllowCodes();
212 $reg_type = $this->registration_settings->getRegistrationType();
215 $values[
'reg_codes_'.$reg_type] =
true;
218 $this->form_gui->setValuesByArray($values);
225 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
227 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
233 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
USER_FOLDER_ID);
234 $ilToolbar->addButton($this->lng->txt(
'registration_user_new_account_mail'),
235 $ilCtrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjuserfoldergui"),
"newAccountMail"));
236 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
$_GET[
"ref_id"]);
240 $this->tpl->setContent($this->form_gui->getHTML());
247 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
249 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
252 $this->registration_settings->setRegistrationType((
int)
$_POST[
'reg_type']);
253 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
254 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
255 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
256 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
257 $this->registration_settings->setAllowedDomains($_POST[
'reg_allowed_domains']);
259 $allow_codes =
false;
262 $allow_codes = (bool)$_POST[
'reg_codes_'.(
int)$_POST[
'reg_type']];
264 $this->registration_settings->setAllowCodes($allow_codes);
266 if(!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int)$_POST[
'reg_hash_life_time']))
271 if($error_code = $this->registration_settings->validate())
277 ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients').
' '.$this->registration_settings->getUnknown());
283 ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient').
' '.$this->registration_settings->getUnknown());
290 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
291 ilCaptchaUtil::setActiveForRegistration((
bool)$_POST[
'activate_captcha_anonym']);
293 $this->registration_settings->save();
302 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
304 global $ilAccess,
$ilErr,$rbacreview;
306 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
308 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
311 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
313 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
314 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES",$this->lng->txt(
'reg_selectable_roles'));
316 $this->tpl->setVariable(
"ACTIONS",$this->lng->txt(
'actions'));
317 $this->tpl->setVariable(
"UPDATE",$this->lng->txt(
'save'));
318 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
321 foreach($rbacreview->getGlobalRoles() as $role)
323 if($role == SYSTEM_ROLE_ID or $role == ANONYMOUS_ROLE_ID)
327 $this->tpl->setCurrentBlock(
"roles");
333 $this->tpl->parseCurrentBlock();
340 global $ilAccess,
$ilErr,$rbacreview;
342 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
344 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
347 if(count(
$_POST[
'roles']) < 1)
354 foreach($rbacreview->getGlobalRoles() as $role)
358 $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
371 global $ilAccess,
$ilErr,$rbacreview;
373 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
375 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
380 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_email_role_assignments.html',
'Services/Registration');
381 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
382 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt(
'reg_email_role_assignment'));
383 $this->tpl->setVariable(
"TXT_MAIL",$this->lng->txt(
'reg_email'));
384 $this->tpl->setVariable(
"TXT_ROLE",$this->lng->txt(
'obj_role'));
385 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'reg_default'));
387 $this->tpl->setVariable(
"TXT_DOMAIN",$this->lng->txt(
'reg_domain'));
390 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
391 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
392 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
'reg_add_assignment'));
393 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
396 foreach($this->assignments_obj->getAssignments() as $assignment)
398 $this->tpl->setCurrentBlock(
"roles");
400 $this->tpl->setVariable(
"ASSIGN_ID",$assignment[
'id']);
401 $this->tpl->setVariable(
"DOMAIN",$assignment[
'domain']);
404 $this->tpl->parseCurrentBlock();
408 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'default'));
416 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
418 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
423 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
425 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
426 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",$lng->txt(
'reg_role_access_limitations'));
427 $this->tpl->setVariable(
"TXT_ROLE",$lng->txt(
'obj_role'));
428 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",$lng->txt(
'reg_access_limitation_mode'));
430 $this->tpl->setVariable(
"BTN_SAVE",$lng->txt(
'save'));
431 $this->tpl->setVariable(
"BTN_CANCEL",$lng->txt(
'cancel'));
434 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
438 $this->tpl->setCurrentBlock(
"roles");
440 $this->tpl->setVariable(
"ROLE_ID",$role[
'id']);
441 $this->tpl->setVariable(
"ROLE_TITLE",$role[
'title']);
443 $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE",($this->access_limitations_obj->getMode($role[
'id']) ==
'absolute') ?
'inline' :
'none');
444 $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE",($this->access_limitations_obj->getMode($role[
'id']) ==
'relative') ?
'inline' :
'none');
445 $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED",($this->access_limitations_obj->getMode($role[
'id']) ==
'unlimited') ?
'inline' :
'none');
446 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt(
'reg_access_limitation_none'));
448 $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
449 $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_'.$role[
'id'],$date[
'y'],$date[
'm'],$date[
'd'],
'2007'));
451 $this->tpl->setVariable(
"TXT_DAYS",$lng->txt(
'days'));
452 $this->tpl->setVariable(
"TXT_MONTHS",$lng->txt(
'months'));
453 $this->tpl->setVariable(
"TXT_YEARS",$lng->txt(
'years'));
455 $this->tpl->setVariable(
"DAYS",$this->access_limitations_obj->getRelative($role[
'id'],
'd'));
456 $this->tpl->setVariable(
"MONTHS",$this->access_limitations_obj->getRelative($role[
'id'],
'm'));
457 $this->tpl->setVariable(
"YEARS",$this->access_limitations_obj->getRelative($role[
'id'],
'y'));
458 $this->tpl->parseCurrentBlock();
464 global $ilAccess,
$ilErr,$rbacreview;
466 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
468 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
472 $this->assignments_obj->add();
482 global $ilAccess,
$ilErr,$rbacreview;
484 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
486 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
489 if(!count(
$_POST[
'del_assign']))
498 foreach(
$_POST[
'del_assign'] as $assignment_id)
500 $this->assignments_obj->delete($assignment_id);
511 global $ilAccess,
$ilErr,$rbacreview;
513 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
515 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
520 if (!is_array(
$_POST[
'domain']))
522 $_POST[
'domain'] = array();
525 foreach(
$_POST[
'domain'] as $id => $data)
530 $this->assignments_obj->setDefaultRole((
int)
$_POST[
'default_role']);
532 if($err = $this->assignments_obj->validate())
549 $this->assignments_obj->save();
557 global $ilAccess,
$ilErr,$rbacreview;
559 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
561 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
566 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
570 $this->access_limitations_obj->setMode(
$_POST[
'access_limitation_mode_'.$role[
'id']],$role[
'id']);
571 $this->access_limitations_obj->setAbsolute(
$_POST[
'access_limitation_absolute_'.$role[
'id']],$role[
'id']);
572 $this->access_limitations_obj->setRelative(
$_POST[
'access_limitation_relative_'.$role[
'id']],$role[
'id']);
577 if($err = $this->access_limitations_obj->validate())
594 $this->access_limitations_obj->save();
602 $tpl =
new ilTemplate(
'tpl.registration_roles.html',
true,
true,
'Services/Registration');
604 $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
605 $tpl->setVariable(
"LINK_EDIT", $url);
607 if (is_array($roles) &&
sizeof($roles))
609 foreach($roles as $role)
611 $tpl->setCurrentBlock(
"list_item");
612 $tpl->setVariable(
"LIST_ITEM_ITEM", $role);
613 $tpl->parseCurrentBlock();
618 $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
626 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
631 $all[] = $role[
'title'];
638 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
642 foreach($this->assignments_obj->getAssignments() as $assignment)
644 if(strlen($assignment[
'domain']) and $assignment[
'role'])
650 if(strlen($this->assignments_obj->getDefaultRole()))
652 $all[] = $this->lng->txt(
'reg_default').
' -> '.
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
664 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
669 switch ($this->access_limitations_obj->getMode($role[
'id']))
672 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_until');
673 $txt_access_value .=
" ".ilDatePresentation::formatDate(
new ilDateTime($this->access_limitations_obj->getAbsolute($role[
'id'],
IL_CAL_UNIX)));
677 $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
678 $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
679 $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
681 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_time').
" ";
685 $txt_access_value .= $years.
" ";
686 $txt_access_value .= ($years == 1) ? $lng->txt(
'year') : $lng->txt(
'years');
692 $txt_access_value .=
", ";
696 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
701 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
707 $txt_access_value .= $months.
" ";
708 $txt_access_value .= ($months == 1) ? $lng->txt(
'month') : $lng->txt(
'months');
712 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
718 $txt_access_value .= $days.
" ";
719 $txt_access_value .= ($days == 1) ? $lng->txt(
'day') : $lng->txt(
'days');
724 $txt_access_value = $lng->txt(
'reg_access_limitation_none');
728 $all[] = $role[
'title'].
' ('.$txt_access_value.
')';
736 if(is_object($this->assignments_obj))
741 include_once
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
748 if(is_object($this->access_limitations_obj))
753 include_once
'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
760 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
764 $assignments = $this->assignments_obj->getAssignments();
765 $selected = ($assignment_id > 0) ?
766 $assignments[$assignment_id][
'role'] :
767 $this->assignments_obj->getDefaultRole();
771 $roles[0] = $this->lng->txt(
'please_choose');
774 foreach($rbacreview->getGlobalRoles() as $role_id)
776 if($role_id == ANONYMOUS_ROLE_ID)
783 if($assignment_id > 0)
786 "role[$assignment_id][role]",
802 'null' => $lng->txt(
'please_choose'),
803 'unlimited' => $lng->txt(
'reg_access_limitation_mode_unlimited'),
804 'absolute' => $lng->txt(
'reg_access_limitation_mode_absolute'),
805 'relative' => $lng->txt(
'reg_access_limitation_mode_relative')
808 $attribs = array(
'onchange' =>
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_'.$a_role_id.
','.$a_role_id.
')');
810 $selected = $this->access_limitations_obj->getMode($a_role_id);
820 $a_unix_time = time();
823 return array(
'y' => date(
'Y',$a_unix_time),
824 'm' => date(
'n',$a_unix_time),
825 'd' => date(
'd',$a_unix_time));
832 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
834 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
839 $ilToolbar->addButton($this->lng->txt(
"registration_codes_add"),
840 $this->ctrl->getLinkTarget($this,
"addCodes"));
842 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
844 $this->tpl->setContent($ctab->getHTML());
849 global $rbacreview, $ilObjDataCache,
$lng;
851 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
854 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'createCodes'));
855 $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
857 $count =
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'),
'reg_codes_number');
859 $count->setMaxLength(4);
860 $count->setMinValue(1);
861 $count->setMaxValue(1000);
862 $count->setRequired(
true);
863 $this->form_gui->addItem($count);
867 $sec->setTitle($this->lng->txt(
'registration_codes_roles_title'));
868 $this->form_gui->addItem($sec);
870 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
871 $options = array(
"" => $this->lng->txt(
'registration_codes_no_assigned_role'));
872 foreach($rbacreview->getGlobalRoles() as $role_id)
874 if(!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID)))
876 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
879 $roles =
new ilSelectInputGUI($this->lng->txt(
"registration_codes_roles"),
"reg_codes_role");
880 $roles->
setInfo($this->lng->txt(
"registration_codes_override_info"));
882 $this->form_gui->addItem($roles);
884 $local =
new ilTextInputGUI($this->lng->txt(
"registration_codes_roles_local"),
"reg_codes_local");
886 $local->setDataSource($this->ctrl->getLinkTarget($this,
"getLocalRoleAutoComplete",
"",
true));
887 $this->form_gui->addItem($local);
891 $sec->setTitle($this->lng->txt(
'reg_access_limitations'));
892 $this->form_gui->addItem($sec);
895 $limit->
setInfo($this->lng->txt(
"registration_codes_override_info"));
896 $this->form_gui->addItem($limit);
898 $opt =
new ilRadioOption($this->lng->txt(
"registration_codes_roles_limitation_none"),
"none");
899 $limit->addOption($opt);
901 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_none"),
"unlimited");
902 $limit->addOption($opt);
904 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_absolute"),
"absolute");
905 $limit->addOption($opt);
907 $dt =
new ilDateTimeInputGUI($this->lng->txt(
"reg_access_limitation_mode_absolute_target"),
"abs_date");
909 $opt->addSubItem($dt);
911 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_relative"),
"relative");
912 $limit->addOption($opt);
916 $days->setSuffix($this->lng->txt(
"days"));
920 $mon->setSuffix($this->lng->txt(
"months"));
924 $yr->setSuffix($this->lng->txt(
"years"));
927 if(is_array(
$_POST[
"rel_date"]))
929 $days->setValue(
$_POST[
"rel_date"][
"d"]);
930 $mon->setValue(
$_POST[
"rel_date"][
"m"]);
931 $yr->setValue(
$_POST[
"rel_date"][
"y"]);
934 $dur =
new ilCustomInputGUI($this->lng->txt(
"reg_access_limitation_mode_relative_target"));
937 $days->getToolbarHTML().
" ".
938 $mon->getToolbarHTML().
" ".
939 $yr->getToolbarHTML()
941 $opt->addSubItem($dur);
943 $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
950 include_once(
"./Services/AccessControl/classes/class.ilRoleAutoComplete.php");
960 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
962 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
970 $limit = $this->form_gui->getItemByPostVar(
"reg_limit");
971 $limit->setValue(
"none");
973 $this->tpl->setContent($this->form_gui->getHTML());
978 global $ilAccess,
$ilErr, $rbacreview;
980 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
982 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
988 $valid = $this->form_gui->checkInput();
991 $number = $this->form_gui->getInput(
'reg_codes_number');
992 $role = $this->form_gui->getInput(
'reg_codes_role');
993 $local = $this->form_gui->getInput(
"reg_codes_local");
998 foreach(array_unique($local) as $item)
1002 $role_id = $rbacreview->roleExists($item);
1005 $role_ids[] = $role_id;
1009 if(
sizeof($role_ids))
1016 $limit = $this->form_gui->getInput(
"reg_limit");
1020 $date = $this->form_gui->getInput(
"abs_date");
1021 $date = $date[
"date"];
1022 if($date < date(
"Y-m-d"))
1029 $date = $this->form_gui->getInput(
"rel_date");
1030 if(!array_sum($date))
1044 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1047 for($loop = 1; $loop <= $number; $loop++)
1053 $this->ctrl->redirect($this,
"listCodes");
1057 $this->form_gui->setValuesByPost();
1058 $this->tpl->setContent($this->form_gui->getHtml());
1064 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1068 $this->ctrl->redirect($this,
"listCodes");
1077 $ilErr->raiseError($this->lng->txt(
"no_checkbox"), $ilErr->MESSAGE);
1082 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
1084 $gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
1085 $gui->setCancel($this->lng->txt(
"cancel"),
"listCodes");
1086 $gui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
1087 $gui->setFormAction($this->ctrl->getFormAction($this,
"deleteCodes"));
1089 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1091 foreach($data as $code)
1093 $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
1096 $this->tpl->setContent($gui->getHTML());
1101 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1103 $utab->resetOffset();
1104 $utab->resetFilter();
1111 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1113 $utab->resetOffset();
1114 $utab->writeFilterToSession();
1121 global $ilAccess,
$ilErr;
1123 if(!$ilAccess->checkAccess(
'read',
'', $this->ref_id))
1125 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"), $ilErr->MESSAGE);
1128 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1131 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1136 ilUtil::deliverData(implode(
"\r\n", $codes),
"ilias_registration_codes_".date(
"d-m-Y").
".txt",
"text/plain");