当前位置: 首页>>代码示例>>PHP>>正文


PHP RoleModel::getByNotRoleID方法代码示例

本文整理汇总了PHP中RoleModel::getByNotRoleID方法的典型用法代码示例。如果您正苦于以下问题:PHP RoleModel::getByNotRoleID方法的具体用法?PHP RoleModel::getByNotRoleID怎么用?PHP RoleModel::getByNotRoleID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RoleModel的用法示例。


在下文中一共展示了RoleModel::getByNotRoleID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  * Remove a role.
  *
  * @since 2.0.0
  * @access public
  */
 public function delete($RoleID = false)
 {
     if (!$this->_permission($RoleID)) {
         return;
     }
     $this->title(t('Delete Role'));
     $this->addSideMenu('dashboard/role');
     $Role = $this->RoleModel->getByRoleID($RoleID);
     if ($Role->Deletable == '0') {
         $this->Form->addError('You cannot delete this role.');
     }
     // Make sure the form knows which item we are deleting.
     $this->Form->addHidden('RoleID', $RoleID);
     // Figure out how many users will be affected by this deletion
     $this->AffectedUsers = $this->RoleModel->getUserCount($RoleID);
     // Figure out how many users will be orphaned by this deletion
     $this->OrphanedUsers = $this->RoleModel->getUserCount($RoleID, true);
     // Get a list of roles other than this one that can act as a replacement
     $this->ReplacementRoles = $this->RoleModel->getByNotRoleID($RoleID);
     if ($this->Form->authenticatedPostBack()) {
         // Make sure that a replacement role has been selected if there were going to be orphaned users
         if ($this->OrphanedUsers > 0) {
             $Validation = new Gdn_Validation();
             $Validation->applyRule('ReplacementRoleID', 'Required', 'You must choose a replacement role for orphaned users.');
             $Validation->validate($this->Form->formValues());
             $this->Form->setValidationResults($Validation->results());
         }
         if ($this->Form->errorCount() == 0) {
             // Go ahead and delete the Role
             $this->RoleModel->deleteAndReplace($RoleID, $this->Form->getValue('ReplacementRoleID'));
             $this->RedirectUrl = url('dashboard/role');
             $this->informMessage(t('Deleting role...'));
         }
     }
     $this->render();
 }
开发者ID:R-J,项目名称:vanilla,代码行数:42,代码来源:class.rolecontroller.php


注:本文中的RoleModel::getByNotRoleID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。