本文整理汇总了PHP中Survey::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Survey::get方法的具体用法?PHP Survey::get怎么用?PHP Survey::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Survey
的用法示例。
在下文中一共展示了Survey::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$posts = $this->request->postVars();
$filename = $posts['filename'];
$surveyID = intval($posts['surveyID']);
if (!$filename || !Member::currentUser() || !$surveyID || !($Survey = Survey::get()->filter('ID', $surveyID)->first())) {
return false;
}
$folder = Folder::find_or_make('jsonFormFiles');
$fullFileName = Director::baseFolder() . '/' . $folder->getRelativePath() . $filename . '.json';
$jsonString = '{"name":"' . $Survey->Name . '","startDate": "' . $Survey->StartDate . '", "endDate": "' . $Survey->EndDate . '","sections": [';
foreach ($Survey->Sections() as $Section) {
$jsonString .= '{"Title": "' . $Section->Title . '","Descripton": "' . $Section->Description . '","sectionQuestions": [';
foreach ($Section->SurveyQuestions() as $SQ) {
$jsonString .= '{"number": "' . $SQ->Number . '","title": "' . $SQ->Title . '","description":"' . $SQ->Description . '","helpText": "' . $SQ->HelpText . '","questions": [';
foreach ($SQ->Questions() as $Question) {
$jsonString .= $Question->renderJson();
}
$jsonString = rtrim($jsonString, ",");
$jsonString .= ']},';
}
$jsonString = rtrim($jsonString, ",");
$jsonString .= ']},';
}
$jsonString = rtrim($jsonString, ",");
$jsonString .= ']}';
file_put_contents($fullFileName, $jsonString);
$Survey->LastJsonGenerated = SS_Datetime::now()->getValue();
$Survey->write();
}
示例2: SurveyDetails
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!.');
}
示例3: hasSurveys
/**
* @return bool
*/
public function hasSurveys()
{
return Survey::get()->filter(array('CreatedByID' => $this->getIdentifier()))->count() > 0;
}
示例4: DeploymentDetails
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'));
}