function SurveyDetails() { $params = $this->owner->request->allParams(); $deployment_id = intval(Convert::raw2sql($params["ID"])); $range = Session::get("global_survey_range"); //get survey version if (!empty($range) && $range === SurveyType::FALL_2015) { $survey = Survey::get()->byID($deployment_id); if ($survey->ClassName === 'EntitySurvey') { $survey = EntitySurvey::get()->byID($deployment_id); } } else { $survey = DeploymentSurvey::get()->byID($deployment_id); } if ($survey) { $back_url = $this->owner->request->getVar('BackUrl'); if ($survey instanceof Survey) { $details_template = 'SangriaPage_SurveyBuilderSurveyDetails'; $data = array("Survey" => $survey, "BackUrl" => $back_url); } else { $details_template = $survey->getSurveyType() == SurveyType::OLD ? "SangriaPage_SurveyDetailsOld" : "SangriaPage_SurveyDetails"; $data = array("Survey" => $survey, "BackUrl" => $back_url); } if (empty($back_url)) { $back_url = "#"; } return $this->owner->Customise($data)->renderWith(array($details_template, 'SangriaPage', 'SangriaPage')); } return $this->owner->httpError(404, 'Sorry that Survey could not be found!.'); }
/** * @param ISurvey $parent * @param IEntitySurveyTemplate $template * @param $owner * @return EntitySurvey */ public function buildEntitySurvey(ISurvey $parent, IEntitySurveyTemplate $template, $owner) { $survey = new EntitySurvey(); $survey->TemplateID = $template->getIdentifier(); $survey->CreatedByID = $owner->getIdentifier(); $survey->ParentID = $parent->getIdentifier(); $i = 0; foreach ($template->getSteps() as $step_template) { ++$i; $new_step = $this->buildStep($step_template); $survey->addStep($new_step); if ($i == 1) { $survey->registerCurrentStep($new_step); $survey->registerAllowedMaxStep($new_step); } } return $survey; }
public function DeploymentDetails(SS_HTTPRequest $request) { $params = $request->allParams(); $deployment_id = intval(Convert::raw2sql($params["ID"])); //get survey version $deployment = Survey::get()->byID($deployment_id); if ($deployment->ClassName === 'EntitySurvey') { $deployment = EntitySurvey::get()->byID($deployment_id); } if (!$deployment) { return $this->owner->httpError(404, 'Sorry that Deployment could not be found!.'); } $back_url = $request->getVar('BackUrl'); if (empty($back_url)) { $back_url = $this->owner->Link("ViewDeploymentDetails"); } $data = ["Name" => 'Deployment', "Survey" => $deployment, "BackUrl" => $back_url]; return $this->owner->Customise($data)->renderWith(array('SangriaPage_SurveyBuilderSurveyDetails', 'SangriaPage', 'SangriaPage')); }