コード例 #1
0
ファイル: SurveyPage.php プロジェクト: Thingee/openstack-org
 /**
  * @param $request
  * @return SS_HTTPResponse
  * @throws NotFoundEntityException
  */
 public function DeleteEntity($request)
 {
     try {
         if (!Member::currentUser()) {
             return $this->httpError(403);
         }
         $step = $request->param('STEP_SLUG');
         $sub_step = $request->param('SUB_STEP_SLUG');
         $entity_survey_id = intval($request->param('ENTITY_SURVEY_ID'));
         $this->current_survey = $this->getCurrentSurveyInstance();
         $current_step = $this->current_survey->currentStep();
         if (!$current_step instanceof ISurveyDynamicEntityStep) {
             if ($this->current_survey->isAllowedStep($step)) {
                 $current_step = $this->current_survey->getStep($step);
                 $this->survey_manager->registerCurrentStep($this->current_survey, $step);
             } else {
                 throw new LogicException(sprintf('template %s', $current_step->template()->title()));
             }
         }
         $this->survey_manager->deleteEntitySurvey($current_step, $entity_survey_id);
         return $this->redirect($this->Link() . $step);
     } catch (Exception $ex) {
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->httpError(404);
     }
 }