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 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
81 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
84 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.registration_settings.html',
'Services/Registration');
86 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
87 $this->tpl->setVariable(
"TXT_REGISTRATION_SETTINGS",$this->lng->txt(
'reg_settings_header'));
88 $this->tpl->setVariable(
"TXT_REG_TYPE",$this->lng->txt(
'reg_type'));
89 $this->tpl->setVariable(
"TXT_REG_DEACTIVATED",$this->lng->txt(
'reg_disabled'));
90 $this->tpl->setVariable(
"REG_DEACTIVATED_DESC",$this->lng->txt(
'reg_disabled_info'));
91 $this->tpl->setVariable(
"TXT_DIRECT",$this->lng->txt(
'reg_direct'));
92 $this->tpl->setVariable(
"REG_DIRECT_DESC",$this->lng->txt(
'reg_direct_info'));
93 $this->tpl->setVariable(
"TXT_APPROVE",$this->lng->txt(
'reg_approve'));
94 $this->tpl->setVariable(
"REG_APPROVE_DESC",$this->lng->txt(
'reg_approve_info'));
95 $this->tpl->setVariable(
"TXT_ROLE_ASSIGNMENT",$this->lng->txt(
'reg_role_assignment'));
96 $this->tpl->setVariable(
"TXT_REG_FIXED",$this->lng->txt(
'reg_fixed'));
97 $this->tpl->setVariable(
"TXT_AVAILABLE",$this->lng->txt(
'reg_available_roles'));
98 $this->tpl->setVariable(
"TXT_APPROVE_REC",$this->lng->txt(
'approve_recipient'));
99 $this->tpl->setVariable(
"TXT_REG_NOTIFICATION",$this->lng->txt(
'reg_notification'));
100 $this->tpl->setVariable(
"REG_NOTIFICATION_DESC",$this->lng->txt(
'reg_notification_info'));
101 $this->tpl->setVariable(
"TXT_REG_EMAIL",$this->lng->txt(
'reg_email'));
103 $this->tpl->setVariable(
"TXT_REG_ACCESS_LIMITATIONS",$this->lng->txt(
'reg_access_limitations'));
104 $this->tpl->setVariable(
"TXT_ENABLE_ACCESS_LIMITATIONS",$this->lng->txt(
'reg_enable_access_limitations'));
106 $this->tpl->setVariable(
"EDIT",$this->lng->txt(
'edit'));
107 $this->tpl->setVariable(
"LINK_EDIT_FIXED",$this->ctrl->getLinkTarget($this,
'editRoles'));
108 $this->tpl->setVariable(
"LINK_EDIT_EMAIL",$this->ctrl->getLinkTarget($this,
'editEmailAssignments'));
109 $this->tpl->setVariable(
"LINK_EDIT_ACCESS_LIMITATIONS",$this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations'));
116 $this->tpl->setVariable(
"TXT_REG_PWD_FORWARD",$this->lng->txt(
'passwd_generation'));
117 $this->tpl->setVariable(
"REG_INFO_PWD",$this->lng->txt(
'reg_info_pwd'));
127 $this->tpl->setVariable(
"RADIO_APPROVE",
ilUtil::formRadioButton($this->registration_settings->approveEnabled(),
131 $this->tpl->setVariable(
"APPROVER",
ilUtil::prepareFormOutput($this->registration_settings->getApproveRecipientLogins()));
134 $this->tpl->setVariable(
"CHECK_PWD",
ilUtil::formCheckbox($this->registration_settings->passwordGenerationEnabled(),
138 $this->tpl->setVariable(
"RADIO_FIXED",
ilUtil::formRadioButton($this->registration_settings->roleSelectionEnabled(),
142 $this->tpl->setVariable(
"RADIO_EMAIL",
ilUtil::formRadioButton($this->registration_settings->automaticRoleAssignmentEnabled(),
146 if ($this->registration_settings->getAccessLimitation())
148 $this->tpl->setVariable(
"REG_ACCESS_LIMITATION_CHECK",
"checked=\"checked\"");
149 $this->tpl->setVariable(
"CSS_DISPLAY_ACCESS_LIMITATION",
"block");
153 $this->tpl->setVariable(
"CSS_DISPLAY_ACCESS_LIMITATION",
"none");
156 $this->tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save'));
163 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
165 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
168 $this->registration_settings->setRegistrationType((
int) $_POST[
'reg_type']);
169 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
170 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
171 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
172 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
174 if($error_code = $this->registration_settings->validate())
176 ilUtil::sendInfo($this->lng->txt(
'reg_unknown_recipients').
' '.$this->registration_settings->getUnknown());
181 $this->registration_settings->save();
190 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
192 global $ilAccess,
$ilErr,$rbacreview;
194 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
196 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
199 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
201 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
202 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES",$this->lng->txt(
'reg_selectable_roles'));
204 $this->tpl->setVariable(
"ACTIONS",$this->lng->txt(
'actions'));
205 $this->tpl->setVariable(
"UPDATE",$this->lng->txt(
'save'));
206 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
209 foreach($rbacreview->getGlobalRoles() as $role)
211 if($role == SYSTEM_ROLE_ID or
212 $role == ANONYMOUS_ROLE_ID)
216 $this->tpl->setCurrentBlock(
"roles");
222 $this->tpl->parseCurrentBlock();
229 global $ilAccess,
$ilErr,$rbacreview;
231 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
233 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
236 if(count($_POST[
'roles']) < 1)
243 foreach($rbacreview->getGlobalRoles() as $role)
247 $role_obj->setAllowRegister($_POST[
'roles'][$role] ? 1 : 0);
260 global $ilAccess,
$ilErr,$rbacreview;
262 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
264 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
269 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_email_role_assignments.html',
'Services/Registration');
270 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
271 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt(
'reg_email_role_assignment'));
272 $this->tpl->setVariable(
"TXT_MAIL",$this->lng->txt(
'reg_email'));
273 $this->tpl->setVariable(
"TXT_ROLE",$this->lng->txt(
'obj_role'));
274 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'reg_default'));
276 $this->tpl->setVariable(
"TXT_DOMAIN",$this->lng->txt(
'reg_domain'));
279 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
280 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
281 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
'reg_add_assignment'));
282 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
285 foreach($this->assignments_obj->getAssignments() as $assignment)
287 $this->tpl->setCurrentBlock(
"roles");
289 $this->tpl->setVariable(
"ASSIGN_ID",$assignment[
'id']);
290 $this->tpl->setVariable(
"DOMAIN",$assignment[
'domain']);
293 $this->tpl->parseCurrentBlock();
297 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'default'));
305 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
307 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
312 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
314 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
315 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",$lng->txt(
'reg_role_access_limitations'));
316 $this->tpl->setVariable(
"TXT_ROLE",$lng->txt(
'obj_role'));
317 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",$lng->txt(
'reg_access_limitation_mode'));
319 $this->tpl->setVariable(
"BTN_SAVE",$lng->txt(
'save'));
320 $this->tpl->setVariable(
"BTN_CANCEL",$lng->txt(
'cancel'));
323 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
327 $this->tpl->setCurrentBlock(
"roles");
329 $this->tpl->setVariable(
"ROLE_ID",$role[
'id']);
330 $this->tpl->setVariable(
"ROLE_TITLE",$role[
'title']);
332 $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE",($this->access_limitations_obj->getMode($role[
'id']) ==
'absolute') ?
'inline' :
'none');
333 $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE",($this->access_limitations_obj->getMode($role[
'id']) ==
'relative') ?
'inline' :
'none');
334 $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED",($this->access_limitations_obj->getMode($role[
'id']) ==
'unlimited') ?
'inline' :
'none');
335 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt(
'reg_access_limitation_none'));
337 $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
338 $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_'.$role[
'id'],$date[
'y'],$date[
'm'],$date[
'd'],
'2007'));
340 $this->tpl->setVariable(
"TXT_DAYS",$lng->txt(
'days'));
341 $this->tpl->setVariable(
"TXT_MONTHS",$lng->txt(
'months'));
342 $this->tpl->setVariable(
"TXT_YEARS",$lng->txt(
'years'));
344 $this->tpl->setVariable(
"DAYS",$this->access_limitations_obj->getRelative($role[
'id'],
'd'));
345 $this->tpl->setVariable(
"MONTHS",$this->access_limitations_obj->getRelative($role[
'id'],
'm'));
346 $this->tpl->setVariable(
"YEARS",$this->access_limitations_obj->getRelative($role[
'id'],
'y'));
347 $this->tpl->parseCurrentBlock();
353 global $ilAccess,
$ilErr,$rbacreview;
355 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
357 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
361 $this->assignments_obj->add();
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);
378 if(!count($_POST[
'del_assign']))
387 foreach($_POST[
'del_assign'] as $assignment_id)
389 $this->assignments_obj->delete($assignment_id);
400 global $ilAccess,
$ilErr,$rbacreview;
402 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
404 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
409 if (!is_array($_POST[
'domain']))
411 $_POST[
'domain'] = array();
414 foreach($_POST[
'domain'] as $id =>
$data)
419 $this->assignments_obj->setDefaultRole((
int) $_POST[
'default_role']);
421 if($err = $this->assignments_obj->validate())
438 $this->assignments_obj->save();
446 global $ilAccess,
$ilErr,$rbacreview;
448 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
450 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
455 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
459 $this->access_limitations_obj->setMode($_POST[
'access_limitation_mode_'.$role[
'id']],$role[
'id']);
460 $this->access_limitations_obj->setAbsolute($_POST[
'access_limitation_absolute_'.$role[
'id']],$role[
'id']);
461 $this->access_limitations_obj->setRelative($_POST[
'access_limitation_relative_'.$role[
'id']],$role[
'id']);
466 if($err = $this->access_limitations_obj->validate())
483 $this->access_limitations_obj->save();
492 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
496 $this->tpl->setCurrentBlock(
"fixed_item");
497 $this->tpl->setVariable(
"FIXED_ITEM_TITLE",$role[
'title']);
498 $this->tpl->parseCurrentBlock();
504 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
507 foreach($this->assignments_obj->getAssignments() as $assignment)
509 if(strlen($assignment[
'domain']) and $assignment[
'role'])
511 $this->tpl->setCurrentBlock(
"auto_item");
512 $this->tpl->setVariable(
"AUTO_ITEM_TITLE",$assignment[
'domain']);
514 $this->tpl->parseCurrentBlock();
518 if(strlen($this->assignments_obj->getDefaultRole()))
520 $this->tpl->setCurrentBlock(
"auto_item");
521 $this->tpl->setVariable(
"AUTO_ITEM_TITLE",$this->lng->txt(
'reg_default'));
523 $this->tpl->parseCurrentBlock();
526 $this->tpl->setCurrentBlock(
"auto");
527 $this->tpl->parseCurrentBlock();
537 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
541 $this->tpl->setCurrentBlock(
"access_limitation_item");
542 $this->tpl->setVariable(
"ACCESS_LIMITATION_ITEM_TITLE",$role[
'title']);
544 switch ($this->access_limitations_obj->getMode($role[
'id']))
547 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_until');
548 $txt_access_value .=
" ".ilDatePresentation::formatDate(
new ilDateTime($this->access_limitations_obj->getAbsolute($role[
'id'],
IL_CAL_UNIX)));
552 $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
553 $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
554 $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
556 $txt_access_value = $lng->txt(
'reg_access_limitation_limited_time').
" ";
560 $txt_access_value .= $years.
" ";
561 $txt_access_value .= ($years == 1) ? $lng->txt(
'year') : $lng->txt(
'years');
567 $txt_access_value .=
", ";
571 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
576 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
582 $txt_access_value .= $months.
" ";
583 $txt_access_value .= ($months == 1) ? $lng->txt(
'month') : $lng->txt(
'months');
587 $txt_access_value .=
" ".$lng->txt(
'and').
" ";
593 $txt_access_value .= $days.
" ";
594 $txt_access_value .= ($days == 1) ? $lng->txt(
'day') : $lng->txt(
'days');
599 $txt_access_value = $lng->txt(
'reg_access_limitation_none');
603 $this->tpl->setVariable(
"ACCESS_LIMITATION_VALUE",$txt_access_value);
604 $this->tpl->setVariable(
"EDIT_ITEM",$lng->txt(
'edit'));
605 $this->tpl->parseCurrentBlock();
611 if(is_object($this->assignments_obj))
616 include_once
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
623 if(is_object($this->access_limitations_obj))
628 include_once
'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
635 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
639 $assignments = $this->assignments_obj->getAssignments();
640 $selected = ($assignment_id > 0) ?
641 $assignments[$assignment_id][
'role'] :
642 $this->assignments_obj->getDefaultRole();
646 $roles[0] = $this->lng->txt(
'please_choose');
649 foreach($rbacreview->getGlobalRoles() as $role_id)
651 if($role_id == SYSTEM_ROLE_ID or
652 $role_id == ANONYMOUS_ROLE_ID)
659 if($assignment_id > 0)
662 "role[$assignment_id][role]",
678 'null' => $lng->txt(
'please_choose'),
679 'unlimited' => $lng->txt(
'reg_access_limitation_mode_unlimited'),
680 'absolute' => $lng->txt(
'reg_access_limitation_mode_absolute'),
681 'relative' => $lng->txt(
'reg_access_limitation_mode_relative')
684 $attribs = array(
'onchange' =>
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_'.$a_role_id.
','.$a_role_id.
')');
686 $selected = $this->access_limitations_obj->getMode($a_role_id);
688 return ilUtil::formSelect($selected,
'access_limitation_mode_'.$a_role_id,$options,
false,
true,0,
"",$attribs);
696 $a_unix_time = time();
699 return array(
'y' => date(
'Y',$a_unix_time),
700 'm' => date(
'n',$a_unix_time),
701 'd' => date(
'd',$a_unix_time));