當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Survey::get方法代碼示例

本文整理匯總了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();
 }
開發者ID:helpfulrobot,項目名稱:cbarberis-silverstripe-surveys,代碼行數:30,代碼來源:JsonFileGenerator.php

示例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!.');
 }
開發者ID:Thingee,項目名稱:openstack-org,代碼行數:30,代碼來源:SangriaPageDeploymentExtension.php

示例3: hasSurveys

 /**
  * @return bool
  */
 public function hasSurveys()
 {
     return Survey::get()->filter(array('CreatedByID' => $this->getIdentifier()))->count() > 0;
 }
開發者ID:OpenStackweb,項目名稱:openstack-org,代碼行數:7,代碼來源:FoundationMember.php

示例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'));
 }
開發者ID:OpenStackweb,項目名稱:openstack-org,代碼行數:19,代碼來源:SangriaSurveyBuilderExtension.php


注:本文中的Survey::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。