本文整理汇总了PHP中RoleModel::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP RoleModel::Get方法的具体用法?PHP RoleModel::Get怎么用?PHP RoleModel::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoleModel
的用法示例。
在下文中一共展示了RoleModel::Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DefaultRoles
public function DefaultRoles()
{
$this->Permission('Garden.Roles.Manage');
$this->AddSideMenu('');
$this->Title(T('Default Roles'));
// Load roles for dropdowns.
$RoleModel = new RoleModel();
$this->SetData('RoleData', $RoleModel->Get());
if ($this->Form->AuthenticatedPostBack() === FALSE) {
// Get a list of default member roles from the config.
$DefaultRoles = C('Garden.Registration.DefaultRoles');
$this->Form->SetValue('DefaultRoles', $DefaultRoles);
// Get the guest roles.
$GuestRolesData = $RoleModel->GetByUserID(0);
$GuestRoles = ConsolidateArrayValuesByKey($GuestRolesData, 'RoleID');
$this->Form->SetValue('GuestRoles', $GuestRoles);
// The applicant role.
$ApplicantRoleID = C('Garden.Registration.ApplicantRoleID', '');
$this->Form->SetValue('ApplicantRoleID', $ApplicantRoleID);
} else {
$DefaultRoles = $this->Form->GetFormValue('DefaultRoles');
$ApplicantRoleID = $this->Form->GetFormValue('ApplicantRoleID');
SaveToConfig(array('Garden.Registration.DefaultRoles' => $DefaultRoles, 'Garden.Registration.ApplicantRoleID' => $ApplicantRoleID));
$GuestRoles = $this->Form->GetFormValue('GuestRoles');
$UserModel = new UserModel();
$UserModel->SaveRoles(0, $GuestRoles, FALSE);
$this->StatusMessage = T("Saved");
}
$this->Render();
}