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


PHP RoleModel::SetUserRoles方法代码示例

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


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

示例1: GetMembersListEnh

 public function GetMembersListEnh($Limit = 5, $Offset = 0, $SortOrder, $UserField)
 {
     $RoleAction = $RoleActionID = "";
     $RemoveRoleArray = C('Plugins.MembersListEnh.RoleID');
     if (isset($RemoveRoleArray)) {
         $RoleAction = $RemoveRoleArray[0];
         $RoleActionID = $RemoveRoleArray[1];
     }
     $MembersListEnhModel = new Gdn_Model('User');
     $SQL = $MembersListEnhModel->SQL->Select('*')->From('User u')->LeftJoin('UserRole ur', 'u.UserID = ur.UserID');
     if (C('EnabledPlugins.KarmaBank') == TRUE) {
         $SQL->LeftJoin('KarmaBankBalance kb', 'u.UserID = kb.UserID');
     }
     if ($UserField != "Balance") {
         $SQL->OrderBy("u.{$UserField}", $SortOrder);
     }
     if (C('EnabledPlugins.KarmaBank') == TRUE && $UserField == "Balance") {
         $SQL->OrderBy("kb.Balance", $SortOrder);
     }
     $SQL->Where('Deleted', false);
     if ($RoleAction == "Exclude") {
         $SQL->Where('ur.RoleID<>', $RoleActionID);
     }
     if ($RoleAction == "Include") {
         $SQL->Where('ur.RoleID', $RoleActionID);
     }
     // Only show user once if in more than one role.
     $SQL->GroupBy('ur.UserID');
     $Sender->UserData = $SQL->Limit($Limit, $Offset)->Get();
     RoleModel::SetUserRoles($Sender->UserData->Result());
     return $Sender->UserData;
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:32,代码来源:class.memberslistenhmodel.php

示例2: Index

   public function Index($Keywords = '', $Page = '') {
      $this->Permission(
         array(
            'Garden.Users.Add',
            'Garden.Users.Edit',
            'Garden.Users.Delete'
         ),
         '',
         FALSE
      );
      $this->AddJsFile('jquery.gardenmorepager.js');
      $this->AddJsFile('user.js');
      $this->Title(T('Users'));

      $this->AddSideMenu('dashboard/user');

      $this->Form->Method = 'get';

      // Input Validation.
      list($Offset, $Limit) = OffsetLimit($Page, PagerModule::$DefaultPageSize);
      if (!$Keywords) {
         $Keywords = $this->Form->GetFormValue('Keywords');
         if ($Keywords)
            $Offset = 0;
      }

      // Put the Keyword back in the form
      if ($Keywords)
         $this->Form->SetFormValue('Keywords', $Keywords);

      $UserModel = new UserModel();
      //$Like = trim($Keywords) == '' ? FALSE : array('u.Name' => $Keywords, 'u.Email' => $Keywords);
      list($Offset, $Limit) = OffsetLimit($Page, 30);

      $Filter = $this->_GetFilter();
      if ($Filter)
         $Filter['Keywords'] = $Keywords;
      else
         $Filter = $Keywords;

      $this->SetData('RecordCount', $UserModel->SearchCount($Filter));
      $this->UserData = $UserModel->Search($Filter, 'u.Name', 'asc', $Limit, $Offset);
      RoleModel::SetUserRoles($this->UserData->Result());
      
      // Deliver json data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'users';
      }

      $this->Render();
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:53,代码来源:class.usercontroller.php

示例3: PostController_Render_Before

 public function PostController_Render_Before($Sender)
 {
     $Data = $Sender->Data('Comments');
     if (is_object($Data)) {
         RoleModel::SetUserRoles($Data->Result(), 'InsertUserID');
     }
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:7,代码来源:class.roletitle.plugin.php

示例4: index

 /**
  * User management list.
  *
  * @since 2.0.0
  * @access public
  * @param mixed $Keywords Term or array of terms to filter list of users.
  * @param int $Page Page number.
  * @param string $Order Sort order for list.
  */
 public function index($Keywords = '', $Page = '', $Order = '')
 {
     $this->permission(array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'), '', false);
     // Page setup
     $this->addJsFile('jquery.gardenmorepager.js');
     $this->addJsFile('user.js');
     $this->title(t('Users'));
     $this->addSideMenu('dashboard/user');
     // Form setup
     $this->Form->Method = 'get';
     // Input Validation.
     list($Offset, $Limit) = offsetLimit($Page, PagerModule::$DefaultPageSize);
     if (!$Keywords) {
         $Keywords = $this->Form->getFormValue('Keywords');
         if ($Keywords) {
             $Offset = 0;
         }
     }
     if (!is_string($Keywords)) {
         $Keywords = '';
     }
     // Put the Keyword back in the form
     if ($Keywords) {
         $this->Form->setFormValue('Keywords', $Keywords);
     }
     $UserModel = new UserModel();
     //$Like = trim($Keywords) == '' ? FALSE : array('u.Name' => $Keywords, 'u.Email' => $Keywords);
     list($Offset, $Limit) = offsetLimit($Page, 30);
     $Filter = $this->_GetFilter();
     if ($Filter) {
         $Filter['Keywords'] = $Keywords;
     } else {
         $Filter = array('Keywords' => (string) $Keywords);
     }
     $Filter['Optimize'] = $this->PastUserThreshold();
     // Sorting
     if (in_array($Order, array('DateInserted', 'DateFirstVisit', 'DateLastActive'))) {
         $Order = 'u.' . $Order;
         $OrderDir = 'desc';
     } else {
         $Order = 'u.Name';
         $OrderDir = 'asc';
     }
     // Get user list
     $this->UserData = $UserModel->Search($Filter, $Order, $OrderDir, $Limit, $Offset);
     $this->setData('Users', $this->UserData);
     if ($this->PastUserThreshold()) {
         $this->setData('_CurrentRecords', $this->UserData->count());
     } else {
         $this->setData('RecordCount', $UserModel->SearchCount($Filter));
     }
     RoleModel::SetUserRoles($this->UserData->result());
     // Deliver json data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL && $this->_DeliveryMethod == DELIVERY_METHOD_XHTML) {
         $this->setJson('LessRow', $this->Pager->toString('less'));
         $this->setJson('MoreRow', $this->Pager->toString('more'));
         $this->View = 'users';
     }
     $this->render();
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:69,代码来源:class.usercontroller.php


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