24 require_once
'./Services/Registration/classes/class.ilRegistrationSettings.php';
57 $this->lng->loadLanguageModule(
'administration');
58 $this->lng->loadLanguageModule(
'registration');
59 $this->lng->loadLanguageModule(
'user');
61 $this->ref_id = (int)
$_GET[
'ref_id'];
68 $next_class = $this->ctrl->getNextClass($this);
69 $cmd = $this->ctrl->getCmd();
70 switch ($next_class) {
85 public function setSubTabs($activeTab =
'registration_settings')
89 $ilTabs = $DIC[
'ilTabs'];
93 "registration_settings",
94 $lng->txt(
"registration_tab_settings"),
95 $this->ctrl->getLinkTarget($this,
'view')
100 $lng->txt(
"registration_tab_codes"),
101 $this->ctrl->getLinkTarget($this,
'listCodes')
104 $ilTabs->activateSubTab($activeTab);
109 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
112 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
113 $this->form_gui->setTitle($this->lng->txt(
'reg_settings_header'));
118 $option->
setInfo($this->lng->txt(
'reg_direct_info'));
120 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
121 $option->addSubItem($cd);
122 $reg_type->addOption($option);
124 $option->
setInfo($this->lng->txt(
'reg_approve_info'));
126 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
127 $option->addSubItem($cd);
128 $reg_type->addOption($option);
130 $option->
setInfo($this->lng->txt(
'reg_type_confirmation_info'));
131 $lt =
new ilNumberInputGUI($this->lng->txt(
'reg_confirmation_hash_life_time'),
'reg_hash_life_time');
133 $lt->setMaxLength(6);
135 $lt->setRequired(
true);
136 $lt->setInfo($this->lng->txt(
'reg_confirmation_hash_life_time_info'));
137 $lt->setSuffix($this->lng->txt(
'seconds'));
138 $option->addSubItem($lt);
140 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
141 $option->addSubItem($cd);
142 $reg_type->addOption($option);
144 $option->
setInfo($this->lng->txt(
'registration_reg_type_codes_info'));
145 $reg_type->addOption($option);
146 $this->form_gui->addItem($reg_type);
150 $pwd_gen->setInfo($this->lng->txt(
'reg_info_pwd'));
151 $this->form_gui->addItem($pwd_gen);
153 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
154 $cap =
new ilCheckboxInputGUI($this->lng->txt(
'adm_captcha_anonymous_short'),
'activate_captcha_anonym');
155 $cap->
setInfo($this->lng->txt(
'adm_captcha_anonymous_reg'));
158 $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
160 $this->form_gui->addItem($cap);
162 $approver =
new ilTextInputGUI($this->lng->txt(
'reg_notification'),
'reg_approver');
164 $approver->setMaxLength(50);
165 $approver->setInfo($this->lng->txt(
'reg_notification_info'));
166 $this->form_gui->addItem($approver);
171 $edit = $this->ctrl->getLinkTarget($this,
'editRoles');
174 $roles->addOption($option);
177 $edit = $this->ctrl->getLinkTarget($this,
'editEmailAssignments');
180 $roles->addOption($option);
181 $roles->setInfo($this->lng->txt(
'registration_codes_override_global_info'));
182 $this->form_gui->addItem($roles);
184 $limit =
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'),
'reg_access_limitation');
187 $edit = $this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations');
189 $list->
setInfo($this->lng->txt(
'registration_codes_override_global_info'));
190 $limit->addSubItem($list);
191 $this->form_gui->addItem($limit);
193 $domains =
new ilTextInputGUI($this->lng->txt(
'reg_allowed_domains'),
'reg_allowed_domains');
194 $domains->
setInfo($this->lng->txt(
'reg_allowed_domains_info'));
195 $this->form_gui->addItem($domains);
197 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
202 if ($this->registration_settings->roleSelectionEnabled()) {
204 } elseif ($this->registration_settings->automaticRoleAssignmentEnabled()) {
208 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
210 'reg_type' => $this->registration_settings->getRegistrationType(),
211 'reg_hash_life_time' => (int) $this->registration_settings->getRegistrationHashLifetime(),
212 'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
213 'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
214 'reg_role_type' => $role_type,
215 'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
216 'reg_allowed_domains' => implode(
';', $this->registration_settings->getAllowedDomains()),
217 'activate_captcha_anonym' => ilCaptchaUtil::isActiveForRegistration()
220 $allow_codes = $this->registration_settings->getAllowCodes();
221 $reg_type = $this->registration_settings->getRegistrationType();
223 $values[
'reg_codes_' . $reg_type] =
true;
226 $this->form_gui->setValuesByArray(
$values);
233 $ilAccess = $DIC[
'ilAccess'];
236 $ilToolbar = $DIC[
'ilToolbar'];
237 $ilTabs = $DIC[
'ilTabs'];
239 if (!$ilAccess->checkAccess(
'read',
'', $this->ref_id)) {
240 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
247 $ilToolbar->addButton(
248 $this->lng->txt(
'registration_user_new_account_mail'),
249 $ilCtrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjuserfoldergui"),
"newAccountMail")
251 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui",
"ref_id",
$_GET[
"ref_id"]);
255 $this->tpl->setContent($this->form_gui->getHTML());
262 $ilAccess = $DIC[
'ilAccess'];
265 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
266 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
269 $this->registration_settings->setRegistrationType((
int)
$_POST[
'reg_type']);
270 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
271 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
272 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
273 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
274 $this->registration_settings->setAllowedDomains($_POST[
'reg_allowed_domains']);
276 $allow_codes =
false;
278 $allow_codes = (bool) $_POST[
'reg_codes_' . (
int) $_POST[
'reg_type']];
280 $this->registration_settings->setAllowCodes($allow_codes);
282 if (!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int) $_POST[
'reg_hash_life_time'])) {
288 if ($error_code = $this->registration_settings->validate()) {
289 switch ($error_code) {
292 ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients') .
' ' . $this->registration_settings->getUnknown());
298 ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient') .
' ' . $this->registration_settings->getUnknown());
305 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
306 ilCaptchaUtil::setActiveForRegistration((
bool) $_POST[
'activate_captcha_anonym']);
308 $this->registration_settings->save();
309 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
317 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
321 $ilAccess = $DIC[
'ilAccess'];
323 $rbacreview = $DIC[
'rbacreview'];
325 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
326 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
329 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
331 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
332 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES", $this->lng->txt(
'reg_selectable_roles'));
334 $this->tpl->setVariable(
"ACTIONS", $this->lng->txt(
'actions'));
335 $this->tpl->setVariable(
"UPDATE", $this->lng->txt(
'save'));
336 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
'cancel'));
339 foreach ($rbacreview->getGlobalRoles() as $role) {
340 if ($role == SYSTEM_ROLE_ID
or $role == ANONYMOUS_ROLE_ID) {
343 $this->tpl->setCurrentBlock(
"roles");
351 $this->tpl->parseCurrentBlock();
359 $ilAccess = $DIC[
'ilAccess'];
361 $rbacreview = $DIC[
'rbacreview'];
363 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
364 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
367 if (count(
$_POST[
'roles']) < 1) {
373 foreach ($rbacreview->getGlobalRoles() as $role) {
375 $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
380 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
390 $ilAccess = $DIC[
'ilAccess'];
392 $rbacreview = $DIC[
'rbacreview'];
394 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_email_role_assignments.html',
'Services/Registration');
401 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
402 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN", $this->lng->txt(
'reg_email_role_assignment'));
403 $this->tpl->setVariable(
"TXT_MAIL", $this->lng->txt(
'reg_email'));
404 $this->tpl->setVariable(
"TXT_ROLE", $this->lng->txt(
'obj_role'));
405 $this->tpl->setVariable(
"TXT_DEFAULT", $this->lng->txt(
'reg_default'));
407 $this->tpl->setVariable(
"TXT_DOMAIN", $this->lng->txt(
'reg_domain'));
410 $this->tpl->setVariable(
"BTN_DELETE", $this->lng->txt(
'delete'));
411 $this->tpl->setVariable(
"BTN_SAVE", $this->lng->txt(
'save'));
412 $this->tpl->setVariable(
"BTN_ADD", $this->lng->txt(
'reg_add_assignment'));
413 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
'cancel'));
416 foreach ($this->assignments_obj->getAssignments() as $assignment) {
417 $this->tpl->setCurrentBlock(
"roles");
419 $this->tpl->setVariable(
"ASSIGN_ID", $assignment[
'id']);
420 $this->tpl->setVariable(
"DOMAIN", $assignment[
'domain']);
421 $this->tpl->setVariable(
"CHECK_ROLE",
ilUtil::formCheckbox(0,
'del_assign[]', $assignment[
'id']));
423 $this->tpl->parseCurrentBlock();
426 $this->tpl->setVariable(
"DEF_CSSROW",
ilUtil::switchColor(++$counter,
'tblrow1',
'tblrow1'));
427 $this->tpl->setVariable(
"TXT_DEFAULT", $this->lng->txt(
'default'));
436 $ilAccess = $DIC[
'ilAccess'];
438 $rbacreview = $DIC[
'rbacreview'];
440 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
441 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
446 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
448 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
449 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",
$lng->txt(
'reg_role_access_limitations'));
450 $this->tpl->setVariable(
"TXT_ROLE",
$lng->txt(
'obj_role'));
451 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",
$lng->txt(
'reg_access_limitation_mode'));
453 $this->tpl->setVariable(
"BTN_SAVE",
$lng->txt(
'save'));
454 $this->tpl->setVariable(
"BTN_CANCEL",
$lng->txt(
'cancel'));
457 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
460 $this->tpl->setCurrentBlock(
"roles");
462 $this->tpl->setVariable(
"ROLE_ID", $role[
'id']);
463 $this->tpl->setVariable(
"ROLE_TITLE", $role[
'title']);
465 $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE", ($this->access_limitations_obj->getMode($role[
'id']) ==
'absolute') ?
'inline' :
'none');
466 $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE", ($this->access_limitations_obj->getMode($role[
'id']) ==
'relative') ?
'inline' :
'none');
467 $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED", ($this->access_limitations_obj->getMode($role[
'id']) ==
'unlimited') ?
'inline' :
'none');
468 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED",
$lng->txt(
'reg_access_limitation_none'));
470 $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
471 $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_' . $role[
'id'], $date[
'y'], $date[
'm'], $date[
'd'],
'2007'));
473 $this->tpl->setVariable(
"TXT_DAYS",
$lng->txt(
'days'));
474 $this->tpl->setVariable(
"TXT_MONTHS",
$lng->txt(
'months'));
475 $this->tpl->setVariable(
"TXT_YEARS",
$lng->txt(
'years'));
477 $this->tpl->setVariable(
"DAYS", $this->access_limitations_obj->getRelative($role[
'id'],
'd'));
478 $this->tpl->setVariable(
"MONTHS", $this->access_limitations_obj->getRelative($role[
'id'],
'm'));
479 $this->tpl->setVariable(
"YEARS", $this->access_limitations_obj->getRelative($role[
'id'],
'y'));
480 $this->tpl->parseCurrentBlock();
488 $ilAccess = $DIC[
'ilAccess'];
490 $rbacreview = $DIC[
'rbacreview'];
492 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
493 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
497 $this->assignments_obj->add();
499 ilUtil::sendSuccess($this->lng->txt(
'reg_added_assignment'));
509 $ilAccess = $DIC[
'ilAccess'];
511 $rbacreview = $DIC[
'rbacreview'];
513 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
514 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
517 if (!count(
$_POST[
'del_assign'])) {
525 foreach (
$_POST[
'del_assign'] as $assignment_id) {
526 $this->assignments_obj->delete($assignment_id);
529 ilUtil::sendSuccess($this->lng->txt(
'reg_deleted_assignment'));
539 $ilAccess = $DIC[
'ilAccess'];
541 $rbacreview = $DIC[
'rbacreview'];
543 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
544 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
549 if (!is_array(
$_POST[
'domain'])) {
550 $_POST[
'domain'] = array();
557 $this->assignments_obj->setDefaultRole((
int)
$_POST[
'default_role']);
559 if ($err = $this->assignments_obj->validate()) {
574 $this->assignments_obj->save();
575 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
584 $ilAccess = $DIC[
'ilAccess'];
586 $rbacreview = $DIC[
'rbacreview'];
588 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
589 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
594 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
596 $this->access_limitations_obj->resetAccessLimitations();
598 $this->access_limitations_obj->setMode(
$_POST[
'access_limitation_mode_' . $role[
'id']], $role[
'id']);
599 $this->access_limitations_obj->setAbsolute(
$_POST[
'access_limitation_absolute_' . $role[
'id']], $role[
'id']);
600 $this->access_limitations_obj->setRelative(
$_POST[
'access_limitation_relative_' . $role[
'id']], $role[
'id']);
603 if ($err = $this->access_limitations_obj->validate()) {
618 $this->access_limitations_obj->save();
619 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
626 $tpl =
new ilTemplate(
'tpl.registration_roles.html',
true,
true,
'Services/Registration');
628 $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
629 $tpl->setVariable(
"LINK_EDIT",
$url);
631 if (is_array($roles) &&
sizeof($roles)) {
632 foreach ($roles as $role) {
633 $tpl->setCurrentBlock(
"list_item");
634 $tpl->setVariable(
"LIST_ITEM_ITEM", $role);
635 $tpl->parseCurrentBlock();
638 $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
646 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
650 $all[] = $role[
'title'];
657 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
661 foreach ($this->assignments_obj->getAssignments() as $assignment) {
662 if (strlen($assignment[
'domain'])
and $assignment[
'role']) {
667 if (strlen($this->assignments_obj->getDefaultRole())) {
668 $all[] = $this->lng->txt(
'reg_default') .
' -> ' .
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
682 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
686 switch ($this->access_limitations_obj->getMode($role[
'id'])) {
688 $txt_access_value =
$lng->txt(
'reg_access_limitation_limited_until');
693 $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
694 $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
695 $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
697 $txt_access_value =
$lng->txt(
'reg_access_limitation_limited_time') .
" ";
700 $txt_access_value .= $years .
" ";
701 $txt_access_value .= ($years == 1) ?
$lng->txt(
'year') :
$lng->txt(
'years');
705 $txt_access_value .=
", ";
707 $txt_access_value .=
" " .
$lng->txt(
'and') .
" ";
710 $txt_access_value .=
" " .
$lng->txt(
'and') .
" ";
715 $txt_access_value .= $months .
" ";
716 $txt_access_value .= ($months == 1) ?
$lng->txt(
'month') :
$lng->txt(
'months');
719 $txt_access_value .=
" " .
$lng->txt(
'and') .
" ";
724 $txt_access_value .= $days .
" ";
725 $txt_access_value .= ($days == 1) ?
$lng->txt(
'day') :
$lng->txt(
'days');
730 $txt_access_value =
$lng->txt(
'reg_access_limitation_none');
734 $all[] = $role[
'title'] .
' (' . $txt_access_value .
')';
742 if (is_object($this->assignments_obj)) {
746 include_once
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
753 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 $rbacreview = $DIC[
'rbacreview'];
770 $assignments = $this->assignments_obj->getAssignments();
771 $selected = ($assignment_id > 0) ?
772 $assignments[$assignment_id][
'role'] :
773 $this->assignments_obj->getDefaultRole();
776 $roles[0] = $this->lng->txt(
'please_choose');
779 foreach ($rbacreview->getGlobalRoles() as $role_id) {
780 if ($role_id == ANONYMOUS_ROLE_ID) {
786 if ($assignment_id > 0) {
789 "role[$assignment_id][role]",
812 'null' =>
$lng->txt(
'please_choose'),
813 'unlimited' =>
$lng->txt(
'reg_access_limitation_mode_unlimited'),
814 'absolute' =>
$lng->txt(
'reg_access_limitation_mode_absolute'),
815 'relative' =>
$lng->txt(
'reg_access_limitation_mode_relative')
818 $attribs = array(
'onchange' =>
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_' . $a_role_id .
',' . $a_role_id .
')');
820 $selected = $this->access_limitations_obj->getMode($a_role_id);
828 $a_unix_time = time();
831 return array(
'y' => date(
'Y', $a_unix_time),
832 'm' => date(
'n', $a_unix_time),
833 'd' => date(
'd', $a_unix_time));
840 $ilAccess = $DIC[
'ilAccess'];
843 $ilToolbar = $DIC[
'ilToolbar'];
845 if (!$ilAccess->checkAccess(
'read',
'', $this->ref_id)) {
846 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
851 $ilToolbar->addButton(
852 $this->lng->txt(
"registration_codes_add"),
853 $this->ctrl->getLinkTarget($this,
"addCodes")
856 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
858 $this->tpl->setContent($ctab->getHTML());
865 $rbacreview = $DIC[
'rbacreview'];
866 $ilObjDataCache = $DIC[
'ilObjDataCache'];
869 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
872 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'createCodes'));
873 $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
875 $count =
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'),
'reg_codes_number');
877 $count->setMaxLength(4);
878 $count->setMinValue(1);
879 $count->setMaxValue(1000);
880 $count->setRequired(
true);
881 $this->form_gui->addItem($count);
887 $code_type->addOption(
889 $this->lng->txt(
'registration_codes_type_reg'),
890 self::CODE_TYPE_REGISTRATION,
891 $this->lng->txt(
'registration_codes_type_reg_info')
894 $code_type->addOption(
896 $this->lng->txt(
'registration_codes_type_ext'),
897 self::CODE_TYPE_EXTENSION,
898 $this->lng->txt(
'registration_codes_type_ext_info')
901 $this->form_gui->addItem($code_type);
905 $sec->setTitle($this->lng->txt(
'registration_codes_roles_title'));
906 $this->form_gui->addItem($sec);
908 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
909 $options = array(
"" => $this->lng->txt(
'registration_codes_no_assigned_role'));
910 foreach ($rbacreview->getGlobalRoles() as $role_id) {
911 if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) {
912 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
915 $roles =
new ilSelectInputGUI($this->lng->txt(
"registration_codes_roles"),
"reg_codes_role");
916 $roles->
setInfo($this->lng->txt(
"registration_codes_override_info"));
918 $this->form_gui->addItem($roles);
920 $local =
new ilTextInputGUI($this->lng->txt(
"registration_codes_roles_local"),
"reg_codes_local");
922 $local->setDataSource($this->ctrl->getLinkTarget($this,
"getLocalRoleAutoComplete",
"",
true));
923 $this->form_gui->addItem($local);
927 $sec->setTitle($this->lng->txt(
'reg_access_limitations'));
928 $this->form_gui->addItem($sec);
931 $limit->
setInfo($this->lng->txt(
"registration_codes_override_info"));
932 $this->form_gui->addItem($limit);
934 $opt =
new ilRadioOption($this->lng->txt(
"registration_codes_roles_limitation_none"),
"none");
935 $limit->addOption($opt);
937 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_none"),
"unlimited");
938 $limit->addOption($opt);
940 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_absolute"),
"absolute");
941 $limit->addOption($opt);
943 $dt =
new ilDateTimeInputGUI($this->lng->txt(
"reg_access_limitation_mode_absolute_target"),
"abs_date");
945 $opt->addSubItem($dt);
947 $opt =
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_relative"),
"relative");
948 $limit->addOption($opt);
950 $dur =
new ilDurationInputGUI($this->lng->txt(
"reg_access_limitation_mode_relative_target"),
"rel_date");
952 $dur->setShowMonths(
true);
953 $dur->setShowDays(
true);
954 $dur->setShowHours(
false);
955 $dur->setShowMinutes(
false);
956 $opt->addSubItem($dur);
958 $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
959 $this->form_gui->addCommandButton(
'listCodes', $this->lng->txt(
'cancel'));
965 $q = $_REQUEST[
"term"];
966 include_once(
"./Services/AccessControl/classes/class.ilRoleAutoComplete.php");
976 $ilAccess = $DIC[
'ilAccess'];
979 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
980 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
988 $limit = $this->form_gui->getItemByPostVar(
"reg_limit");
989 $limit->setValue(
"none");
991 $this->tpl->setContent($this->form_gui->getHTML());
998 $ilAccess = $DIC[
'ilAccess'];
1000 $rbacreview = $DIC[
'rbacreview'];
1002 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
1003 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),
$ilErr->MESSAGE);
1009 $valid = $this->form_gui->checkInput();
1011 $number = $this->form_gui->getInput(
'reg_codes_number');
1012 $role = $this->form_gui->getInput(
'reg_codes_role');
1013 $local = $this->form_gui->getInput(
"reg_codes_local");
1015 if (is_array($local)) {
1016 $role_ids = array();
1017 foreach (array_unique($local) as $item) {
1019 $role_id = $rbacreview->roleExists($item);
1021 $role_ids[] = $role_id;
1025 if (
sizeof($role_ids)) {
1031 $limit = $this->form_gui->getInput(
"reg_limit");
1034 $date_input = $this->form_gui->getItemByPostVar(
"abs_date");
1036 if ($date < date(
"Y-m-d")) {
1037 $date_input->setAlert($this->lng->txt(
"form_msg_wrong_date"));
1043 $date = $this->form_gui->getInput(
"rel_date");
1044 if (!array_sum($date)) {
1049 "m" => $date[
"MM"] % 12,
1050 "y" => floor($date[
"MM"] / 12)
1062 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1065 for ($loop = 1; $loop <= $number; $loop++) {
1066 $code_types = (array) $this->form_gui->getInput(
'code_type');
1074 in_array(self::CODE_TYPE_REGISTRATION, $code_types) ?
true :
false,
1075 in_array(self::CODE_TYPE_EXTENSION, $code_types) ?
true :
false 1079 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
1080 $this->ctrl->redirect($this,
"listCodes");
1082 $this->form_gui->setValuesByPost();
1083 $this->tpl->setContent($this->form_gui->getHtml());
1089 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1092 ilUtil::sendSuccess($this->lng->txt(
'info_deleted'),
true);
1093 $this->ctrl->redirect($this,
"listCodes");
1101 $ilias = $DIC[
'ilias'];
1103 if (!isset(
$_POST[
"id"])) {
1104 $ilErr->raiseError($this->lng->txt(
"no_checkbox"),
$ilErr->MESSAGE);
1109 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
1111 $gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
1112 $gui->setCancel($this->lng->txt(
"cancel"),
"listCodes");
1113 $gui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
1114 $gui->setFormAction($this->ctrl->getFormAction($this,
"deleteCodes"));
1116 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1119 $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
1122 $this->tpl->setContent($gui->getHTML());
1127 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1129 $utab->resetOffset();
1130 $utab->resetFilter();
1137 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1139 $utab->resetOffset();
1140 $utab->writeFilterToSession();
1149 $ilAccess = $DIC[
'ilAccess'];
1152 if (!$ilAccess->checkAccess(
'read',
'', $this->ref_id)) {
1153 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
1156 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1159 include_once
'./Services/Registration/classes/class.ilRegistrationCode.php';
1162 if (
sizeof($codes)) {
1163 ilUtil::deliverData(implode(
"\r\n", $codes),
"ilias_registration_codes_" . date(
"d-m-Y") .
".txt",
"text/plain");
__prepareAutomaticRoleList()
__prepareDateSelect($a_unix_time)
This class represents an option in a radio group.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
__parseRoleList($roles, $url)
editRoleAccessLimitations()
if(isset($_REQUEST['delete'])) $list
This class represents an option in a checkbox group.
const IL_REG_ACCESS_LIMITATION_OUT_OF_DATE
static _lookupRegisterAllowed()
get all roles that are activated in user registration
static deleteCodes(array $ids)
const CODE_TYPE_REGISTRATION
if(!array_key_exists('StateId', $_REQUEST)) $id
static getList($a_str)
Get completion list.
__prepareAccessLimitationRoleList()
static checkFreetype()
Check whether captcha support is active.
static _lookupTitle($a_id)
lookup object title
const REG_HASH_LIFETIME_MIN_VALUE
const IL_REG_MISSING_ROLE
setInfo($a_info)
Set Info.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
setSubTabs($activeTab='registration_settings')
set sub tabs
getLocalRoleAutoComplete()
static create($role, $stamp, $local_roles, $limit, $limit_date, $reg_type, $ext_type)
static loadCodesByIds(array $ids)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const IL_REG_MISSING_DOMAIN
Class class.ilregistrationEmailRoleAssignments.
special template class to simplify handling of ITX/PEAR
setSize($a_size)
Set Size.
This class represents a text property in a property form.
Class ilRegistrationSettingsGUI.
TableGUI class for registration codes.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__buildAccessLimitationSelection($a_role_id)
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
const USER_FOLDER_ID
Class ilObjUserFolder.
saveRoleAccessLimitations()
const CODE_TYPE_EXTENSION
const IL_REG_ACCESS_LIMITATION_MISSING_MODE
Class class.ilRegistrationAccessLimitation.
static getCodesForExport($filter_code, $filter_role, $filter_generated, $filter_access_limitation)
static _lookupAllowRegister($a_role_id)
check whether role is allowed in user registration or not
__initRoleAccessLimitations()
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
Confirmation screen class.
__buildRoleSelection($assignment_id)