Class ilRegistrationSettingsGUI. More...
Public Member Functions | |
ilRegistrationSettingsGUI () | |
executeCommand () | |
view () | |
save () | |
editRoles () | |
updateRoles () | |
editEmailAssignments () | |
addAssignment () | |
deleteAssignment () | |
saveAssignment () | |
__prepareRoleList () | |
__prepareAutomaticRoleList () | |
__initRoleAssignments () | |
__buildRoleSelection ($assignment_id) | |
Data Fields | |
$ctrl | |
$tpl | |
$ref_id |
Class ilRegistrationSettingsGUI.
Definition at line 36 of file class.ilRegistrationSettingsGUI.php.
ilRegistrationSettingsGUI::__buildRoleSelection | ( | $ | assignment_id | ) |
Definition at line 435 of file class.ilRegistrationSettingsGUI.php.
References $rbacreview, $role_id, ilObject::_lookupTitle(), and formSelect().
Referenced by editEmailAssignments().
{ include_once 'classes/class.ilObjRole.php'; global $rbacreview; $assignments = $this->assignments_obj->getAssignments(); $selected = ($assignment_id > 0) ? $assignments[$assignment_id]['role'] : $this->assignments_obj->getDefaultRole(); if(!$selected) { $roles[0] = $this->lng->txt('please_choose'); } foreach($rbacreview->getGlobalRoles() as $role_id) { if($role_id == SYSTEM_ROLE_ID or $role_id == ANONYMOUS_ROLE_ID) { continue; } $roles[$role_id] = ilObjRole::_lookupTitle($role_id); } if($assignment_id > 0) { return ilUtil::formSelect($selected, "role[$assignment_id][role]", $roles,false,true); } else { return ilUtil::formSelect($selected, "default_role", $roles,false,true); } }
ilRegistrationSettingsGUI::__initRoleAssignments | ( | ) |
Definition at line 423 of file class.ilRegistrationSettingsGUI.php.
Referenced by __prepareAutomaticRoleList(), addAssignment(), deleteAssignment(), editEmailAssignments(), and saveAssignment().
{ if(is_object($this->assignments_obj)) { return true; } include_once 'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php'; $this->assignments_obj = new ilRegistrationRoleAssignments(); }
ilRegistrationSettingsGUI::__prepareAutomaticRoleList | ( | ) |
Definition at line 394 of file class.ilRegistrationSettingsGUI.php.
References __initRoleAssignments(), and ilObject::_lookupTitle().
Referenced by view().
{ include_once './classes/class.ilObjRole.php'; $this->__initRoleAssignments(); foreach($this->assignments_obj->getAssignments() as $assignment) { if(strlen($assignment['domain']) and $assignment['role']) { $this->tpl->setCurrentBlock("auto_item"); $this->tpl->setVariable("AUTO_ITEM_TITLE",$assignment['domain']); $this->tpl->setVariable("AUTO_ROLE",ilObjRole::_lookupTitle($assignment['role'])); $this->tpl->parseCurrentBlock(); } } if(strlen($this->assignments_obj->getDefaultRole())) { $this->tpl->setCurrentBlock("auto_item"); $this->tpl->setVariable("AUTO_ITEM_TITLE",$this->lng->txt('reg_default')); $this->tpl->setVariable("AUTO_ROLE",ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole())); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("auto"); $this->tpl->parseCurrentBlock(); }
ilRegistrationSettingsGUI::__prepareRoleList | ( | ) |
Definition at line 382 of file class.ilRegistrationSettingsGUI.php.
References ilObjRole::_lookupRegisterAllowed().
Referenced by view().
{ include_once './classes/class.ilObjRole.php'; foreach(ilObjRole::_lookupRegisterAllowed() as $role) { $this->tpl->setCurrentBlock("fixed_item"); $this->tpl->setVariable("FIXED_ITEM_TITLE",$role['title']); $this->tpl->parseCurrentBlock(); } }
ilRegistrationSettingsGUI::addAssignment | ( | ) |
Definition at line 288 of file class.ilRegistrationSettingsGUI.php.
References $ilErr, $rbacreview, __initRoleAssignments(), editEmailAssignments(), and sendInfo().
{ global $ilAccess,$ilErr,$rbacreview; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } $this->__initRoleAssignments(); $this->assignments_obj->add(); sendInfo($this->lng->txt('reg_added_assignment')); $this->editEmailAssignments(); return true; }
ilRegistrationSettingsGUI::deleteAssignment | ( | ) |
Definition at line 306 of file class.ilRegistrationSettingsGUI.php.
References $_POST, $ilErr, $rbacreview, __initRoleAssignments(), editEmailAssignments(), and sendInfo().
{ global $ilAccess,$ilErr,$rbacreview; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } if(!count($_POST['del_assign'])) { sendInfo($this->lng->txt('reg_select_one')); $this->editEmailAssignments(); return false; } $this->__initRoleAssignments(); foreach($_POST['del_assign'] as $assignment_id) { $this->assignments_obj->delete($assignment_id); } sendInfo($this->lng->txt('reg_deleted_assignment')); $this->editEmailAssignments(); return true; }
ilRegistrationSettingsGUI::editEmailAssignments | ( | ) |
Definition at line 243 of file class.ilRegistrationSettingsGUI.php.
References $counter, $ilErr, $rbacreview, __buildRoleSelection(), __initRoleAssignments(), ilUtil::formCheckbox(), ilUtil::getImagePath(), and ilUtil::switchColor().
Referenced by addAssignment(), deleteAssignment(), and saveAssignment().
{ global $ilAccess,$ilErr,$rbacreview; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } $this->__initRoleAssignments(); $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.reg_email_role_assignments.html','Services/Registration'); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt('reg_email_role_assignment')); $this->tpl->setVariable("TXT_MAIL",$this->lng->txt('reg_email')); $this->tpl->setVariable("TXT_ROLE",$this->lng->txt('obj_role')); $this->tpl->setVariable("TXT_DEFAULT",$this->lng->txt('reg_default')); $this->tpl->setVariable("ARR_DOWNRIGHT",ilUtil::getImagePath('arrow_downright.gif')); $this->tpl->setVariable("TXT_DOMAIN",$this->lng->txt('reg_domain')); $this->tpl->setVariable("BTN_DELETE",$this->lng->txt('delete')); $this->tpl->setVariable("BTN_SAVE",$this->lng->txt('save')); $this->tpl->setVariable("BTN_ADD",$this->lng->txt('reg_add_assignment')); $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel')); $counter = 0; foreach($this->assignments_obj->getAssignments() as $assignment) { $this->tpl->setCurrentBlock("roles"); $this->tpl->setVariable("CSSROW",ilUtil::switchColor(++$counter,'tblrow1','tblrow1')); $this->tpl->setVariable("ASSIGN_ID",$assignment['id']); $this->tpl->setVariable("DOMAIN",$assignment['domain']); $this->tpl->setVariable("CHECK_ROLE",ilUtil::formCheckbox(0,'del_assign[]',$assignment['id'])); $this->tpl->setVariable("ROLE_SEL",$this->__buildRoleSelection($assignment['id'])); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("DEF_CSSROW",ilUtil::switchColor(++$counter,'tblrow1','tblrow1')); $this->tpl->setVariable("TXT_DEFAULT",$this->lng->txt('default')); $this->tpl->setVariable("DEF_ROLE",$this->__buildRoleSelection(-1)); }
ilRegistrationSettingsGUI::editRoles | ( | ) |
Definition at line 173 of file class.ilRegistrationSettingsGUI.php.
References $counter, $ilErr, $rbacreview, ilObjRole::_lookupAllowRegister(), ilObject::_lookupTitle(), ilUtil::formCheckbox(), ilUtil::getImagePath(), and ilUtil::switchColor().
Referenced by updateRoles().
{ include_once './classes/class.ilObjRole.php'; global $ilAccess,$ilErr,$rbacreview; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.edit_roles.html','Services/Registration'); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_SELECTABLE_ROLES",$this->lng->txt('reg_selectable_roles')); $this->tpl->setVariable("ARR_DOWNRIGHT",ilUtil::getImagePath('arrow_downright.gif')); $this->tpl->setVariable("ACTIONS",$this->lng->txt('actions')); $this->tpl->setVariable("UPDATE",$this->lng->txt('save')); $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel')); $counter = 0; foreach($rbacreview->getGlobalRoles() as $role) { if($role == SYSTEM_ROLE_ID or $role == ANONYMOUS_ROLE_ID) { continue; } $this->tpl->setCurrentBlock("roles"); $this->tpl->setVariable("CSSROW",ilUtil::switchColor(++$counter,'tblrow1','tblrow2')); $this->tpl->setVariable("CHECK_ROLE",ilUtil::formCheckbox(ilObjRole::_lookupAllowRegister($role), "roles[$role]", 1)); $this->tpl->setVariable("ROLE",ilObjRole::_lookupTitle($role)); $this->tpl->parseCurrentBlock(); } }
ilRegistrationSettingsGUI::executeCommand | ( | ) |
ilRegistrationSettingsGUI::ilRegistrationSettingsGUI | ( | ) |
Definition at line 42 of file class.ilRegistrationSettingsGUI.php.
References $_GET, $ilCtrl, $lng, and $tpl.
{ global $ilCtrl,$tpl,$lng; $this->tpl =& $tpl; $this->ctrl =& $ilCtrl; $this->lng =& $lng; $this->lng->loadLanguageModule('administration'); $this->lng->loadLanguageModule('registration'); $this->ref_id = (int) $_GET['ref_id']; $this->registration_settings = new ilRegistrationSettings(); }
ilRegistrationSettingsGUI::save | ( | ) |
Definition at line 145 of file class.ilRegistrationSettingsGUI.php.
References $_POST, $ilErr, sendInfo(), ilUtil::stripSlashes(), and view().
{ global $ilAccess,$ilErr; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } $this->registration_settings->setRegistrationType((int) $_POST['reg_type']); $this->registration_settings->setPasswordGenerationStatus((int) $_POST['reg_pwd']); $this->registration_settings->setApproveRecipientLogins(ilUtil::stripSlashes($_POST['reg_approver'])); $this->registration_settings->setRoleType((int) $_POST['reg_role_type']); if($error_code = $this->registration_settings->validate()) { sendInfo($this->lng->txt('reg_unknown_recipients').' '.$this->registration_settings->getUnknown()); $this->view(); return false; } $this->registration_settings->save(); sendInfo($this->lng->txt('saved_successfully')); $this->view(); return true; }
ilRegistrationSettingsGUI::saveAssignment | ( | ) |
Definition at line 335 of file class.ilRegistrationSettingsGUI.php.
References $_POST, $data, $id, $ilErr, $rbacreview, __initRoleAssignments(), editEmailAssignments(), sendInfo(), ilUtil::stripSlashes(), and view().
{ global $ilAccess,$ilErr,$rbacreview; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } $this->__initRoleAssignments(); if (!is_array($_POST['domain'])) { $_POST['domain'] = array(); } foreach($_POST['domain'] as $id => $data) { $this->assignments_obj->setDomain($id,ilUtil::stripSlashes($_POST['domain'][$id]['domain'])); $this->assignments_obj->setRole($id,ilUtil::stripSlashes($_POST['role'][$id]['role'])); } $this->assignments_obj->setDefaultRole((int) $_POST['default_role']); if($err = $this->assignments_obj->validate()) { switch($err) { case IL_REG_MISSING_DOMAIN: sendInfo($this->lng->txt('reg_missing_domain')); break; case IL_REG_MISSING_ROLE: sendInfo($this->lng->txt('reg_missing_role')); break; } $this->editEmailAssignments(); return false; } $this->assignments_obj->save(); sendInfo($this->lng->txt('settings_saved')); $this->view(); return true; }
ilRegistrationSettingsGUI::updateRoles | ( | ) |
Definition at line 212 of file class.ilRegistrationSettingsGUI.php.
References $_POST, $ilErr, $rbacreview, editRoles(), ilObjectFactory::getInstanceByObjId(), sendInfo(), and view().
{ global $ilAccess,$ilErr,$rbacreview; if(!$ilAccess->checkAccess('write','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE); } // Minimum one role if(count($_POST['roles']) < 1) { sendInfo($this->lng->txt('msg_last_role_for_registration')); $this->editRoles(); return false; } // update allow register foreach($rbacreview->getGlobalRoles() as $role) { if($role_obj = ilObjectFactory::getInstanceByObjId($role,false)) { $role_obj->setAllowRegister($_POST['roles'][$role] ? 1 : 0); $role_obj->update(); } } sendInfo($this->lng->txt('saved_successfully')); $this->view(); return true; }
ilRegistrationSettingsGUI::view | ( | ) |
Definition at line 75 of file class.ilRegistrationSettingsGUI.php.
References $ilErr, __prepareAutomaticRoleList(), __prepareRoleList(), ilUtil::formCheckbox(), ilUtil::formRadioButton(), and ilUtil::prepareFormOutput().
Referenced by save(), saveAssignment(), and updateRoles().
{ global $ilAccess,$ilErr; if(!$ilAccess->checkAccess('read','',$this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE); } $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.registration_settings.html','Services/Registration'); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_REGISTRATION_SETTINGS",$this->lng->txt('reg_settings_header')); $this->tpl->setVariable("TXT_REG_TYPE",$this->lng->txt('reg_type')); $this->tpl->setVariable("TXT_REG_DEACTIVATED",$this->lng->txt('reg_disabled')); $this->tpl->setVariable("REG_DEACTIVATED_DESC",$this->lng->txt('reg_disabled_info')); $this->tpl->setVariable("TXT_DIRECT",$this->lng->txt('reg_direct')); $this->tpl->setVariable("REG_DIRECT_DESC",$this->lng->txt('reg_direct_info')); $this->tpl->setVariable("TXT_APPROVE",$this->lng->txt('reg_approve')); $this->tpl->setVariable("REG_APPROVE_DESC",$this->lng->txt('reg_approve_info')); $this->tpl->setVariable("TXT_ROLE_ASSIGNMENT",$this->lng->txt('reg_role_assignment')); $this->tpl->setVariable("TXT_REG_FIXED",$this->lng->txt('reg_fixed')); $this->tpl->setVariable("TXT_AVAILABLE",$this->lng->txt('reg_available_roles')); $this->tpl->setVariable("TXT_APPROVE_REC",$this->lng->txt('approve_recipient')); $this->tpl->setVariable("TXT_REG_NOTIFICATION",$this->lng->txt('reg_notification')); $this->tpl->setVariable("REG_NOTIFICATION_DESC",$this->lng->txt('reg_notification_info')); $this->tpl->setVariable("TXT_REG_EMAIL",$this->lng->txt('reg_email')); $this->tpl->setVariable("EDIT",$this->lng->txt('edit')); $this->tpl->setVariable("LINK_EDIT_FIXED",$this->ctrl->getLinkTarget($this,'editRoles')); $this->tpl->setVariable("LINK_EDIT_EMAIL",$this->ctrl->getLinkTarget($this,'editEmailAssignments')); $this->__prepareRoleList(); $this->__prepareAutomaticRoleList(); // pwd forwarding $this->tpl->setVariable("TXT_REG_PWD_FORWARD",$this->lng->txt('passwd_generation')); $this->tpl->setVariable("REG_INFO_PWD",$this->lng->txt('reg_info_pwd')); $this->tpl->setVariable("RADIO_DEACTIVATE",ilUtil::formRadioButton(!$this->registration_settings->enabled(), 'reg_type', IL_REG_DISABLED)); $this->tpl->setVariable("RADIO_DIRECT",ilUtil::formRadioButton($this->registration_settings->directEnabled(), 'reg_type', IL_REG_DIRECT)); $this->tpl->setVariable("RADIO_APPROVE",ilUtil::formRadioButton($this->registration_settings->approveEnabled(), 'reg_type', IL_REG_APPROVE)); $this->tpl->setVariable("APPROVER",ilUtil::prepareFormOutput($this->registration_settings->getApproveRecipientLogins())); $this->tpl->setVariable("CHECK_PWD",ilUtil::formCheckbox($this->registration_settings->passwordGenerationEnabled(), 'reg_pwd', 1)); $this->tpl->setVariable("RADIO_FIXED",ilUtil::formRadioButton($this->registration_settings->roleSelectionEnabled(), 'reg_role_type', IL_REG_ROLES_FIXED)); $this->tpl->setVariable("RADIO_EMAIL",ilUtil::formRadioButton($this->registration_settings->automaticRoleAssignmentEnabled(), 'reg_role_type', IL_REG_ROLES_EMAIL)); $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save')); }
ilRegistrationSettingsGUI::$ctrl |
Definition at line 38 of file class.ilRegistrationSettingsGUI.php.
ilRegistrationSettingsGUI::$ref_id |
Definition at line 40 of file class.ilRegistrationSettingsGUI.php.
ilRegistrationSettingsGUI::$tpl |
Definition at line 39 of file class.ilRegistrationSettingsGUI.php.
Referenced by ilRegistrationSettingsGUI().