本文整理汇总了PHP中ilObjRole::_lookupRegisterAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjRole::_lookupRegisterAllowed方法的具体用法?PHP ilObjRole::_lookupRegisterAllowed怎么用?PHP ilObjRole::_lookupRegisterAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjRole
的用法示例。
在下文中一共展示了ilObjRole::_lookupRegisterAllowed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createRandomUserAccount
public static function _createRandomUserAccount($keyarray)
{
global $ilDB, $ilUser, $ilSetting, $rbacadmin;
if ($_SESSION['create_user_account'] != NULL) {
$obj_user = new ilObjUser($_SESSION['create_user_account']);
return $obj_user;
} else {
$userLogin = array();
$res = $ilDB->query('SELECT sequence FROM object_data_seq');
$row = $ilDB->fetchAssoc($res);
$temp_user_id = (int) $row['sequence'] + 1;
$userLogin['login'] = 'shop_user_' . $temp_user_id;
$userLogin['passwd'] = ilUtil::generatePasswords(1);
require_once 'Services/User/classes/class.ilObjUser.php';
include_once "Services/Mail/classes/class.ilAccountMail.php";
$obj_user = new ilObjUser();
$obj_user->setId($temp_user_id);
$obj_user->setLogin($userLogin['login']);
$obj_user->setPasswd((string) $userLogin['passwd'][0], IL_PASSWD_PLAIN);
$_SESSION['tmp_user_account']['login'] = $userLogin['login'];
$_SESSION['tmp_user_account']['passwd'] = $userLogin['passwd'];
$obj_user->setFirstname($keyarray['first_name']);
$obj_user->setLastname($keyarray['last_name']);
$obj_user->setEmail($keyarray['payer_email']);
# $obj_user->setEmail('nkrzywon@databay.de');
$obj_user->setGender('f');
$obj_user->setLanguage($ilSetting->get("language"));
$obj_user->setActive(true);
$obj_user->setTimeLimitUnlimited(true);
$obj_user->setTitle($obj_user->getFullname());
$obj_user->setDescription($obj_user->getEmail());
$obj_user->setTimeLimitOwner(7);
$obj_user->setTimeLimitUnlimited(1);
$obj_user->setTimeLimitMessage(0);
$obj_user->setApproveDate(date("Y-m-d H:i:s"));
// Set default prefs
$obj_user->setPref('hits_per_page', $ilSetting->get('hits_per_page', 30));
$obj_user->setPref('show_users_online', $ilSetting->get('show_users_online', 'y'));
$obj_user->writePrefs();
// at the first login the user must complete profile
$obj_user->setProfileIncomplete(true);
$obj_user->create();
$obj_user->saveAsNew();
$user_role = ilObject::_exists(4, false);
if (!$user_role) {
include_once "./Services/AccessControl/classes/class.ilObjRole.php";
$reg_allowed = ilObjRole::_lookupRegisterAllowed();
$user_role = $reg_allowed[0]['id'];
} else {
$user_role = 4;
}
$rbacadmin->assignUser((int) $user_role, $obj_user->getId(), true);
include_once "Services/Mail/classes/class.ilMimeMail.php";
global $ilias, $lng;
$settings = $ilias->getAllSettings();
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($settings["admin_email"]);
$mmail->To($obj_user->getEmail());
// mail subject
$subject = $lng->txt("reg_mail_subject");
// mail body
$body = $lng->txt("reg_mail_body_salutation") . " " . $obj_user->getFullname() . ",\n\n" . $lng->txt("reg_mail_body_text1") . "\n\n" . $lng->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . $ilias->client_id . "\n";
$body .= $lng->txt("login") . ": " . $obj_user->getLogin() . "\n";
$body .= $lng->txt("passwd") . ": " . $userLogin['passwd'][0] . "\n";
$body .= "\n";
$body .= $lng->txt("reg_mail_body_text3") . "\n\r";
$body .= $obj_user->getProfileAsString($lng);
$mmail->Subject($subject);
$mmail->Body($body);
$mmail->Send();
$_SESSION['create_user_account'] = $obj_user->getId();
return $obj_user;
}
}
示例2: addStandardFieldsToForm
//.........这里部分代码省略.........
include_once './Modules/ILinc/classes/class.ilnetucateXMLAPI.php';
$ilincAPI = new ilnetucateXMLAPI();
$ilincAPI->uploadPicture($ilinc_user);
$response = $ilincAPI->sendRequest("uploadPicture");
// return URL to user's personal page
$url = trim($response->data['url']['cdata']);
$desc = $lng->txt("ilinc_upload_pic_text") . " " . '<a href="' . $url . '">' . $lng->txt("ilinc_upload_pic_linktext") . '</a>';
$ii->setInfo($desc);
}
}
$a_form->addItem($ii);
}
break;
case "roles":
if (self::$mode == self::MODE_DESKTOP) {
if (ilUserProfile::userSettingVisible("roles")) {
$global_roles = $rbacreview->getGlobalRoles();
foreach ($global_roles as $role_id) {
if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) {
$roleObj = $ilias->obj_factory->getInstanceByObjId($role_id);
$role_names .= $roleObj->getTitle() . ", ";
unset($roleObj);
}
}
$dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr");
$dr->setValue(substr($role_names, 0, -2));
$a_form->addItem($dr);
}
} else {
if (self::$mode == self::MODE_REGISTRATION) {
if ($registration_settings->roleSelectionEnabled()) {
include_once "./Services/AccessControl/classes/class.ilObjRole.php";
$options = array();
foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
$options[$role["id"]] = $role["title"];
}
// registration form validation will take care of missing field / value
if ($options) {
if (sizeof($options) > 1) {
$ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_" . $f);
$ta->setOptions($options);
$ta->setRequired($ilSetting->get("require_" . $f));
if (!$ta->getRequired()) {
$ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
}
} else {
$ta = new ilHiddenInputGUI("usr_" . $f);
$ta->setValue(array_shift(array_keys($options)));
}
$a_form->addItem($ta);
}
}
}
}
break;
case "email":
if (ilUserProfile::userSettingVisible($f)) {
$em = new ilEMailInputGUI($lng->txt($lv), "usr_" . $f);
if ($a_user) {
$em->setValue($a_user->{$m}());
}
$em->setRequired($ilSetting->get("require_" . $f));
if (!$em->getRequired() || $em->getValue()) {
$em->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
}
if (self::MODE_REGISTRATION == self::$mode) {
示例3: authSettingsObject
//.........这里部分代码省略.........
if ($ilSetting->get('auth_mode') == $mode) {
$this->tpl->setVariable("NUM_" . strtoupper($mode_name), (int) $auth_cnt[$mode_name] + $auth_cnt["default"] . " (" . $this->lng->txt("auth_per_default") . ": " . $auth_cnt["default"] . ")");
} else {
$this->tpl->setVariable("NUM_" . strtoupper($mode_name), (int) $auth_cnt[$mode_name]);
}
}
$this->tpl->setVariable("TXT_CONFIGURE", $this->lng->txt("auth_configure"));
$this->tpl->setVariable("TXT_AUTH_REMARK", $this->lng->txt("auth_remark_non_local_auth"));
$this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
$this->tpl->setVariable("CMD_SUBMIT", "setAuthMode");
// local vars
$checked = "checked=\"checked\"";
$disabled = "disabled=\"disabled\"";
$style_disabled = "_disabled";
// icon handlers
$icon_ok = "<img src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("enabled") . "\" title=\"" . $this->lng->txt("enabled") . "\" border=\"0\" vspace=\"0\"/>";
$icon_not_ok = "<img src=\"" . ilUtil::getImagePath("icon_not_ok.svg") . "\" alt=\"" . $this->lng->txt("disabled") . "\" title=\"" . $this->lng->txt("disabled") . "\" border=\"0\" vspace=\"0\"/>";
$this->tpl->setVariable("AUTH_LOCAL_ACTIVE", $icon_ok);
include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
$this->tpl->setVariable('AUTH_LDAP_ACTIVE', count(ilLDAPServer::_getActiveServerList()) ? $icon_ok : $icon_not_ok);
#$this->tpl->setVariable("AUTH_LDAP_ACTIVE", $this->ilias->getSetting('ldap_active') ? $icon_ok : $icon_not_ok);
$this->tpl->setVariable("AUTH_RADIUS_ACTIVE", $this->ilias->getSetting('radius_active') ? $icon_ok : $icon_not_ok);
$this->tpl->setVariable("AUTH_SHIB_ACTIVE", $this->ilias->getSetting('shib_active') ? $icon_ok : $icon_not_ok);
$this->tpl->setVariable("AUTH_SCRIPT_ACTIVE", $this->ilias->getSetting('script_active') ? $icon_ok : $icon_not_ok);
$this->tpl->setVariable("AUTH_CAS_ACTIVE", $this->ilias->getSetting('cas_active') ? $icon_ok : $icon_not_ok);
$this->tpl->setVariable("AUTH_APACHE_ACTIVE", $this->ilias->getSetting('apache_active') ? $icon_ok : $icon_not_ok);
// alter style and disable buttons depending on current selection
switch ($this->ilias->getSetting('auth_mode')) {
case AUTH_LOCAL:
// default
$this->tpl->setVariable("CHK_LOCAL", $checked);
break;
case AUTH_LDAP:
// LDAP
$this->tpl->setVariable("CHK_LDAP", $checked);
break;
case AUTH_SHIBBOLETH:
// SHIB
$this->tpl->setVariable("CHK_SHIB", $checked);
break;
case AUTH_RADIUS:
// RADIUS
$this->tpl->setVariable("CHK_RADIUS", $checked);
break;
case AUTH_CAS:
// CAS
$this->tpl->setVariable("CHK_CAS", $checked);
break;
case AUTH_SCRIPT:
// script
$this->tpl->setVariable("CHK_SCRIPT", $checked);
break;
case AUTH_APACHE:
// apache
$this->tpl->setVariable("CHK_APACHE", $checked);
break;
}
// auth mode determinitation
if ($this->initAuthModeDetermination()) {
$this->tpl->setVariable('TABLE_AUTH_DETERMINATION', $this->form->getHTML());
}
// roles table
$this->tpl->setVariable("FORMACTION_ROLES", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_AUTH_ROLES", $this->lng->txt("auth_active_roles"));
$this->tpl->setVariable("TXT_ROLE", $this->lng->txt("obj_role"));
$this->tpl->setVariable("TXT_ROLE_AUTH_MODE", $this->lng->txt("auth_role_auth_mode"));
$this->tpl->setVariable("CMD_SUBMIT_ROLES", "updateAuthRoles");
include_once "./Services/AccessControl/classes/class.ilObjRole.php";
$reg_roles = ilObjRole::_lookupRegisterAllowed();
// auth mode selection
include_once './Services/Authentication/classes/class.ilAuthUtils.php';
$active_auth_modes = ilAuthUtils::_getActiveAuthModes();
foreach ($reg_roles as $role) {
foreach ($active_auth_modes as $auth_name => $auth_key) {
// do not list auth modes with external login screen
// even not default, because it can easily be set to
// a non-working auth mode
if ($auth_name == "default" || $auth_name == "cas" || $auth_name == "shibboleth" || $auth_name == 'ldap' || $auth_name == 'apache' || $auth_name == "ecs" || $auth_name == "openid") {
continue;
}
$this->tpl->setCurrentBlock("auth_mode_selection");
if ($auth_name == 'default') {
$name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
} else {
$name = $this->lng->txt('auth_' . $auth_name);
}
$this->tpl->setVariable("AUTH_MODE_NAME", $name);
$this->tpl->setVariable("AUTH_MODE", $auth_name);
if ($role['auth_mode'] == $auth_name) {
$this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
}
$this->tpl->parseCurrentBlock();
}
// END auth_mode selection
$this->tpl->setCurrentBlock("roles");
$this->tpl->setVariable("ROLE", $role['title']);
$this->tpl->setVariable("ROLE_ID", $role['id']);
$this->tpl->parseCurrentBlock();
}
}
示例4: __prepareAccessLimitationRoleList
function __prepareAccessLimitationRoleList()
{
global $lng;
$this->__initRoleAccessLimitations();
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$all = array();
foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
switch ($this->access_limitations_obj->getMode($role['id'])) {
case 'absolute':
$txt_access_value = $lng->txt('reg_access_limitation_limited_until');
$txt_access_value .= " " . ilDatePresentation::formatDate(new ilDateTime($this->access_limitations_obj->getAbsolute($role['id'], IL_CAL_UNIX)));
break;
case 'relative':
$years = $this->access_limitations_obj->getRelative($role['id'], 'y');
$months = $this->access_limitations_obj->getRelative($role['id'], 'm');
$days = $this->access_limitations_obj->getRelative($role['id'], 'd');
$txt_access_value = $lng->txt('reg_access_limitation_limited_time') . " ";
if ($years) {
$txt_access_value .= $years . " ";
$txt_access_value .= $years == 1 ? $lng->txt('year') : $lng->txt('years');
if ($months) {
if ($days) {
$txt_access_value .= ", ";
} else {
$txt_access_value .= " " . $lng->txt('and') . " ";
}
} elseif ($days) {
$txt_access_value .= " " . $lng->txt('and') . " ";
}
}
if ($months) {
$txt_access_value .= $months . " ";
$txt_access_value .= $months == 1 ? $lng->txt('month') : $lng->txt('months');
if ($days) {
$txt_access_value .= " " . $lng->txt('and') . " ";
}
}
if ($days) {
$txt_access_value .= $days . " ";
$txt_access_value .= $days == 1 ? $lng->txt('day') : $lng->txt('days');
}
break;
default:
$txt_access_value = $lng->txt('reg_access_limitation_none');
break;
}
$all[] = $role['title'] . ' (' . $txt_access_value . ')';
}
return $all;
}