當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserSettings::filterUsersBySetting方法代碼示例

本文整理匯總了PHP中UserSettings::filterUsersBySetting方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserSettings::filterUsersBySetting方法的具體用法?PHP UserSettings::filterUsersBySetting怎麽用?PHP UserSettings::filterUsersBySetting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserSettings的用法示例。


在下文中一共展示了UserSettings::filterUsersBySetting方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: shareFileOrFolderWithGroup

 /**
  * @brief Sharing a file or folder with a group
  * @param array $params The hook params
  */
 public static function shareFileOrFolderWithGroup($params)
 {
     // User performing the share
     self::shareNotificationForSharer('shared_group_self', $params['shareWith'], $params['fileSource'], $params['itemType']);
     // Members of the new group
     $affectedUsers = array();
     $usersInGroup = \OC_Group::usersInGroup($params['shareWith']);
     foreach ($usersInGroup as $user) {
         $affectedUsers[$user] = $params['fileTarget'];
     }
     // Remove the triggering user, we already managed his notifications
     unset($affectedUsers[\OCP\User::getUser()]);
     if (empty($affectedUsers)) {
         return;
     }
     $filteredStreamUsersInGroup = UserSettings::filterUsersBySetting($usersInGroup, 'stream', Data::TYPE_SHARED);
     $filteredEmailUsersInGroup = UserSettings::filterUsersBySetting($usersInGroup, 'email', Data::TYPE_SHARED);
     // Check when there was a naming conflict and the target is different
     // for some of the users
     $query = \OC_DB::prepare('SELECT `share_with`, `file_target` FROM `*PREFIX*share` WHERE `parent` = ? ');
     $result = $query->execute(array($params['id']));
     if (\OCP\DB::isError($result)) {
         \OCP\Util::writeLog('OCA\\Activity\\Hooks::shareFileOrFolderWithGroup', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
     } else {
         while ($row = $result->fetchRow()) {
             $affectedUsers[$row['share_with']] = $row['file_target'];
         }
     }
     foreach ($affectedUsers as $user => $path) {
         if (empty($filteredStreamUsersInGroup[$user]) && empty($filteredEmailUsersInGroup[$user])) {
             continue;
         }
         self::addNotificationsForUser($user, 'shared_with_by', array($path, \OCP\User::getUser()), $path, $params['itemType'] === 'file', !empty($filteredStreamUsersInGroup[$user]), !empty($filteredEmailUsersInGroup[$user]) ? $filteredEmailUsersInGroup[$user] : 0);
     }
 }
開發者ID:CDN-Sparks,項目名稱:owncloud,代碼行數:39,代碼來源:hooks.php


注:本文中的UserSettings::filterUsersBySetting方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。