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


PHP CRM_Core_Form::validate方法代码示例

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


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

示例1: perform

 /**
  * Processes the request.
  *
  * @param CRM_Core_Form $page
  *   The current form-page.
  * @param string $actionName
  *   Current action name, as one Action object can serve multiple actions.
  *
  * @return void
  */
 public function perform(&$page, $actionName)
 {
     // save the form values and validation status to the session
     $page->isFormBuilt() or $page->buildForm();
     $pageName = $page->getAttribute('name');
     $data =& $page->controller->container();
     $data['values'][$pageName] = $page->exportValues();
     $data['valid'][$pageName] = $page->validate();
     // Modal form and page is invalid: don't go further
     if ($page->controller->isModal() && !$data['valid'][$pageName]) {
         return $page->handle('display');
     }
     // the page is valid, process it before we jump to the next state
     $page->mainProcess();
     return $page->handle('jump');
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:26,代码来源:Refresh.php

示例2: perform

 /**
  * Processes the request.
  * this is basically a self submit, so validate the page
  * and if success, call post process
  * when done processing pop to user context
  *
  * @param CRM_Core_Form $page
  *   The current form-page.
  * @param string $actionName
  *   Current action name, as one Action object can serve multiple actions.
  *
  * @return object|void
  */
 public function perform(&$page, $actionName)
 {
     $page->isFormBuilt() or $page->buildForm();
     $pageName = $page->getAttribute('name');
     $data =& $page->controller->container();
     $data['values'][$pageName] = $page->exportValues();
     $data['valid'][$pageName] = $page->validate();
     // Modal form and page is invalid: don't go further
     if ($page->controller->isModal() && !$data['valid'][$pageName]) {
         return $page->handle('display');
     }
     // the page is valid, process it before we jump to the next state
     $page->mainProcess();
     // ok so we are done now, pop stack and jump back to where we came from
     // we do not reset the context because u can achieve that affect using next
     // use Done when u want to pop back to the same context without a reset
     $this->popUserContext();
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:31,代码来源:Done.php

示例3: perform

 /**
  * Processes the request.
  *
  * @param CRM_Core_Form $page
  *   CRM_Core_Form the current form-page.
  * @param string $actionName
  *   Current action name, as one Action object can serve multiple actions.
  *
  * @return void
  */
 public function perform(&$page, $actionName)
 {
     $page->isFormBuilt() or $page->buildForm();
     $pageName = $page->getAttribute('name');
     $data =& $page->controller->container();
     $data['values'][$pageName] = $page->exportValues();
     $data['valid'][$pageName] = $page->validate();
     // Modal form and page is invalid: don't go further
     if ($page->controller->isModal() && !$data['valid'][$pageName]) {
         return $page->handle('display');
     }
     // the page is valid, process it before we jump to the next state
     $page->mainProcess();
     // check if destination is set, if so goto destination
     $destination = $this->_stateMachine->getDestination();
     if ($destination) {
         $destination = urldecode($destination);
         CRM_Utils_System::redirect($destination);
     } else {
         return $page->handle('display');
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:32,代码来源:Submit.php

示例4: perform

 /**
  * Do a state transition jump.
  *
  * Currently only supported types are
  * Next and Back. The other actions (Cancel, Done, Submit etc) do
  * not need the state machine to figure out where to go
  *
  * @param CRM_Core_Form $page
  *   The current form-page.
  * @param string $actionName
  *   Current action name, as one Action object can serve multiple actions.
  * @param string $type
  *   The type of transition being requested (Next or Back).
  *
  * @return object
  */
 public function perform(&$page, $actionName, $type = 'Next')
 {
     // save the form values and validation status to the session
     $page->isFormBuilt() or $page->buildForm();
     $pageName = $page->getAttribute('name');
     $data =& $page->controller->container();
     $data['values'][$pageName] = $page->exportValues();
     $data['valid'][$pageName] = $page->validate();
     // if we are going to the next state
     // Modal form and page is invalid: don't go further
     if ($type == 'Next' && !$data['valid'][$pageName]) {
         return $page->handle('display');
     }
     $state =& $this->_states[$pageName];
     // dont know how or why we landed here so abort and display
     // current page
     if (empty($state)) {
         return $page->handle('display');
     }
     // the page is valid, process it if we are jumping to the next state
     if ($type == 'Next') {
         $page->mainProcess();
         // we get the state again, since postProcess might have changed it
         // this bug took me forever to find :) Lobo
         $state =& $this->_states[$pageName];
         $state->handleNextState($page);
     } else {
         $state->handleBackState($page);
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:46,代码来源:StateMachine.php

示例5: perform

 /**
  * Processes the request.
  *
  * @param CRM_Core_Form $page
  *   CRM_Core_Form the current form-page.
  * @param string $actionName
  *   Current action name, as one Action object can serve multiple actions.
  *
  * @return object|void
  */
 public function perform(&$page, $actionName)
 {
     $pageName = $page->getAttribute('id');
     // If the original action was 'display' and we have values in container then we load them
     // BTW, if the page was invalid, we should later call validate() to get the errors
     list(, $oldName) = $page->controller->getActionName();
     if ('display' == $oldName) {
         // If the controller is "modal" we should not allow direct access to a page
         // unless all previous pages are valid (see also bug #2323)
         if ($page->controller->isModal() && !$page->controller->isValid($page->getAttribute('id'))) {
             $target =& $page->controller->getPage($page->controller->findInvalid());
             return $target->handle('jump');
         }
         $data =& $page->controller->container();
         if (!empty($data['values'][$pageName])) {
             $page->loadValues($data['values'][$pageName]);
             $validate = FALSE === $data['valid'][$pageName];
         }
     }
     // set "common" defaults and constants
     $page->controller->applyDefaults($pageName);
     $page->isFormBuilt() or $page->buildForm();
     // if we had errors we should show them again
     if (isset($validate) && $validate) {
         $page->validate();
     }
     //will this work generally as TRUE (i.e., return output)
     //was default, i.e., FALSE
     return $this->renderForm($page);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:40,代码来源:Display.php

示例6: realPerform

 /**
  * @param CRM_Core_Form $page
  * @param $actionName
  *
  * @return mixed
  */
 function realPerform(&$page, $actionName)
 {
     $pageName = $page->getAttribute('name');
     $data =& $page->controller->container();
     $data['values'][$pageName] = $page->exportValues();
     $data['valid'][$pageName] = $page->validate();
     if (!$data['valid'][$pageName]) {
         return $page->handle('display');
     }
     foreach ($this->_uploadNames as $name) {
         $this->upload($page, $data, $pageName, $name);
     }
     $state =& $this->_stateMachine->getState($pageName);
     if (empty($state)) {
         return $page->handle('display');
     }
     // the page is valid, process it before we jump to the next state
     $page->mainProcess();
     // check if destination is set, if so goto destination
     $destination = $this->_stateMachine->getDestination();
     if ($destination) {
         $destination = urldecode($destination);
         CRM_Utils_System::redirect($destination);
     } else {
         return $state->handleNextState($page);
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:33,代码来源:Upload.php

示例7: validate

 /**
  * form validate function => check date order
  */
 public function validate()
 {
     $error = parent::validate();
     $values = $this->exportValues();
     $normalise = CRM_Core_BAO_Setting::getItem('CiviBanking', 'reference_normalisation');
     $validate = CRM_Core_BAO_Setting::getItem('CiviBanking', 'reference_validation');
     if (!empty($values['reference_type']) && !empty($values['reference'])) {
         if ($validate || $normalise) {
             // verify/normalise reference
             $query = civicrm_api3('BankingAccountReference', 'check', array('reference_type' => (int) $values['reference_type'], 'reference' => $values['reference']));
             $result = $query['values'];
             if ($validate && $result['checked'] && !$result['is_valid']) {
                 $this->_errors['reference'] = ts("Invalid reference.");
                 CRM_Core_Session::setStatus(ts("Invalid reference '%1'", array(1 => $values['reference'])), ts('Failure'));
             } elseif ($normalise && $result['normalised']) {
                 $values['reference'] = $result['reference'];
                 $this->set('reference', $result['reference']);
             }
         }
     }
     if (0 == count($this->_errors)) {
         return TRUE;
     } else {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=2&selectedChild=bank_accounts"));
         return FALSE;
     }
 }
开发者ID:VangelisP,项目名称:org.project60.banking,代码行数:30,代码来源:AccountsTab.php

示例8: validate

 function validate()
 {
     parent::validate();
     $values = $this->exportValues();
     if ($values['volunteer_general_campaign_filter_type'] == "whitelist" && empty($values['volunteer_general_campaign_filter_list'])) {
         CRM_Core_Session::setStatus(ts("Your whitelist of campaign types is empty. As a result, no campaigns will be available for Volunteer Projects.", array('domain' => 'org.civicrm.volunteer')), "Warning", "warning");
     }
     return TRUE;
 }
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:9,代码来源:Settings.php

示例9: validate

 /**
  * Validates the user submission.
  *
  * Overrides the default validation, ignoring validation errors on additional
  * volunteers.
  *
  * @return boolean
  *   Returns TRUE if no errors found.
  */
 function validate()
 {
     parent::validate();
     foreach ($this->_errors as $name => $msg) {
         if (substr($name, 0, strlen("additionalVolunteersTemplate")) == "additionalVolunteersTemplate") {
             unset($this->_errors[$name]);
         }
     }
     return 0 == count($this->_errors);
 }
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:19,代码来源:VolunteerSignUp.php


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