当前位置: 首页>>代码示例>>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;未经允许,请勿转载。