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


PHP Form::getValues方法代码示例

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


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

示例1: isValidResource

 /**
  * Validate the resource configuration by trying to connect with it
  *
  * @param   Form    $form   The form to fetch the configuration values from
  *
  * @return  bool            Whether validation succeeded or not
  */
 public static function isValidResource(Form $form)
 {
     $result = ResourceFactory::createResource(new ConfigObject($form->getValues()))->inspect();
     if ($result->hasError()) {
         $form->addError(sprintf('%s (%s)', $form->translate('Connectivity validation failed, connection to the given resource not possible.'), $result->getError()));
     }
     // TODO: display diagnostics in $result->toArray() to the user
     return !$result->hasError();
 }
开发者ID:bebehei,项目名称:icingaweb2,代码行数:16,代码来源:LdapResourceForm.php

示例2: getValues

 /**
  * {@inheritdoc}
  *
  * Values from subforms are directly added to the returned values array instead of being grouped by the subforms'
  * names.
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues($suppressArrayNotation);
     foreach (array_keys($this->_subForms) as $name) {
         // Zend returns values from subforms grouped by their names, but we want them flat
         $values = array_merge($values, $values[$name]);
         unset($values[$name]);
     }
     return $values;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:16,代码来源:ConfigForm.php

示例3: getValues

 /**
  * {@inheritdoc}
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues($suppressArrayNotation);
     if (isset($values['url']) && $values['url']) {
         $url = Url::fromPath($values['url']);
         if (!$url->isExternal() && ($relativePath = $url->getRelativeUrl())) {
             $values['url'] = $relativePath;
         }
     }
     return $values;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:14,代码来源:NavigationItemForm.php

示例4: getValues

 /**
  * {@inheritdoc}
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues($suppressArrayNotation);
     if ($values['themes_default'] === '' || $values['themes_default'] === StyleSheet::DEFAULT_THEME) {
         $values['themes_default'] = null;
     }
     if (!$values['themes_disabled']) {
         $values['themes_disabled'] = null;
     }
     return $values;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:14,代码来源:ThemingConfigForm.php

示例5: isValidResource

 /**
  * Validate the resource configuration by trying to connect with it
  *
  * @param   Form    $form   The form to fetch the configuration values from
  *
  * @return  bool            Whether validation succeeded or not
  */
 public static function isValidResource(Form $form)
 {
     try {
         $resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
         $resource->getConnection()->getConnection();
     } catch (Exception $e) {
         $form->addError($form->translate('Connectivity validation failed, connection to the given resource not possible.'));
         return false;
     }
     return true;
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:18,代码来源:DbResourceForm.php

示例6: getValues

 /**
  * {@inheritdoc}
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues($suppressArrayNotation);
     if ($values['themes_default'] === 'Icinga') {
         $values['themes_default'] = null;
     }
     if (!$values['themes_disabled']) {
         $values['themes_disabled'] = null;
     }
     return $values;
 }
开发者ID:CheggEng,项目名称:icingaweb2,代码行数:14,代码来源:ThemingConfigForm.php

示例7: getValues

 /**
  * {@inheritdoc}
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues($suppressArrayNotation);
     if (isset($values['url']) && $values['url']) {
         $url = Url::fromPath($values['url']);
         if ($url->getBasePath() === $this->getRequest()->getBasePath()) {
             $values['url'] = $url->getRelativeUrl();
         } else {
             $values['url'] = $url->getAbsoluteUrl();
         }
     }
     return $values;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:16,代码来源:NavigationItemForm.php

示例8: isValidResource

 /**
  * Validate the resource configuration by trying to connect with it
  *
  * @param   Form    $form   The form to fetch the configuration values from
  *
  * @return  bool            Whether validation succeeded or not
  */
 public static function isValidResource(Form $form)
 {
     try {
         $resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
         $resource->bind();
     } catch (Exception $e) {
         $msg = $form->translate('Connectivity validation failed, connection to the given resource not possible.');
         if ($error = $e->getMessage()) {
             $msg .= ' (' . $error . ')';
         }
         $form->addError($msg);
         return false;
     }
     return true;
 }
开发者ID:kain64,项目名称:icingaweb2,代码行数:22,代码来源:LdapResourceForm.php

示例9: isValidUserBackend

 /**
  * Validate the configuration by creating a backend and requesting the user count
  *
  * @param   Form    $form   The form to fetch the configuration values from
  *
  * @return  bool            Whether validation succeeded or not
  */
 public static function isValidUserBackend(Form $form)
 {
     try {
         $ldapUserBackend = UserBackend::create(null, new ConfigObject($form->getValues()));
         $ldapUserBackend->assertAuthenticationPossible();
     } catch (AuthenticationException $e) {
         if (($previous = $e->getPrevious()) !== null) {
             $form->addError($previous->getMessage());
         } else {
             $form->addError($e->getMessage());
         }
         return false;
     } catch (Exception $e) {
         $form->addError(sprintf($form->translate('Unable to validate authentication: %s'), $e->getMessage()));
         return false;
     }
     return true;
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:25,代码来源:LdapBackendForm.php

示例10: inspectResource

 /**
  * Create a resource by using the given form's values and return its inspection results
  *
  * @param   Form    $form
  *
  * @return  Inspection
  */
 public static function inspectResource(Form $form)
 {
     if ($form->getValue('type') !== 'ssh') {
         $resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
         if ($resource instanceof Inspectable) {
             return $resource->inspect();
         }
     }
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:16,代码来源:ResourceConfigForm.php

示例11: getValues

 /**
  * Retrieve all form element values
  *
  * @param   bool    $suppressArrayNotation  Ignored
  *
  * @return  array
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues();
     $values = array_merge($values, $values['backend_form']);
     unset($values['backend_form']);
     return $values;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:14,代码来源:AuthBackendPage.php

示例12: inspectUserBackend

 /**
  * Create a user backend by using the given form's values and return its inspection results
  *
  * Returns null for non-inspectable backends.
  *
  * @param   Form    $form
  *
  * @return  Inspection|null
  */
 public static function inspectUserBackend(Form $form)
 {
     $backend = UserBackend::create(null, new ConfigObject($form->getValues()));
     if ($backend instanceof Inspectable) {
         return $backend->inspect();
     }
 }
开发者ID:scibi,项目名称:icingaweb2,代码行数:16,代码来源:UserBackendConfigForm.php

示例13: isValidUserBackend

 /**
  * Validate the configuration by creating a backend and requesting the user count
  *
  * @param   Form    $form   The form to fetch the configuration values from
  *
  * @return  bool            Whether validation succeeded or not
  */
 public static function isValidUserBackend(Form $form)
 {
     /**
      * @var $result Inspection
      */
     $result = UserBackend::create(null, new ConfigObject($form->getValues()))->inspect();
     if ($result->hasError()) {
         $form->addError($result->getError());
     }
     // TODO: display diagnostics in $result->toArray() to the user
     return !$result->hasError();
 }
开发者ID:bebehei,项目名称:icingaweb2,代码行数:19,代码来源:LdapBackendForm.php


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