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


PHP Gdn_DataSet类代码示例

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


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

示例1: __get

 public function __get($Name)
 {
     switch ($Name) {
         case 'CommentData':
             Deprecated('ActivityController->CommentData', "ActivityController->Data('Activities')");
             $Result = new Gdn_DataSet(array(), DATASET_TYPE_OBJECT);
             return $Result;
         case 'ActivityData':
             Deprecated('ActivityController->ActivityData', "ActivityController->Data('Activities')");
             $Result = new Gdn_DataSet($this->Data('Activities'), DATASET_TYPE_ARRAY);
             $Result->DatasetType(DATASET_TYPE_OBJECT);
             return $Result;
     }
 }
开发者ID:statico,项目名称:openshift-origin-vanillaforums,代码行数:14,代码来源:class.activitycontroller.php

示例2: PreloadLikes

 public function PreloadLikes(Gdn_DataSet $Comments)
 {
     $cache = array();
     while ($CommentID = $Comments->Value('CommentID', FALSE)) {
         $cache[] = $CommentID;
     }
     if (!empty($cache)) {
         $Likes = $this->SQL->Select()->From($this->Name)->WhereIn('CommentID', $cache)->OrderBy('CommentID')->Get()->Result(DATASET_TYPE_OBJECT);
         foreach ($Likes as $Like) {
             if (!$this->Cache[$Like->CommentID]) {
                 $this->Cache[$Like->CommentID] = array();
             }
             $this->Cache[$Like->CommentID][] = $Like;
         }
     }
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:16,代码来源:LikeModel.php

示例3: array

   public static function &AllBans() {
      if (!self::$_AllBans) {
         self::$_AllBans = Gdn::SQL()->Get('Ban')->ResultArray();
         self::$_AllBans = Gdn_DataSet::Index(self::$_AllBans, array('BanID'));
      }
//      $AllBans =& self::$_AllBans;
      return self::$_AllBans;
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:8,代码来源:class.banmodel.php

示例4: array

 /**
  * Get and store list of current bans.
  *
  * @since 2.0.18
  * @access public
  */
 public static function &allBans()
 {
     if (!self::$_AllBans) {
         self::$_AllBans = Gdn::sql()->get('Ban')->resultArray();
         self::$_AllBans = Gdn_DataSet::index(self::$_AllBans, array('BanID'));
     }
     //      $AllBans =& self::$_AllBans;
     return self::$_AllBans;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:15,代码来源:class.banmodel.php

示例5: Search

 public function Search($Search, $Offset = 0, $Limit = 20)
 {
     $BaseUrl = C('Plugins.Solr.SearchUrl', 'http://localhost:8983/solr/select/?');
     if (!$BaseUrl) {
         throw new Gdn_UserException("The search url has not been configured.");
     }
     if (!$Search) {
         return array();
     }
     // Escepe the search.
     $Search = preg_replace('`([][+&|!(){}^"~*?:\\\\-])`', "\\\\\$1", $Search);
     // Add the category watch.
     $Categories = CategoryModel::CategoryWatch();
     if ($Categories === FALSE) {
         return array();
     } elseif ($Categories !== TRUE) {
         $Search = 'CategoryID:(' . implode(' ', $Categories) . ') AND ' . $Search;
     }
     // Build the search url.
     $BaseUrl .= strpos($BaseUrl, '?') === FALSE ? '?' : '&';
     $Query = array('q' => $Search, 'start' => $Offset, 'rows' => $Limit);
     $Url = $BaseUrl . http_build_query($Query);
     // Grab the data.
     $Curl = curl_init($Url);
     curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
     $CurlResult = curl_exec($Curl);
     curl_close($Curl);
     // Parse the result into the form that the search controller expects.
     $Xml = new SimpleXMLElement($CurlResult);
     $Result = array();
     if (!isset($Xml->result)) {
         return array();
     }
     foreach ($Xml->result->children() as $Doc) {
         $Row = array();
         foreach ($Doc->children() as $Field) {
             $Name = (string) $Field['name'];
             $Row[$Name] = (string) $Field;
         }
         // Add the url.
         switch ($Row['DocType']) {
             case 'Discussion':
                 $Row['Url'] = '/discussion/' . $Row['PrimaryID'] . '/' . Gdn_Format::Url($Row['Title']);
                 break;
             case 'Comment':
                 $Row['Url'] = "/discussion/comment/{$Row['PrimaryID']}/#Comment_{$Row['PrimaryID']}";
                 break;
         }
         // Fix the time.
         $Row['DateInserted'] = strtotime($Row['DateInserted']);
         $Result[] = $Row;
     }
     // Join the users into the result.
     Gdn_DataSet::Join($Result, array('table' => 'User', 'parent' => 'UserID', 'prefix' => '', 'Name', 'Photo'));
     return $Result;
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:56,代码来源:class.searchmodel.php

示例6: __construct

 public function __construct($Sender = '', $ApplicationFolder = '')
 {
     $this->Data = FALSE;
     $NoFollowing = TRUE;
     if (C('Vanilla.Categories.Use') == TRUE) {
         // Load categories with respect to view permissions
         $Categories = CategoryModel::Categories();
         $Categories2 = $Categories;
         foreach ($Categories2 as $i => $Category) {
             if (!$Category['PermsDiscussionsView']) {
                 unset($Categories[$i]);
             } elseif (!$Category['Following']) {
                 $NoFollowing = FALSE;
             }
         }
         // delete view filter if no categories are hidden
         $Session = Gdn::Session();
         if ($NoFollowing && $Session->IsValid()) {
             $Session->SetPreference('ShowAllCategories', TRUE);
         }
         // set categories to data
         $Data = new Gdn_DataSet($Categories);
         $Data->DatasetType(DATASET_TYPE_ARRAY);
         $Data->DatasetType(DATASET_TYPE_OBJECT);
         $this->Data['Categories'] = $Data;
         // calculate additional needed data
         $this->Data['CategoryID'] = isset($Sender->CategoryID) ? $Sender->CategoryID : '';
         $this->Data['OnCategories'] = strtolower($Sender->ControllerName) == 'categoriescontroller' && !is_numeric($this->Data['CategoryID']);
         $this->Data['ShowAllCategoriesPref'] = $Session->GetPreference('ShowAllCategories');
         $this->Data['Url'] = Gdn::Request()->Path();
         if ($this->Data['Url'] == '') {
             $this->Data['Url'] = '/';
         }
         $this->Data['ShowAllCategoriesUrl'] = Gdn::Request()->Url('categories/settoggle?ShowAllCategories=true&Target=' . $this->Data['Url']);
         $this->Data['ShowFollowedCategoriesUrl'] = Gdn::Request()->Url('categories/settoggle?ShowAllCategories=false&Target=' . $this->Data['Url']);
         $this->Data['TKey'] = urlencode(Gdn::Session()->TransientKey());
         $this->Data['ValidSession'] = $Session->UserID > 0 && $Session->ValidateTransientKey($this->Data['TKey']);
         $this->Data['MaxDepth'] = C('Vanilla.Categories.MaxDisplayDepth');
         $this->Data['DoHeadings'] = C('Vanilla.Categories.DoHeadings');
     }
     parent::__construct($Sender, $ApplicationFolder);
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:42,代码来源:class.categoriesmoduleplusmodule.php

示例7: getData

 /**
  * Get the data for this module.
  */
 protected function getData()
 {
     // Allow plugins to set different data.
     $this->fireEvent('GetData');
     if ($this->Data) {
         return;
     }
     $Categories = CategoryModel::categories();
     $Categories2 = $Categories;
     // Filter out the categories we aren't watching.
     foreach ($Categories2 as $i => $Category) {
         if (!$Category['PermsDiscussionsView'] || !$Category['Following']) {
             unset($Categories[$i]);
         }
     }
     $Data = new Gdn_DataSet($Categories);
     $Data->DatasetType(DATASET_TYPE_ARRAY);
     $Data->DatasetType(DATASET_TYPE_OBJECT);
     $this->Data = $Data;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:23,代码来源:class.categoriesmodule.php

示例8: __construct

 public function __construct($Sender = '')
 {
     // Load categories
     $this->Data = FALSE;
     if (C('Vanilla.Categories.Use') == TRUE && !C('Vanilla.Categories.HideModule')) {
         $Categories = CategoryModel::Categories();
         $Categories2 = $Categories;
         // Filter out the categories we aren't watching.
         foreach ($Categories2 as $i => $Category) {
             if (!$Category['PermsDiscussionsView'] || !$Category['Following']) {
                 unset($Categories[$i]);
             }
         }
         $Data = new Gdn_DataSet($Categories);
         $Data->DatasetType(DATASET_TYPE_ARRAY);
         $Data->DatasetType(DATASET_TYPE_OBJECT);
         $this->Data = $Data;
     }
     parent::__construct($Sender);
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:20,代码来源:class.categoriesmodule.php

示例9: getProviders

 /**
  *
  *
  * @return array|null|type
  */
 public function getProviders()
 {
     $this->SQL->select('uap.*')->from('UserAuthenticationProvider uap');
     if (Gdn::session()->isValid()) {
         $UserID = Gdn::session()->UserID;
         $this->SQL->select('ua.ForeignUserKey', '', 'UniqueID')->join('UserAuthentication ua', "uap.AuthenticationKey = ua.ProviderKey and ua.UserID = {$UserID}", 'left');
     }
     $Data = $this->SQL->get()->resultArray();
     $Data = Gdn_DataSet::index($Data, array('AuthenticationKey'));
     foreach ($Data as &$Row) {
         self::calculate($Row);
     }
     return $Data;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:19,代码来源:class.authenticationprovidermodel.php

示例10: getIDs

 /**
  *
  *
  * @param array $IDs
  * @param bool $SkipCacheQuery
  * @return array
  * @throws Exception
  */
 public function getIDs($IDs, $SkipCacheQuery = false)
 {
     $DatabaseIDs = $IDs;
     $Data = [];
     if (!$SkipCacheQuery) {
         $Keys = [];
         // Make keys for cache query
         foreach ($IDs as $UserID) {
             if (!$UserID) {
                 continue;
             }
             $Keys[] = formatString(self::USERID_KEY, ['UserID' => $UserID]);
         }
         // Query cache layer
         $CacheData = Gdn::cache()->get($Keys);
         if (!is_array($CacheData)) {
             $CacheData = [];
         }
         foreach ($CacheData as $RealKey => $User) {
             if ($User === null) {
                 $ResultUserID = trim(strrchr($RealKey, '.'), '.');
             } else {
                 $ResultUserID = val('UserID', $User);
             }
             $this->setCalculatedFields($User);
             $Data[$ResultUserID] = $User;
         }
         //echo "from cache:\n";
         //print_r($Data);
         $DatabaseIDs = array_diff($DatabaseIDs, array_keys($Data));
         unset($CacheData);
     }
     // Clean out bogus blank entries
     $DatabaseIDs = array_diff($DatabaseIDs, [null, '']);
     // If we are missing any users from cache query, fill em up here
     if (sizeof($DatabaseIDs)) {
         $DatabaseData = $this->SQL->whereIn('UserID', $DatabaseIDs)->getWhere('User')->result(DATASET_TYPE_ARRAY);
         $DatabaseData = Gdn_DataSet::index($DatabaseData, 'UserID');
         //echo "from DB:\n";
         //print_r($DatabaseData);
         foreach ($DatabaseIDs as $ID) {
             if (isset($DatabaseData[$ID])) {
                 $User = $DatabaseData[$ID];
                 $this->userCache($User, $ID);
                 // Apply calculated fields
                 $this->setCalculatedFields($User);
                 $Data[$ID] = $User;
             } else {
                 $User = null;
                 $this->userCache($User, $ID);
             }
         }
     }
     $this->EventArguments['RequestedIDs'] = $IDs;
     $this->EventArguments['LoadedUsers'] =& $Data;
     $this->fireEvent('AfterGetIDs');
     return $Data;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:66,代码来源:class.usermodel.php

示例11: AddUserToConversation

 /**
  * Add another user to the conversation.
  * 
  * @since 2.0.0
  * @access public
  *
  * @param int $ConversationID Unique ID of conversation effected.
  * @param int $UserID Unique ID of current user.
  */
 public function AddUserToConversation($ConversationID, $UserID)
 {
     if (!is_array($UserID)) {
         $UserID = array($UserID);
     }
     // First define the current users in the conversation
     $OldContributorData = $this->GetRecipients($ConversationID);
     $OldContributorData = Gdn_DataSet::Index($OldContributorData, 'UserID');
     $AddedUserIDs = array();
     // Get some information about this conversation
     $ConversationData = $this->SQL->Select('LastMessageID')->Select('CountMessages')->From('Conversation')->Where('ConversationID', $ConversationID)->Get()->FirstRow();
     // Add the user(s) if they are not already in the conversation
     foreach ($UserID as $NewUserID) {
         if (!array_key_exists($NewUserID, $OldContributorData)) {
             $AddedUserIDs[] = $NewUserID;
             $this->SQL->Insert('UserConversation', array('UserID' => $NewUserID, 'ConversationID' => $ConversationID, 'LastMessageID' => $ConversationData->LastMessageID, 'CountReadMessages' => 0, 'DateConversationUpdated' => $ConversationData['DateUpdated']));
         } elseif ($OldContributorData[$NewUserID]->Deleted) {
             $AddedUserIDs[] = $NewUserID;
             $this->SQL->Put('UserConversation', array('Deleted' => 0), array('ConversationID' => $ConversationID, 'UserID' => $NewUserID));
         }
     }
     if (count($AddedUserIDs) > 0) {
         $Session = Gdn::Session();
         // Update the Contributors field on the conversation
         $Contributors = array_unique(array_merge($AddedUserIDs, array_keys($OldContributorData)));
         sort($Contributors);
         $this->SQL->Update('Conversation')->Set('Contributors', Gdn_Format::Serialize($Contributors))->Where('ConversationID', $ConversationID)->Put();
         $ActivityModel = new ActivityModel();
         foreach ($AddedUserIDs as $AddedUserID) {
             $ActivityModel->Queue(array('ActivityType' => 'AddedToConversation', 'NotifyUserID' => $AddedUserID, 'HeadlineFormat' => T('You were added to a conversation.', '{InsertUserID,user} added {NotifyUserID,you} to a <a href="{Url,htmlencode}">conversation</a>.')), 'ConversationMessage');
         }
         $ActivityModel->SaveQueue();
         $this->UpdateUserUnreadCount($AddedUserIDs);
     }
 }
开发者ID:rnovino,项目名称:Garden,代码行数:44,代码来源:class.conversationmodel.php

示例12: RecordAdvancedNotications

 /**
  * Record advanced notifications for users.
  * 
  * @param ActivityModel $ActivityModel
  * @param array $Discussion
  * @param int $CommentID
  * @param array $NotifiedUsers 
  */
 public function RecordAdvancedNotications($ActivityModel, $Discussion, $Comment, &$NotifiedUsers)
 {
     // Grab all of the users that need to be notified.
     $Data = $this->SQL->GetWhere('UserMeta', array('Name' => 'Preferences.Email.NewDiscussion'))->ResultArray();
     // Grab all of their follow/unfollow preferences.
     $UserIDs = ConsolidateArrayValuesByKey($Data, 'UserID');
     $CategoryID = GetValue('CategoryID', $Discussion);
     $UserPrefs = $this->SQL->Select('*')->From('UserCategory')->Where('CategoryID', $CategoryID)->WhereIn('UserID', $UserIDs)->Get()->ResultArray();
     $UserPrefs = Gdn_DataSet::Index($UserPrefs, 'UserID');
     $CommentID = $Comment['CommentID'];
     foreach ($UserIDs as $UserID) {
         //         if ($UserID == $Comment['InsertUserID'])
         //            continue;
         if (in_array($UserID, $NotifiedUsers)) {
             continue;
         }
         if (array_key_exists($UserID, $UserPrefs) && $UserPrefs[$UserID]['Unfollow']) {
             continue;
         }
         $ActivityID = AddActivity($Comment['InsertUserID'], 'NewComment', Gdn_Format::Text(Gdn_Format::To($Comment['Body'], $Comment['Format'])), $UserID, "/discussion/comment/{$CommentID}#Comment_{$CommentID}", TRUE);
         //         $ActivityModel->QueueNotification($ActivityID);
         $NotifiedUsers[] = $UserID;
     }
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:32,代码来源:class.commentmodel.php

示例13: joinRecords

 /**
  * Join external records to an array.
  *
  * @param array &$Data The data to join.
  * In order to join records each row must have the a RecordType and RecordID column.
  * @param string $Column The name of the column to put the record in.
  * If this is blank then the record will be merged into the row.
  * @param bool $Unset Whether or not to unset rows that don't have a record.
  * @since 2.3
  */
 function joinRecords(&$Data, $Column = '', $Unset = false)
 {
     $IDs = array();
     $AllowedCats = DiscussionModel::CategoryPermissions();
     if ($AllowedCats === false) {
         // This user does not have permission to view anything.
         $Data = array();
         return;
     }
     // Gather all of the ids to fetch.
     foreach ($Data as &$Row) {
         if (!$Row['RecordType']) {
             continue;
         }
         $RecordType = ucfirst(StringEndsWith($Row['RecordType'], '-Total', true, true));
         $Row['RecordType'] = $RecordType;
         $ID = $Row['RecordID'];
         $IDs[$RecordType][$ID] = $ID;
     }
     // Fetch all of the data in turn.
     $JoinData = array();
     foreach ($IDs as $RecordType => $RecordIDs) {
         if ($RecordType == 'Comment') {
             Gdn::SQL()->Select('d.Name, d.CategoryID')->Join('Discussion d', 'd.DiscussionID = r.DiscussionID');
         }
         $Rows = Gdn::SQL()->Select('r.*')->WhereIn($RecordType . 'ID', array_values($RecordIDs))->Get($RecordType . ' r')->ResultArray();
         $JoinData[$RecordType] = Gdn_DataSet::Index($Rows, array($RecordType . 'ID'));
     }
     // Join the rows.
     $Unsets = array();
     foreach ($Data as $Index => &$Row) {
         $RecordType = $Row['RecordType'];
         $ID = $Row['RecordID'];
         if (!isset($JoinData[$RecordType][$ID])) {
             if ($Unset) {
                 $Unsets[] = $Index;
             }
             continue;
             // orphaned?
         }
         $Record = $JoinData[$RecordType][$ID];
         if ($AllowedCats !== true) {
             // Check to see if the user has permission to view this record.
             $CategoryID = GetValue('CategoryID', $Record, -1);
             if (!in_array($CategoryID, $AllowedCats)) {
                 $Unsets[] = $Index;
                 continue;
             }
         }
         switch ($RecordType) {
             case 'Discussion':
                 $Url = DiscussionUrl($Record, '', '/') . '#latest';
                 break;
             case 'Comment':
                 $Url = CommentUrl($Record, '/');
                 $Record['Name'] = sprintf(T('Re: %s'), $Record['Name']);
                 break;
             default:
                 $Url = '';
         }
         $Record['Url'] = $Url;
         if ($Column) {
             $Row[$Column] = $Record;
         } else {
             $Row = array_merge($Row, $Record);
         }
     }
     foreach ($Unsets as $Index) {
         unset($Data[$Index]);
     }
     // Join the users.
     Gdn::UserModel()->JoinUsers($Data, array('InsertUserID'));
     if (!empty($Unsets)) {
         $Data = array_values($Data);
     }
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:86,代码来源:functions.general.php

示例14: DiscussionModel_AfterAddColumns_Handler

 /**
  * Join message counts into the discussion list.
  * @param DiscussionModel $Sender
  * @param array $Args
  */
 public function DiscussionModel_AfterAddColumns_Handler($Sender, $Args)
 {
     if (!Gdn::Session()->UserID) {
         return;
     }
     $Data = $Args['Data'];
     $Result =& $Data->Result();
     // Gather the discussion IDs.
     $DiscusisonIDs = array();
     foreach ($Result as $Row) {
         $DiscusisonIDs[] = GetValue('DiscussionID', $Row);
     }
     // Grab all of the whispers associated to the discussions being looked at.
     $Sql = Gdn::SQL()->Select('c.DiscussionID')->Select('c.CountMessages', 'sum', 'CountMessages')->Select('c.DateUpdated', 'max', 'DateLastMessage')->From('Conversation c')->WhereIn('c.DiscussionID', $DiscusisonIDs)->GroupBy('c.DiscussionID');
     if (!Gdn::Session()->CheckPermission('Conversations.Moderation.Manage')) {
         $Sql->Join('UserConversation uc', 'c.ConversationID = uc.ConversationID')->Where('uc.UserID', Gdn::Session()->UserID);
     }
     $Conversations = $Sql->Get()->ResultArray();
     $Conversations = Gdn_DataSet::Index($Conversations, 'DiscussionID');
     foreach ($Result as &$Row) {
         $DiscusisonID = GetValue('DiscussionID', $Row);
         $CRow = GetValue($DiscusisonID, $Conversations);
         if (!$CRow) {
             continue;
         }
         $DateLastViewed = GetValue('DateLastViewed', $Row);
         $DateLastMessage = $CRow['DateLastMessage'];
         $NewWhispers = Gdn_Format::ToTimestamp($DateLastViewed) < Gdn_Format::ToTimestamp($DateLastMessage);
         SetValue('CountWhispers', $Row, $CRow['CountMessages']);
         SetValue('DateLastWhisper', $Row, $DateLastMessage);
         SetValue('NewWhispers', $Row, $NewWhispers);
     }
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:38,代码来源:class.whispers.plugin.php

示例15: setUserRoles

 /**
  *
  *
  * @param $Users
  * @param string $UserIDColumn
  * @param string $RolesColumn
  */
 public static function setUserRoles(&$Users, $UserIDColumn = 'UserID', $RolesColumn = 'Roles')
 {
     $UserIDs = array_unique(ConsolidateArrayValuesByKey($Users, $UserIDColumn));
     // Try and get all of the mappings from the cache.
     $Keys = array();
     foreach ($UserIDs as $UserID) {
         $Keys[$UserID] = formatString(UserModel::USERROLES_KEY, array('UserID' => $UserID));
     }
     $UserRoles = Gdn::cache()->get($Keys);
     if (!is_array($UserRoles)) {
         $UserRoles = array();
     }
     // Grab all of the data that doesn't exist from the DB.
     $MissingIDs = array();
     foreach ($Keys as $UserID => $Key) {
         if (!array_key_exists($Key, $UserRoles)) {
             $MissingIDs[$UserID] = $Key;
         }
     }
     if (count($MissingIDs) > 0) {
         $DbUserRoles = Gdn::sql()->select('ur.*')->from('UserRole ur')->whereIn('ur.UserID', array_keys($MissingIDs))->get()->resultArray();
         $DbUserRoles = Gdn_DataSet::Index($DbUserRoles, 'UserID', array('Unique' => false));
         // Store the user role mappings.
         foreach ($DbUserRoles as $UserID => $Rows) {
             $RoleIDs = consolidateArrayValuesByKey($Rows, 'RoleID');
             $Key = $Keys[$UserID];
             Gdn::cache()->store($Key, $RoleIDs);
             $UserRoles[$Key] = $RoleIDs;
         }
     }
     $AllRoles = self::roles();
     // roles indexed by role id.
     // Skip personal info roles
     if (!checkPermission('Garden.PersonalInfo.View')) {
         $AllRoles = array_filter($AllRoles, 'self::FilterPersonalInfo');
     }
     // Join the users.
     foreach ($Users as &$User) {
         $UserID = val($UserIDColumn, $User);
         $Key = $Keys[$UserID];
         $RoleIDs = val($Key, $UserRoles, array());
         $Roles = array();
         foreach ($RoleIDs as $RoleID) {
             if (!array_key_exists($RoleID, $AllRoles)) {
                 continue;
             }
             $Roles[$RoleID] = $AllRoles[$RoleID]['Name'];
         }
         setValue($RolesColumn, $User, $Roles);
     }
 }
开发者ID:austins,项目名称:vanilla,代码行数:58,代码来源:class.rolemodel.php


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