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


PHP Form::isValid方法代碼示例

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


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

示例1: isValid

 /**
  * Validate the given form data and check whether the wizard's requirements are fulfilled
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     return $this->wizard->getRequirements()->fulfilled();
 }
開發者ID:kobmaki,項目名稱:icingaweb2,代碼行數:14,代碼來源:RequirementsPage.php

示例2: isValid

 /**
  * Validate the given form data and check whether a BIND-request is successful
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     return true;
 }
開發者ID:kobmaki,項目名稱:icingaweb2,代碼行數:14,代碼來源:LdapDiscoveryConfirmPage.php

示例3: isValidPartial

 /**
  * Run the configured backend's inspection checks and show the result, if necessary
  *
  * This will only run any validation if the user pushed the 'backend_validation' button.
  *
  * @param   array   $formData
  *
  * @return  bool
  */
 public function isValidPartial(array $formData)
 {
     if (isset($formData['backend_validation']) && parent::isValid($formData)) {
         if (!$this->validateConfiguration(true)) {
             return false;
         }
         $this->info($this->translate('The configuration has been successfully validated.'));
     } elseif (!isset($formData['backend_validation'])) {
         // This is usually done by isValid(Partial), but as we're not calling any of these...
         $this->populate($formData);
     }
     return true;
 }
開發者ID:0svald,項目名稱:icingaweb2,代碼行數:22,代碼來源:IdoResourcePage.php

示例4: isValid

 /**
  * Validate the given form data and check whether a BIND-request is successful
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
         if (false === LdapResourceForm::isValidResource($this)) {
             $this->addSkipValidationCheckbox();
             return false;
         }
     }
     return true;
 }
開發者ID:hsanjuan,項目名稱:icingaweb2,代碼行數:20,代碼來源:LdapResourcePage.php

示例5: isValidPartial

 /**
  * Check whether it's possible to connect to the database server
  *
  * This will only run the check if the user pushed the 'backend_validation' button.
  *
  * @param   array   $formData
  *
  * @return  bool
  */
 public function isValidPartial(array $formData)
 {
     if (isset($formData['backend_validation']) && parent::isValid($formData)) {
         try {
             $db = new DbTool($this->getValues());
             $db->checkConnectivity();
         } catch (PDOException $e) {
             $this->warning(sprintf($this->translate('Failed to successfully validate the configuration: %s'), $e->getMessage()));
             return false;
         }
         $this->info($this->translate('The configuration has been successfully validated.'));
     }
     return true;
 }
開發者ID:scibi,項目名稱:icingaweb2,代碼行數:23,代碼來源:DbResourcePage.php

示例6: isValid

 /**
  * {@inheritdoc}
  */
 public function isValid($formData)
 {
     $valid = parent::isValid($formData);
     if (!$valid) {
         return false;
     }
     $oldPasswordEl = $this->getElement('old_password');
     if (!$this->backend->authenticate($this->Auth()->getUser(), $oldPasswordEl->getValue())) {
         $oldPasswordEl->addError($this->translate('Old password is invalid'));
         $this->markAsError();
         return false;
     }
     return true;
 }
開發者ID:0svald,項目名稱:icingaweb2,代碼行數:17,代碼來源:ChangePasswordForm.php

示例7: isValid

 /**
  * Return whether the given values are valid
  *
  * @param   array   $formData   The data to validate
  *
  * @return  bool
  */
 public function isValid($formData)
 {
     if (!parent::isValid($formData)) {
         return false;
     }
     if (!isset($formData['skip_validation']) || !$formData['skip_validation']) {
         $configObject = new ConfigObject($this->getValues());
         if (!DbResourceForm::isValidResource($this, $configObject)) {
             $this->addSkipValidationCheckbox($this->translate('Check this to not to validate connectivity with the given database server.'));
             return false;
         } elseif (!BackendConfigForm::isValidIdoSchema($this, $configObject) || !BackendConfigForm::isValidIdoInstance($this, $configObject)) {
             $this->addSkipValidationCheckbox($this->translate('Check this to not to validate the IDO schema in the given database.'));
             return false;
         }
     }
     return true;
 }
