24 require_once
'./Services/Registration/classes/class.ilRegistrationSettings.php';
53 $this->lng->loadLanguageModule(
'administration');
54 $this->lng->loadLanguageModule(
'registration');
55 $this->lng->loadLanguageModule(
'user');
57 $this->ref_id = (int)
$_GET[
'ref_id'];
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
83 function setSubTabs($activeTab =
'registration_settings')
87 $ilTabs->addSubTab(
"registration_settings",
88 $lng->txt(
"registration_tab_settings"),
89 $this->ctrl->getLinkTarget($this,
'view'));
91 $ilTabs->addSubTab(
"registration_codes",
92 $lng->txt(
"registration_tab_codes"),
93 $this->ctrl->getLinkTarget($this,
'listCodes'));
95 $ilTabs->activateSubTab($activeTab);
100 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
103 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
104 $this->form_gui->setTitle($this->lng->txt(
'reg_settings_header'));
109 $option->
setInfo($this->lng->txt(
'reg_direct_info'));
110 $cd =
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'),
'reg_codes_'.IL_REG_DIRECT);
111 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
112 $option->addSubItem($cd);
113 $reg_type->addOption($option);
115 $option->
setInfo($this->lng->txt(
'reg_approve_info'));
116 $cd =
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'),
'reg_codes_'.IL_REG_APPROVE);
117 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
118 $option->addSubItem($cd);
119 $reg_type->addOption($option);
121 $option->
setInfo($this->lng->txt(
'reg_type_confirmation_info'));
122 $lt =
new ilNumberInputGUI($this->lng->txt(
'reg_confirmation_hash_life_time'),
'reg_hash_life_time');
124 $lt->setMaxLength(6);
126 $lt->setRequired(
true);
127 $lt->setInfo($this->lng->txt(
'reg_confirmation_hash_life_time_info'));
128 $lt->setSuffix($this->lng->txt(
'seconds'));
129 $option->addSubItem($lt);
130 $cd =
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'),
'reg_codes_'.IL_REG_ACTIVATION);
131 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
132 $option->addSubItem($cd);
133 $reg_type->addOption($option);
135 $option->
setInfo($this->lng->txt(
'registration_reg_type_codes_info'));
136 $reg_type->addOption($option);
137 $this->form_gui->addItem($reg_type);
141 $pwd_gen->setInfo($this->lng->txt(
'reg_info_pwd'));
142 $this->form_gui->addItem($pwd_gen);
144 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
145 $cap =
new ilCheckboxInputGUI($this->lng->txt(
'adm_captcha_anonymous_short'),
'activate_captcha_anonym');
146 $cap->
setInfo($this->lng->txt(
'adm_captcha_anonymous_reg'));
150 $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
152 $this->form_gui->addItem($cap);
154 $approver =
new ilTextInputGUI($this->lng->txt(
'reg_notification'),
'reg_approver');
156 $approver->setMaxLength(50);
157 $approver->setInfo($this->lng->txt(
'reg_notification_info'));
158 $this->form_gui->addItem($approver);
163 $edit = $this->ctrl->getLinkTarget($this,
'editRoles');
166 $roles->addOption($option);
169 $edit = $this->ctrl->getLinkTarget($this,
'editEmailAssignments');
172 $roles->addOption($option);
173 $roles->setInfo($this->lng->txt(
'registration_codes_override_global_info'));
174 $this->form_gui->addItem($roles);
176 $limit =
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'),
'reg_access_limitation');
179 $edit = $this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations');
181 $list->
setInfo($this->lng->txt(
'registration_codes_override_global_info'));
182 $limit->addSubItem($list);
183 $this->form_gui->addItem($limit);
185 $domains =
new ilTextInputGUI($this->lng->txt(
'reg_allowed_domains'),
'reg_allowed_domains');
186 $domains->
setInfo($this->lng->txt(
'reg_allowed_domains_info'));
187 $this->form_gui->addItem($domains);
189 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
194 if($this->registration_settings->roleSelectionEnabled())
198 else if ($this->registration_settings->automaticRoleAssignmentEnabled())
203 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
205 'reg_type' => $this->registration_settings->getRegistrationType(),
206 'reg_hash_life_time' => (int)$this->registration_settings->getRegistrationHashLifetime(),
207 'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
208 'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
209 'reg_role_type' => $role_type,
210 'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
211 'reg_allowed_domains' => implode(
';', $this->registration_settings->getAllowedDomains()),
212 'activate_captcha_anonym' => ilCaptchaUtil::isActiveForRegistration()
215 $allow_codes = $this->registration_settings->getAllowCodes();
216 $reg_type = $this->registration_settings->getRegistrationType();
219 $values[
'reg_codes_'.$reg_type] =
true;
222 $this->form_gui->setValuesByArray($values);
229 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
231 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
237 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
USER_FOLDER_ID);
238 $ilToolbar->addButton($this->lng->txt(
'registration_user_new_account_mail'),
239 $ilCtrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjuserfoldergui"),
"newAccountMail"));
240 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
$_GET[
"ref_id"]);
244 $this->tpl->setContent($this->form_gui->getHTML());
251 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
253 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
256 $this->registration_settings->setRegistrationType((
int)
$_POST[
'reg_type']);
257 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
258 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
259 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
260 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
261 $this->registration_settings->setAllowedDomains($_POST[
'reg_allowed_domains']);
263 $allow_codes =
false;
266 $allow_codes = (bool)$_POST[
'reg_codes_'.(
int)$_POST[
'reg_type']];
268 $this->registration_settings->setAllowCodes($allow_codes);
270 if(!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int)$_POST[
'reg_hash_life_time']))
275 if($error_code = $this->registration_settings->validate())
281 ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients').
' '.$this->registration_settings->getUnknown());
287 ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient').
' '.$this->registration_settings->getUnknown());
294 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
295 ilCaptchaUtil::setActiveForRegistration((
bool)$_POST[
'activate_captcha_anonym']);
297 $this->registration_settings->save();
306 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
308 global $ilAccess,
$ilErr,$rbacreview;
310 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
312 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
315 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
317 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
318 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES",$this->lng->txt(
'reg_selectable_roles'));
320 $this->tpl->setVariable(
"ACTIONS",$this->lng->txt(
'actions'));
321 $this->tpl->setVariable(
"UPDATE",$this->lng->txt(
'save'));
322 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
325 foreach($rbacreview->getGlobalRoles() as $role)
327 if($role == SYSTEM_ROLE_ID or $role == ANONYMOUS_ROLE_ID)
331 $this->tpl->setCurrentBlock(
"roles");
337 $this->tpl->parseCurrentBlock();
344 global $ilAccess,
$ilErr,$rbacreview;
346 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
348 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
351 if(count(
$_POST[
'roles']) < 1)
358 foreach($rbacreview->getGlobalRoles() as $role)
362 $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
375 global $ilAccess,
$ilErr,$rbacreview;
377 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
379 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
384 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_email_role_assignments.html',
'Services/Registration');
385 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
386 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt(
'reg_email_role_assignment'));
387 $this->tpl->setVariable(
"TXT_MAIL",$this->lng->txt(
'reg_email'));
388 $this->tpl->setVariable(
"TXT_ROLE",$this->lng->txt(
'obj_role'));
389 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'reg_default'));
391 $this->tpl->setVariable(
"TXT_DOMAIN",$this->lng->txt(
'reg_domain'));
394 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
395 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
396 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
'reg_add_assignment'));
397 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
400 foreach($this->assignments_obj->getAssignments() as $assignment)
402 $this->tpl->setCurrentBlock(
"roles");
404 $this->tpl->setVariable(
"ASSIGN_ID",$assignment[
'id']);
405 $this->tpl->setVariable(
"DOMAIN",$assignment[
'domain']);
408 $this->tpl->parseCurrentBlock();
412 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'default'));
420 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
422 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
427 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
429 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
430 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",$lng->txt(
'reg_role_access_limitations'));
431 $this->tpl->setVariable(
"TXT_ROLE",$lng->txt(
'obj_role'));
432 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",$lng->txt(
'reg_access_limitation_mode'));
434 $this->tpl->setVariable(
"BTN_SAVE",$lng->txt(
'save'));
435 $this->tpl->setVariable(
"BTN_CANCEL",$lng->txt(
'cancel'));
438 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
442 $this->tpl->setCurrentBlock(
"roles");
444 $this->tpl->setVariable(
"ROLE_ID",$role[
'id']);
445 $this->tpl->setVariable(
"ROLE_TITLE",$role[
'title']);
447 $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE",($this->access_limitations_obj->getMode($role[
'id']) ==
'absolute') ?
'inline' :
'none');
448 $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE",($this->access_limitations_obj->getMode($role[
'id']) ==
'relative') ?
'inline' :
'none');
449 $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED",($this->access_limitations_obj->getMode($role[
'id']) ==
'unlimited') ?
'inline' :
'none');
450 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt(
'reg_access_limitation_none'));
452 $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
453 $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_'.$role[
'id'],$date[
'y'],$date[
'm'],$date[
'd'],
'2007'));
455 $this->tpl->setVariable(
"TXT_DAYS",$lng->txt(
'days'));
456 $this->tpl->setVariable(
"TXT_MONTHS",$lng->txt(
'months'));
457 $this->tpl->setVariable(
"TXT_YEARS",$lng->txt(
'years'));
459 $this->tpl->setVariable(
"DAYS",$this->access_limitations_obj->getRelative($role[
'id'],
'd'));
460 $this->tpl->setVariable(
"MONTHS",$this->access_limitations_obj->getRelative($role[
'id'],
'm'));
461 $this->tpl->setVariable(
"YEARS",$this->access_limitations_obj->getRelative($role[
'id'],
'y'));
462 $this->tpl->parseCurrentBlock();
468 global $ilAccess,
$ilErr,$rbacreview;
470 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
472 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
476 $this->assignments_obj->add();
486 global $ilAccess,
$ilErr,$rbacreview;
488 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
490 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
493 if(!count(
$_POST[
'del_assign']))
502 foreach(
$_POST[
'del_assign'] as $assignment_id)
504 $this->assignments_obj->delete($assignment_id);
515 global $ilAccess,
$ilErr,$rbacreview;
517 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
519 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
524 if (!is_array(
$_POST[
'domain']))
526 $_POST[
'domain'] = array();
529 foreach(
$_POST[
'domain'] as $id => $data)
534 $this->assignments_obj->setDefaultRole((
int)
$_POST[
'default_role']);
536 if($err = $this->assignments_obj->validate())
553 $this->assignments_obj->save();
561 global $ilAccess,
$ilErr,$rbacreview;
563 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
565 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
570 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
574 $this->access_limitations_obj->setMode(
$_POST[
'access_limitation_mode_'.$role[
'id']],$role[
'id']);
575 $this->access_limitations_obj->setAbsolute(
$_POST[
'access_limitation_absolute_'.$role[
'id']],$role[
'id']);
576 $this->access_limitations_obj->setRelative(
$_POST[
'access_limitation_relative_'.$role[
'id']],$role[
'id']);
581 if($err = $this->access_limitations_obj->validate())
598 $this->access_limitations_obj->save();
606 $tpl =
new ilTemplate(
'tpl.registration_roles.html',
true,
true,
'Services/Registration');
608 $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
609 $tpl->setVariable(
"LINK_EDIT", $url);
611 if (is_array($roles) &&
sizeof($roles))
613 foreach($roles as $role)
615 $tpl->setCurrentBlock(
"list_item");
616 $tpl->setVariable(
"LIST_ITEM_ITEM", $role);
617 $tpl->parseCurrentBlock();
622 $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
630 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
635 $all[] = $role[
'title'];
642 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
646 foreach($this->assignments_obj->getAssignments() as $assignment)
648 if(strlen($assignment[
'domain']) and $assignment[
'role'])
654 if(strlen($this->assignments_obj->getDefaultRole()))
656 $all[] = $this->lng->txt(
'reg_default').
' -> '.
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
668 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
673 switch ($this->access_limitations_obj->getMode($role[
'id']))
676 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_until');
677 $txt_access_value .=
" ".ilDatePresentation::formatDate(
new ilDateTime($this->access_limitations_obj->getAbsolute($role[
'id'],
IL_CAL_UNIX)));
681 $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
682 $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
683 $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
685 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_time').
" ";
689 $txt_access_value .= $years.
" ";
690 $txt_access_value .= ($years == 1) ? $lng->txt(
'year') : $lng->txt(
'years');
696 $txt_access_value .=
", ";
700 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
705 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
711 $txt_access_value .= $months.
" ";
712 $txt_access_value .= ($months == 1) ? $lng->txt(
'month') : $lng->txt(
'months');
716 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
722 $txt_access_value .= $days.
" ";
723 $txt_access_value .= ($days == 1) ? $lng->txt(
'day') : $lng->txt(
'days');
728 $txt_access_value = $lng->txt(
'reg_access_limitation_none');
732 $all[] = $role[
'title'].
' ('.$txt_access_value.
')';
740 if(is_object($this->assignments_obj))
745 include_once
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
752 if(is_object($this->access_limitations_obj))
757 include_once
'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
764 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
768 $assignments = $this->assignments_obj->getAssignments();
769 $selected = ($assignment_id > 0) ?
770 $assignments[$assignment_id][
'role'] :
771 $this->assignments_obj->getDefaultRole();
775 $roles[0] = $this->lng->txt(
'please_choose');
778 foreach($rbacreview->getGlobalRoles() as $role_id)
780 if($role_id == ANONYMOUS_ROLE_ID)
787 if($assignment_id > 0)
790 "role[$assignment_id][role]",
806 'null' => $lng->txt(
'please_choose'),
807 'unlimited' => $lng->txt(
'reg_access_limitation_mode_unlimited'),
808 'absolute' => $lng->txt(
'reg_access_limitation_mode_absolute'),
809 'relative' => $lng->txt(
'reg_access_limitation_mode_relative')
812 $attribs = array(
'onchange' =>
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_'.$a_role_id.
','.$a_role_id.
')');
814 $selected = $this->access_limitations_obj->getMode($a_role_id);
824 $a_unix_time = time();
827 return array(
'y' => date(
'Y',$a_unix_time),
828 'm' => date(
'n',$a_unix_time),
829 'd' => date(
'd',$a_unix_time));
836 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
838 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
843 $ilToolbar->addButton($this->lng->txt(
"registration_codes_add"),
844 $this->ctrl->getLinkTarget($this,
"addCodes"));
846 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
848 $this->tpl->setContent($ctab->getHTML());
853 global $rbacreview, $ilObjDataCache,
$lng;
855 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
858 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'createCodes'));
859 $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
861 $count =
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'),
'reg_codes_number');
863 $count->setMaxLength(4);
864 $count->setMinValue(1);
865 $count->setMaxValue(1000);
866 $count->setRequired(
true);
867 $this->form_gui->addItem($count);
873 $code_type->addOption(
875 $this->lng->txt(
'registration_codes_type_reg'),
877 $this->lng->txt(
'registration_codes_type_reg_info'))
879 $code_type->addOption(
881 $this->lng->txt(
'registration_codes_type_ext'),
883 $this->lng->txt(
'registration_codes_type_ext_info'))
885 $this->form_gui->addItem($code_type);
889 $sec->setTitle($this->lng->txt(
'registration_codes_roles_title'));
890 $this->form_gui->addItem($sec);
892 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
893 $options = array(
"" => $this->lng->txt(
'registration_codes_no_assigned_role'));
894 foreach($rbacreview->getGlobalRoles() as $role_id)
896 if(!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID)))
898 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
901 $roles =
new ilSelectInputGUI($this->lng->txt(
"registration_codes_roles"),
"reg_codes_role");
902 $roles->
setInfo($this->lng->txt(
"registration_codes_override_info"));
904 $this->form_gui->addItem($roles);
906 $local =
new ilTextInputGUI($this->lng->txt(
"registration_codes_roles_local"),
"reg_codes_local");
908 $local->setDataSource($this->ctrl->getLinkTarget($this,
"getLocalRoleAutoComplete",
"",
true));
909 $this->form_gui->addItem($local);
913 $sec->setTitle($this->lng->txt(
'reg_access_limitations'));
914 $this->form_gui->addItem($sec);
917 $limit->
setInfo($this->lng->txt(
"registration_codes_override_info"));
918 $this->form_gui->addItem($limit);
920 $opt =
new ilRadioOption($this->lng->txt(
"registration_codes_roles_limitation_none"),
"none");
921 $limit->addOption($opt);
923 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_none"),
"unlimited");
924 $limit->addOption($opt);
926 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_absolute"),
"absolute");
927 $limit->addOption($opt);
929 $dt =
new ilDateTimeInputGUI($this->lng->txt(
"reg_access_limitation_mode_absolute_target"),
"abs_date");
931 $opt->addSubItem($dt);
933 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_relative"),
"relative");
934 $limit->addOption($opt);
938 $days->setSuffix($this->lng->txt(
"days"));
942 $mon->setSuffix($this->lng->txt(
"months"));
946 $yr->setSuffix($this->lng->txt(
"years"));
949 if(is_array(
$_POST[
"rel_date"]))
951 $days->setValue(
$_POST[
"rel_date"][
"d"]);
952 $mon->setValue(
$_POST[
"rel_date"][
"m"]);
953 $yr->setValue(
$_POST[
"rel_date"][
"y"]);
956 $dur =
new ilCustomInputGUI($this->lng->txt(
"reg_access_limitation_mode_relative_target"));
959 $days->getToolbarHTML().
" ".
960 $mon->getToolbarHTML().
" ".
961 $yr->getToolbarHTML()
963 $opt->addSubItem($dur);
965 $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
966 $this->form_gui->addCommandButton(
'listCodes',$this->lng->txt(
'cancel'));
973 include_once(
"./Services/AccessControl/classes/class.ilRoleAutoComplete.php");
983 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
985 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
993 $limit = $this->form_gui->getItemByPostVar(
"reg_limit");
994 $limit->setValue(
"none");
996 $this->tpl->setContent($this->form_gui->getHTML());
1001 global $ilAccess,
$ilErr, $rbacreview;
1003 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
1005 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
1011 $valid = $this->form_gui->checkInput();
1014 $number = $this->form_gui->getInput(
'reg_codes_number');
1015 $role = $this->form_gui->getInput(
'reg_codes_role');
1016 $local = $this->form_gui->getInput(
"reg_codes_local");
1018 if(is_array($local))
1020 $role_ids = array();
1021 foreach(array_unique($local) as $item)
1025 $role_id = $rbacreview->roleExists($item);
1028 $role_ids[] = $role_id;
1032 if(
sizeof($role_ids))
1039 $limit = $this->form_gui->getInput(
"reg_limit");
1043 $date = $this->form_gui->getInput(
"abs_date");
1044 $date = $date[
"date"];
1045 if($date < date(
"Y-m-d"))
1052 $date = $this->form_gui->getInput(
"rel_date");
1053 if(!array_sum($date))
1067 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1070 for($loop = 1; $loop <= $number; $loop++)
1072 $code_types = (array) $this->form_gui->getInput(
'code_type');
1080 in_array(self::CODE_TYPE_REGISTRATION, $code_types) ? TRUE : FALSE,
1081 in_array(self::CODE_TYPE_EXTENSION, $code_types) ? TRUE : FALSE
1086 $this->ctrl->redirect($this,
"listCodes");
1090 $this->form_gui->setValuesByPost();
1091 $this->tpl->setContent($this->form_gui->getHtml());
1097 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1101 $this->ctrl->redirect($this,
"listCodes");
1110 $ilErr->raiseError($this->lng->txt(
"no_checkbox"), $ilErr->MESSAGE);
1115 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
1117 $gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
1118 $gui->setCancel($this->lng->txt(
"cancel"),
"listCodes");
1119 $gui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
1120 $gui->setFormAction($this->ctrl->getFormAction($this,
"deleteCodes"));
1122 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1124 foreach($data as $code)
1126 $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
1129 $this->tpl->setContent($gui->getHTML());
1134 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1136 $utab->resetOffset();
1137 $utab->resetFilter();
1144 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1146 $utab->resetOffset();
1147 $utab->writeFilterToSession();
1154 global $ilAccess,
$ilErr;
1156 if(!$ilAccess->checkAccess(
'read',
'', $this->ref_id))
1158 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"), $ilErr->MESSAGE);
1161 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1164 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1169 ilUtil::deliverData(implode(
"\r\n", $codes),
"ilias_registration_codes_".date(
"d-m-Y").
".txt",
"text/plain");