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


PHP Form::warning方法代码示例

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


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

示例1: isValidIdoInstance

 /**
  * Return whether a single icinga instance is writing to the given resource
  *
  * @param   Form            $form
  * @param   ConfigObject    $resourceConfig
  *
  * @return  bool                                True if it's a single instance, false if none
  *                                              or multiple instances are writing to it
  */
 public static function isValidIdoInstance(Form $form, ConfigObject $resourceConfig)
 {
     $db = ResourceFactory::createResource($resourceConfig);
     $rowCount = $db->select()->from('icinga_instances')->count();
     if ($rowCount === 0) {
         $form->warning($form->translate('There is currently no icinga instance writing to the IDO. Make sure ' . 'that a icinga instance is configured and able to write to the IDO.'));
         return false;
     } elseif ($rowCount > 1) {
         $form->warning($form->translate('There is currently more than one icinga instance writing to the IDO. You\'ll see all objects from all' . ' instances without any differentation. If this is not desired, consider setting up a separate IDO' . ' for each instance.'));
         return false;
     }
     return true;
 }
开发者ID:bebehei,项目名称:icingaweb2,代码行数:22,代码来源:BackendConfigForm.php

示例2: isValidIdoInstance

 /**
  * Validate the ido instance availability
  *
  * @param   Form            $form
  * @param   ConfigObject    $resourceConfig
  *
  * @return  bool                                Whether validation succeeded or not
  */
 public static function isValidIdoInstance(Form $form, ConfigObject $resourceConfig)
 {
     $resource = ResourceFactory::createResource($resourceConfig);
     $result = $resource->select()->from('icinga_instances', array('instance_name'));
     $instances = $result->fetchAll();
     if (count($instances) === 1) {
         return true;
     } elseif (count($instances) > 1) {
         $form->warning($form->translate('IDO instance validation failed, because there are multiple instances available.'));
         return false;
     }
     $form->error($form->translate('IDO instance validation failed, because there is no IDO instance available.'));
     return false;
 }
开发者ID:xert,项目名称:icingaweb2,代码行数:22,代码来源:BackendConfigForm.php


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