Exemplo n.º 1
0
 /**
  * Async form Submit
  * @return ResponseSuccess
  */
 public function asyncFormSubmit()
 {
     if (!$this->dc->isSubmitted() && !$this->forceIsSubmitted) {
         return;
     }
     $objResponse = new ResponseSuccess();
     $objResponse->setResult(new ResponseData($this->html, array('id' => $this->dc->getFormId())));
     StatusMessage::reset($this->dc->objModule->id);
     // reset messages after html has been submitted
     return $objResponse;
 }
 protected function redirectAfterSubmission()
 {
     global $objPage;
     $blnRedirect = false;
     $strUrl = \Controller::generateFrontendUrl($objPage->row());
     if (($objTarget = \PageModel::findByPk($this->jumpTo)) !== null) {
         $blnRedirect = true;
         $strUrl = \Controller::generateFrontendUrl($objTarget->row(), null, null, true);
     }
     $arrPreserveParams = trimsplit(',', $this->jumpToPreserveParams);
     foreach ($arrPreserveParams as $strParam) {
         $varValue = \Input::get($strParam);
         if ($varValue === null) {
             continue;
         }
         switch ($strParam) {
             case 'token':
                 if ($this->deactivateTokens) {
                     break;
                 }
                 $strUrl = Url::addQueryString($strParam . '=' . \RequestToken::get(), $strUrl);
                 break;
             default:
                 $strUrl = Url::addQueryString($strParam . '=' . $varValue, $strUrl);
         }
     }
     if ($blnRedirect) {
         \HeimrichHannot\StatusMessages\StatusMessage::reset($this->objModule->id);
     }
     if ($this->async) {
         if ($blnRedirect) {
             $objResponse = new ResponseRedirect();
             $objResponse->setUrl($strUrl);
             $objResponse->output();
         }
         return;
     }
     if (!$blnRedirect) {
         if ($this->getReset()) {
             $this->reset(true);
         }
         return;
     }
     \Controller::redirect($strUrl);
 }