/** * @param $data * @param $form * @return SS_HTTPResponse */ public function NextDynamicEntityStep($data, $form) { try { $step = $this->request->param('STEP_SLUG'); if (is_null($step)) { $step = $this->request->requestVar('STEP_SLUG'); } $sub_step = $this->request->param('SUB_STEP_SLUG'); if (is_null($sub_step)) { $sub_step = $this->request->requestVar('SUB_STEP_SLUG'); } $entity_survey = $this->getCurrentEntitySurveyInstance(intval($data['survey_id'])); if (is_null($entity_survey)) { throw new LogicException('entity survey not found!'); } $current_step = $entity_survey->currentStep(); $next_step = $this->survey_manager->completeStep($current_step, $data); if ($entity_survey->isLastStep()) { return $this->redirect($this->Link() . $this->current_survey->currentStep()->template()->title()); } else { return $this->go2DynEntityStep($entity_survey, $next_step); } } catch (Exception $ex) { SS_Log::log($ex->getMessage(), SS_Log::ERR); return $this->httpError(404); } }