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


PHP Notification::warning方法代碼示例

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


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

示例1: createDataSource

 /**
  * Create and return a data source to fetch all groups from all backends where the user is not already a member of
  *
  * @return  ArrayDatasource
  */
 protected function createDataSource()
 {
     $groups = $failures = array();
     foreach ($this->backends as $backend) {
         try {
             $memberships = $backend->select()->from('group_membership', array('group_name'))->where('user_name', $this->userName)->fetchColumn();
             foreach ($backend->select(array('group_name')) as $row) {
                 if (!in_array($row->group_name, $memberships)) {
                     // TODO(jom): Apply this as native query filter
                     $row->backend_name = $backend->getName();
                     $groups[] = $row;
                 }
             }
         } catch (Exception $e) {
             $failures[] = array($backend->getName(), $e);
         }
     }
     if (empty($groups) && !empty($failures)) {
         // In case there are only failures, throw the very first exception again
         throw $failures[0][1];
     } elseif (!empty($failures)) {
         foreach ($failures as $failure) {
             Logger::error($failure[1]);
             Notification::warning(sprintf($this->translate('Failed to fetch any groups from backend %s. Please check your log'), $failure[0]));
         }
     }
     return new ArrayDatasource($groups);
 }
開發者ID:0svald,項目名稱:icingaweb2,代碼行數:33,代碼來源:CreateMembershipForm.php

示例2: fetchUsers

 /**
  * Fetch and return all users from all user backends
  *
  * @return  ArrayDatasource
  */
 protected function fetchUsers()
 {
     $users = array();
     foreach ($this->loadUserBackends('Icinga\\Data\\Selectable') as $backend) {
         try {
             foreach ($backend->select(array('user_name')) as $row) {
                 $users[] = $row;
             }
         } catch (Exception $e) {
             Logger::error($e);
             Notification::warning(sprintf($this->translate('Failed to fetch any users from backend %s. Please check your log'), $backend->getName()));
         }
     }
     return new ArrayDatasource($users);
 }
開發者ID:hsanjuan,項目名稱:icingaweb2,代碼行數:20,代碼來源:GroupController.php

示例3: loadMemberships

 /**
  * Fetch and return the given user's groups from all user group backends
  *
  * @param   User    $user
  *
  * @return  ArrayDatasource
  */
 protected function loadMemberships(User $user)
 {
     $groups = $alreadySeen = array();
     foreach ($this->loadUserGroupBackends() as $backend) {
         try {
             foreach ($backend->getMemberships($user) as $groupName) {
                 if (array_key_exists($groupName, $alreadySeen)) {
                     continue;
                     // Ignore duplicate memberships
                 }
                 $alreadySeen[$groupName] = null;
                 $groups[] = (object) array('group_name' => $groupName, 'backend' => $backend);
             }
         } catch (Exception $e) {
             Logger::error($e);
             Notification::warning(sprintf($this->translate('Failed to fetch memberships from backend %s. Please check your log'), $backend->getName()));
         }
     }
     return new ArrayDatasource($groups);
 }
開發者ID:hsanjuan,項目名稱:icingaweb2,代碼行數:27,代碼來源:UserController.php


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