開發者ID:hsanjuan,項目名稱:icingaweb2,代碼行數:24,代碼來源:IdoResourcePage.php

示例8: isValid

 /**
  * Validate the given form data and check whether it's possible to connect to the database server
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
         try {
             $db = new DbTool($this->getValues());
             $db->checkConnectivity();
         } catch (PDOException $e) {
             $this->addError($e->getMessage());
             $this->addSkipValidationCheckbox();
             return false;
         }
     }
     return true;
 }
開發者ID:xert,項目名稱:icingaweb2,代碼行數:24,代碼來源:DbResourcePage.php

示例9: isValidPartial

 /**
  * Run the configured backend's inspection checks and show the result, if necessary
  *
  * This will only run any validation if the user pushed the 'backend_validation' button.
  *
  * @param   array   $formData
  *
  * @return  bool
  */
 public function isValidPartial(array $formData)
 {
     if (isset($formData['backend_validation']) && parent::isValid($formData)) {
         $inspection = ResourceConfigForm::inspectResource($this);
         if ($inspection !== null) {
             $join = function ($e) use(&$join) {
                 return is_string($e) ? $e : join("\n", array_map($join, $e));
             };
             $this->addElement('note', 'inspection_output', array('order' => 0, 'value' => '<strong>' . $this->translate('Validation Log') . "</strong>\n\n" . join("\n", array_map($join, $inspection->toArray())), 'decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'pre', 'class' => 'log-output')))));
             if ($inspection->hasError()) {
                 $this->warning(sprintf($this->translate('Failed to successfully validate the configuration: %s'), $inspection->getError()));
                 return false;
             }
         }
         $this->info($this->translate('The configuration has been successfully validated.'));
     }
     return true;
 }
開發者ID:scibi,項目名稱:icingaweb2,代碼行數:27,代碼來源:IdoResourcePage.php

示例10: isValid

 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
         $configObject = new ConfigObject($this->getValues());
         if (false === DbResourceForm::isValidResource($this, $configObject)) {
             $this->addSkipValidationCheckbox($this->translate('Check this to not to validate connectivity with the given database server'));
             return false;
         } elseif (false === BackendConfigForm::isValidIdoSchema($this, $configObject)) {
             $this->addSkipValidationCheckbox($this->translate('Check this to not to validate the ido schema'));
             return false;
         } elseif (false === BackendConfigForm::isValidIdoInstance($this, $configObject)) {
             $this->addSkipValidationCheckbox($this->translate('Check this to not to validate the ido instance'));
             return false;
         }
     }
     return true;
 }
開發者ID:xert,項目名稱:icingaweb2,代碼行數:20,代碼來源:IdoResourcePage.php

