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


PHP IConfig::getUserValueForUsers方法代码示例

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


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

示例1: runStep

 /**
  * Send an email to {$limit} users
  *
  * @param int $limit Number of users we want to send an email to
  * @param int $sendTime The latest send time
  * @return int Number of users we sent an email to
  */
 protected function runStep($limit, $sendTime)
 {
     // Get all users which should receive an email
     $affectedUsers = $this->mqHandler->getAffectedUsers($limit, $sendTime);
     if (empty($affectedUsers)) {
         // No users found to notify, mission abort
         return 0;
     }
     $userLanguages = $this->config->getUserValueForUsers('core', 'lang', $affectedUsers);
     $userTimezones = $this->config->getUserValueForUsers('core', 'timezone', $affectedUsers);
     $userEmails = $this->config->getUserValueForUsers('settings', 'email', $affectedUsers);
     // Send Email
     $default_lang = $this->config->getSystemValue('default_language', 'en');
     $defaultTimeZone = date_default_timezone_get();
     foreach ($affectedUsers as $user) {
         if (empty($userEmails[$user])) {
             // The user did not setup an email address
             // So we will not send an email :(
             $this->logger->debug("Couldn't send notification email to user '" . $user . "' (email address isn't set for that user)", ['app' => 'activity']);
             continue;
         }
         $language = !empty($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
         $timezone = !empty($userTimezones[$user]) ? $userTimezones[$user] : $defaultTimeZone;
         $this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $timezone, $sendTime);
     }
     // Delete all entries we dealt with
     $this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
     return sizeof($affectedUsers);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:36,代码来源:emailnotification.php

示例2: runStep

 /**
  * Send an email to {$limit} users
  *
  * @param int $limit Number of users we want to send an email to
  * @return int Number of users we sent an email to
  */
 protected function runStep($limit)
 {
     // We don't use time() but "time() - 1" here, so we don't run into
     // runtime issues later and delete emails, which were created in the
     // same second, but were not collected for the emails.
     $sendTime = time() - 1;
     // Get all users which should receive an email
     $affectedUsers = $this->mqHandler->getAffectedUsers($limit, $sendTime);
     if (empty($affectedUsers)) {
         // No users found to notify, mission abort
         return 0;
     }
     $userLanguages = $this->config->getUserValueForUsers('core', 'lang', $affectedUsers);
     $userTimezones = $this->config->getUserValueForUsers('core', 'timezone', $affectedUsers);
     $userEmails = $this->config->getUserValueForUsers('settings', 'email', $affectedUsers);
     // Get all items for these users
     $mailData = $this->mqHandler->getItemsForUsers($affectedUsers, $sendTime);
     // Send Email
     $default_lang = $this->config->getSystemValue('default_language', 'en');
     $defaultTimeZone = date_default_timezone_get();
     foreach ($mailData as $user => $data) {
         if (empty($userEmails[$user])) {
             // The user did not setup an email address
             // So we will not send an email :(
             $this->logger->debug("Couldn't send notification email to user '" . $user . "' (email address isn't set for that user)", ['app' => 'activity']);
             continue;
         }
         $language = !empty($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
         $timezone = !empty($userTimezones[$user]) ? $userTimezones[$user] : $defaultTimeZone;
         $this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $timezone, $data);
     }
     // Delete all entries we dealt with
     $this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
     return sizeof($affectedUsers);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:41,代码来源:emailnotification.php

示例3: filterUsersBySetting

 /**
  * Filters the given user array by their notification setting
  *
  * @param array $users
  * @param string $method
  * @param string $type
  * @return array Returns a "username => b:true" Map for method = stream
  *               Returns a "username => i:batchtime" Map for method = email
  */
 public function filterUsersBySetting($users, $method, $type)
 {
     if (empty($users) || !is_array($users)) {
         return array();
     }
     $filteredUsers = array();
     $potentialUsers = $this->config->getUserValueForUsers('activity', 'notify_' . $method . '_' . $type, $users);
     foreach ($potentialUsers as $user => $value) {
         if ($value) {
             $filteredUsers[$user] = true;
         }
         unset($users[array_search($user, $users)]);
     }
     // Get the batch time setting from the database
     if ($method === 'email') {
         $potentialUsers = $this->config->getUserValueForUsers('activity', 'notify_setting_batchtime', array_keys($filteredUsers));
         foreach ($potentialUsers as $user => $value) {
             $filteredUsers[$user] = $value;
         }
     }
     if (empty($users)) {
         return $filteredUsers;
     }
     // If the setting is enabled by default,
     // we add all users that didn't set the preference yet.
     if ($this->getDefaultSetting($method, $type)) {
         foreach ($users as $user) {
             if ($method === 'stream') {
                 $filteredUsers[$user] = true;
             } else {
                 $filteredUsers[$user] = $this->getDefaultSetting('setting', 'batchtime');
             }
         }
     }
     return $filteredUsers;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:45,代码来源:usersettings.php

示例4: getValueForUsers

 /**
  * Gets the preference for an array of users
  * @param string $app
  * @param string $key
  * @param array $users
  * @return array Mapped values: userid => value
  * @deprecated use getUserValueForUsers of \OCP\IConfig instead
  */
 public function getValueForUsers($app, $key, $users)
 {
     return $this->config->getUserValueForUsers($app, $key, $users);
 }
开发者ID:samj1912,项目名称:repo,代码行数:12,代码来源:preferences.php


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