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


PHP Survey::setAllowedLanguages方法代碼示例

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


在下文中一共展示了Survey::setAllowedLanguages方法的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: showEditSettingsLanguageRes

 function showEditSettingsLanguageRes()
 {
     $_SESSION['EDITSURVEY'] = 1;
     $displaySysAdmin = new DisplaySysAdmin();
     $survey = new Survey($_SESSION['SUID']);
     $ans = loadvar(SETTING_ALLOWED_LANGUAGES);
     if (!is_array($ans)) {
         $ans = array($ans);
     }
     if (!inArray(loadvar(SETTING_DEFAULT_LANGUAGE), $ans)) {
         $content = $displaySysAdmin->displayError(Language::messageLanguageSettingsNotChanged());
     } else {
         $current = explode("~", $survey->getAllowedLanguages(getSurveyMode()));
         $survey->setDefaultLanguage(loadvar(SETTING_DEFAULT_LANGUAGE));
         $survey->setChangeLanguage(loadvar(SETTING_CHANGE_LANGUAGE));
         $survey->setReentryLanguage(loadvar(SETTING_REENTRY_LANGUAGE));
         $survey->setBackLanguage(loadvar(SETTING_BACK_LANGUAGE));
         $survey->setAllowedLanguages(implode("~", $ans));
         $users = new Users();
         $users = $users->getUsers();
         $update = loadvar("uridsel");
         foreach ($users as $u) {
             foreach ($current as $c) {
                 if (!inArray($c, $ans)) {
                     $u->removeLanguage($_SESSION['SUID'], getSurveyMode(), $c);
                 }
             }
             foreach ($ans as $a) {
                 if (!inArray($a, $current)) {
                     if (inArray($u->getUrid(), $update) || inArray(-1, $update)) {
                         $u->addLanguage($_SESSION['SUID'], getSurveyMode(), $a);
                     }
                 }
             }
             $u->saveChanges();
         }
         $content = $displaySysAdmin->displaySuccess(Language::messageLanguageSettingsChanged());
         if (!inArray(getSurveyLanguage(), $ans)) {
             $_SESSION['SURVEY_LANGUAGE'] = $ans[0];
         }
     }
     /* update last page */
     $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
     return $displaySysAdmin->showEditSettingsLanguage($content);
 }
開發者ID:nubissurveying,項目名稱:nubis,代碼行數:45,代碼來源:sysadmin.php


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