예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 /**
  * 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)
 {
     // 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();
     return $page->handle('display');
 }
예제 #3
0
 /**
  * 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');
 }
예제 #4
0
 /**
  * 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();
 }
예제 #5
0
파일: Jump.php 프로젝트: kidaa30/yes
 /**
  * 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)
 {
     // check whether the page is valid before trying to go to it
     if ($page->controller->isModal()) {
         // we check whether *all* pages up to current are valid
         // if there is an invalid page we go to it, instead of the
         // requested one
         $pageName = $page->getAttribute('id');
         if (!$page->controller->isValid($pageName)) {
             $pageName = $page->controller->findInvalid();
         }
         $current =& $page->controller->getPage($pageName);
     } else {
         $current =& $page;
     }
     // generate the URL for the page 'display' event and redirect to it
     $action = $current->getAttribute('action');
     $url = $action . (FALSE === strpos($action, '?') ? '?' : '&') . $current->getButtonName('display') . '=true' . '&qfKey=' . $page->get('qfKey');
     CRM_Utils_System::redirect($url);
 }
예제 #6
0
 /**
  * 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');
     }
 }
예제 #7
0
 /**
  * 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);
     }
 }
예제 #8
0
 /**
  * @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);
     }
 }