示例11: isValid

 /**
  * Validate the given form data and check whether a BIND-request is successful
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if (isset($data['skip_validation']) && $data['skip_validation']) {
         return true;
     }
     if (isset($data['domain']) && $data['domain']) {
         try {
             $this->discovery = Discovery::discoverDomain($data['domain']);
             if ($this->discovery->isSuccess()) {
                 return true;
             }
         } catch (Exception $e) {
         }
         $this->error(sprintf($this->translate('Could not find any LDAP servers on the domain "%s".'), $data['domain']));
     } else {
         $labeller = new ErrorLabeller(array('element' => $this->getElement('domain')));
         $this->getElement('domain')->addError($labeller->translate(Zend_Validate_NotEmpty::IS_EMPTY));
     }
     return false;
 }
開發者ID:kobmaki,項目名稱:icingaweb2,代碼行數:30,代碼來源:LdapDiscoveryPage.php

示例12: isValid

 /**
  * Validate the given request data and ensure that any new user does not already exist
  *
  * @param   array   $data   The request data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if ($data['user_type'] === 'new_user' && !$this->hasUser($data['new_user'])) {
         $this->getElement('new_user')->addError($this->translate('Username already exists.'));
         return false;
     }
     return true;
 }
開發者ID:emilv,項目名稱:icingaweb2,代碼行數:18,代碼來源:AdminAccountPage.php

示例13: isValid

 /**
  * Validate the given form data and check whether the defined user has sufficient access rights
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if (isset($data['skip_validation']) && $data['skip_validation']) {
         return true;
     }
     $config = $this->config;
     $config['username'] = $this->getValue('username');
     $config['password'] = $this->getValue('password');
     $db = new DbTool($config);
     try {
         $db->connectToDb();
         // Are we able to login on the database?
     } catch (PDOException $_) {
         try {
             $db->connectToHost();
             // Are we able to login on the server?
         } catch (PDOException $e) {
             // We are NOT able to login on the server..
             $this->error($e->getMessage());
             $this->addSkipValidationCheckbox();
             return false;
         }
     }
     // In case we are connected the credentials filled into this
     // form need to be granted to create databases, users...
     if (false === $db->checkPrivileges($this->databaseSetupPrivileges)) {
         $this->error($this->translate('The provided credentials cannot be used to create the database and/or the user.'));
         $this->addSkipValidationCheckbox();
         return false;
     }
     // ...and to grant all required usage privileges to others
     if (false === $db->isGrantable($this->databaseUsagePrivileges)) {
         $this->error(sprintf($this->translate('The provided credentials cannot be used to grant all required privileges to the login "%s".'), $this->config['username']));
         $this->addSkipValidationCheckbox();
         return false;
     }
     return true;
 }
開發者ID:0svald,項目名稱:icingaweb2,代碼行數:48,代碼來源:DatabaseCreationPage.php

示例14: isValidPartial

 /**
  * Run the configured backend's inspection checks and show the result, if necessary
  *
  * This will only run any validation if the user pushed the 'backend_validation' button.
  *
  * @param   array   $formData
  *
  * @return  bool
  */
 public function isValidPartial(array $formData)
 {
     if (isset($formData['backend_validation']) && parent::isValid($formData)) {
         $self = clone $this;
         if (($resourceElement = $self->getSubForm('backend_form')->getElement('resource')) !== null) {
             $resourceElement->setIgnore(false);
         }
         $inspection = UserBackendConfigForm::inspectUserBackend($self);
         if ($inspection !== null) {
             $join = function ($e) use(&$join) {
                 return is_string($e) ? $e : join("\n", array_map($join, $e));
             };
             $this->addElement('note', 'inspection_output', array('order' => 0, 'value' => '<strong>' . $this->translate('Validation Log') . "</strong>\n\n" . join("\n", array_map($join, $inspection->toArray())), 'decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'pre', 'class' => 'log-output')))));
             if ($inspection->hasError()) {
                 $this->warning(sprintf($this->translate('Failed to successfully validate the configuration: %s'), $inspection->getError()));
                 return false;
             }
         }
         $this->info($this->translate('The configuration has been successfully validated.'));
     } elseif (!isset($formData['backend_validation'])) {
         // This is usually done by isValid(Partial), but as we're not calling any of these...
         $this->populate($formData);
     }
     return true;
 }
開發者ID:kobmaki,項目名稱:icingaweb2,代碼行數:34,代碼來源:AuthBackendPage.php

示例15: isValid

 /**
  * Validate the given form data and check whether it's possible to authenticate using the configured backend
  *
  * @param   array   $data   The data to validate
  *
  * @return  bool
  */
 public function isValid($data)
 {
     if (false === parent::isValid($data)) {
         return false;
     }
     if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
         $self = clone $this;
         $self->addElement('text', 'resource', array('value' => $this->getResourceConfig()));
         if ($this->config['type'] === 'ldap' && false === LdapBackendForm::isValidUserBackend($self)) {
             $this->addSkipValidationCheckbox();
             return false;
         }
     }
     return true;
 }
開發者ID:xert,項目名稱:icingaweb2,代碼行數:22,代碼來源:AuthBackendPage.php


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