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


PHP Survey::setDefaultSurvey方法代碼示例

本文整理匯總了PHP中Survey::setDefaultSurvey方法的典型用法代碼示例。如果您正苦於以下問題:PHP Survey::setDefaultSurvey方法的具體用法?PHP Survey::setDefaultSurvey怎麽用?PHP Survey::setDefaultSurvey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Survey的用法示例。


在下文中一共展示了Survey::setDefaultSurvey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: convertSurveys

         }
     }
     /* convert */
     $this->convertSurveys();
     // return result
     return "";
 }
 function convertSurveys()
 {
     $query = "select * from " . $this->sourcetable . "_surveys order by syid";
     if (!($res = $this->importdb->selectQuery($query))) {
         $query = "select * from " . $this->sourcetable . "_survey order by syid";
         $res = $this->importdb->selectQuery($query);
     }
     if ($res) {
         if ($this->importdb->getNumberOfRows($res) > 0) {
             $user = new User($_SESSION['URID']);
             while ($row = $this->importdb->getRow($res)) {
                 $this->suid = $row["syid"] + $this->addtosuid;
                 $this->syid = $row["syid"];
                 $this->convertSurveySettings($row);
                 // get languages
                 $survey = new Survey($this->suid);
                 $this->languages = explode("~", $survey->getAllowedLanguages(MODE_CASI));
                 $this->convertSections();
                 $this->convertVariables();
                 $this->convertTemplates();
                 $this->convertTypes();
                 $this->convertRouting();
                 // if first survey in project, then set as default survey
                 $surveys = new Surveys();
                 $surveys = $surveys->getSurveys();
                 if (sizeof($surveys) == 1) {
                     $survey->setDefaultSurvey(DEFAULT_SURVEY_YES);
                 }
                 // update allowed modes
                 $survey->setAllowedModes(MODE_CASI);
                 // update allowed languages
                 $survey->setAllowedLanguages(implode("~", $this->languages));
                 // update access of user doing the import
                 $mods = explode("~", $survey->getAllowedModes());
                 foreach ($mods as $m) {
開發者ID:nubissurveying,項目名稱:nubis,代碼行數:42,代碼來源:importer.php

示例2: showEditSurveyRes


//.........這裏部分代碼省略.........
             $var->setShowBackButton(BUTTON_NO);
             $var->setShowNextButton(BUTTON_YES);
             $var->setShowRFButton(BUTTON_NO);
             $var->setShowDKButton(BUTTON_NO);
             $var->setShowNAButton(BUTTON_NO);
             $var->setShowUpdateButton(BUTTON_NO);
             $var->setShowRemarkButton(BUTTON_NO);
             $var->setShowProgressBar(PROGRESSBAR_NO);
             $var->setHidden(HIDDEN_YES);
             $var->setTyd(-1);
             $var->setPosition(15);
             $var->save();
             $var = new VariableDescriptive();
             $var->setVsid(16);
             $var->setName(VARIABLE_CLOSED);
             $var->setAnswerType(ANSWER_TYPE_NONE);
             $var->setSeid(1);
             $var->setSuid($newsuid);
             $var->setDescription('CLOSED SCREEN');
             $var->setQuestion(Language::messageSurveyClosed());
             $var->setShowBackButton(BUTTON_NO);
             $var->setShowNextButton(BUTTON_NO);
             $var->setShowRFButton(BUTTON_NO);
             $var->setShowDKButton(BUTTON_NO);
             $var->setShowNAButton(BUTTON_NO);
             $var->setShowUpdateButton(BUTTON_NO);
             $var->setShowRemarkButton(BUTTON_NO);
             $var->setShowProgressBar(PROGRESSBAR_NO);
             $var->setHidden(HIDDEN_YES);
             $var->setTyd(-1);
             $var->setPosition(16);
             $var->save();
             $var = new VariableDescriptive();
             $var->setVsid(17);
             $var->setName(VARIABLE_EXECUTION_MODE);
             $var->setAnswerType(ANSWER_TYPE_ENUMERATED);
             $var->setSeid(1);
             $var->setSuid($newsuid);
             $var->setDescription('EXECUTION MODE');
             $var->setQuestion("execution mode");
             $var->setOptionsText("0 (NORMAL) Normal mode\r\n1 (TEST) Test mode");
             $var->setShowBackButton(BUTTON_NO);
             $var->setShowNextButton(BUTTON_NO);
             $var->setShowRFButton(BUTTON_NO);
             $var->setShowDKButton(BUTTON_NO);
             $var->setShowNAButton(BUTTON_NO);
             $var->setShowUpdateButton(BUTTON_NO);
             $var->setShowProgressBar(PROGRESSBAR_NO);
             $var->setHidden(HIDDEN_YES);
             $var->setTyd(-1);
             $var->setPosition(17);
             $var->save();
             /* update current user for access */
             $surv = new Survey($newsuid);
             $user = new User($_SESSION['URID']);
             $mods = explode("~", $surv->getAllowedModes());
             foreach ($mods as $m) {
                 $user->setLanguages($newsuid, $m, $surv->getAllowedLanguages($m));
             }
             $user->saveChanges();
             $content = $displaySysAdmin->displaySuccess(Language::messageSurveyAdded(loadvar('name')));
         }
     }
     //ADD ALL SORTS OF CHECKS!!
     if ($suid != '' || loadvar('name') != "") {
         $survey->setName(loadvar('name'));
         $survey->setDescription(loadvar(SETTING_DESCRIPTION));
         $survey->setTitle(loadvar(SETTING_TITLE));
         $survey->setDefaultSurvey(loadvar(SETTING_DEFAULT_SURVEY));
         $survey->save();
         // default, then update setting and set all others to no
         $surveys = new Surveys();
         $surveys = $surveys->getSurveys();
         if (loadvar(SETTING_DEFAULT_SURVEY) == DEFAULT_SURVEY_YES) {
             if (sizeof($surveys) == 1) {
                 $survey->setDefaultSurvey(DEFAULT_SURVEY_YES);
             } else {
                 foreach ($surveys as $s) {
                     if ($s->getSuid() != $survey->getSuid()) {
                         $s->setDefaultSurvey(DEFAULT_SURVEY_NO);
                     } else {
                         $s->setDefaultSurvey(DEFAULT_SURVEY_YES);
                     }
                 }
             }
         } else {
             // if only one survey, make sure we set this one to default
             if (sizeof($surveys) == 1) {
                 $survey->setDefaultSurvey(DEFAULT_SURVEY_YES);
             }
         }
     }
     /* update last page */
     $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
     if ($suid != '') {
         return $displaySysAdmin->showEditSurvey($_SESSION['SUID'], $content);
     } else {
         return $displaySysAdmin->showSurveys($content);
     }
 }
開發者ID:nubissurveying,項目名稱:nubis,代碼行數:101,代碼來源:sysadmin.php


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