当前位置: 首页>>代码示例>>PHP>>正文


PHP Survey::getAllowedModes方法代码示例

本文整理汇总了PHP中Survey::getAllowedModes方法的典型用法代码示例。如果您正苦于以下问题:PHP Survey::getAllowedModes方法的具体用法?PHP Survey::getAllowedModes怎么用?PHP Survey::getAllowedModes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Survey的用法示例。


在下文中一共展示了Survey::getAllowedModes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: showTest

 function showTest($content = "")
 {
     $returnStr = $this->showToolsHeader(Language::headerToolsTester());
     $returnStr .= $content;
     $surveys = new Surveys();
     $surveys = $surveys->getSurveys();
     if (sizeof($surveys) > 0) {
         $returnStr .= "<form id=refreshform method=post>";
         $returnStr .= '<input type=hidden name=page value="sysadmin.tools.test">';
         $returnStr .= '<input type=hidden name="' . SMS_POST_SURVEY . '" id="' . SMS_POST_SURVEY . '_hidden" value="' . getSurvey() . '">';
         $returnStr .= '<input type=hidden name="' . SMS_POST_MODE . '" id="' . SMS_POST_MODE . '_hidden" value="' . getSurveyMode() . '">';
         $returnStr .= '<input type=hidden name="' . SMS_POST_LANGUAGE . '" id="' . SMS_POST_LANGUAGE . '_hidden" value="' . getSurveyLanguage() . '">';
         $returnStr .= "</form>";
         $returnStr .= "<form method=post>";
         $returnStr .= '<input type=hidden name=' . POST_PARAM_SE . ' value="' . addslashes(USCIC_SURVEY) . '">';
         $returnStr .= '<input type=hidden name=' . POST_PARAM_PRIMKEY . ' value="' . addslashes(encryptC(generateRandomPrimkey(8), Config::directLoginKey())) . '">';
         $returnStr .= '<input type=hidden name=' . POST_PARAM_NEW_PRIMKEY . ' value="1">';
         $returnStr .= '<input type=hidden name=' . POST_PARAM_SURVEY_EXECUTION_MODE . ' value="' . SURVEY_EXECUTION_MODE_TEST . '">';
         $returnStr .= '<span class="label label-default">' . Language::labelToolsTestSettings() . '</span>';
         $returnStr .= '<div class="well well-sm">';
         $returnStr .= $this->displayComboBox();
         $returnStr .= '<table>';
         $returnStr .= '<tr><td>' . Language::labelTestSurvey() . "</td><td><select onchange='document.getElementById(\"" . SMS_POST_SURVEY . "_hidden\").value=this.value; document.getElementById(\"refreshform\").submit();' name=" . POST_PARAM_SUID . " class='selectpicker show-tick'>";
         $current = new Survey(getSurvey());
         foreach ($surveys as $survey) {
             $selected = "";
             if ($survey->getSuid() == $current->getSuid()) {
                 $selected = "SELECTED";
             }
             $returnStr .= "<option {$selected} value=" . $survey->getSuid() . '>' . $survey->getName() . '</option>';
         }
         $returnStr .= "</select></td></tr>";
         $returnStr .= "<tr><td>" . Language::labelTestModeInput() . "</td><td>" . $this->displayModesAdmin(POST_PARAM_MODE, POST_PARAM_MODE, getSurveyMode(), "", $current->getAllowedModes(), "onchange='document.getElementById(\"" . SMS_POST_MODE . "_hidden\").value=this.value; document.getElementById(\"refreshform\").submit();'") . "</td></tr>";
         $returnStr .= "<tr><td>" . Language::labelTestLanguage() . "</td><td>" . $this->displayLanguagesAdmin(POST_PARAM_LANGUAGE, POST_PARAM_LANGUAGE, getSurveyLanguage(), true, true, false, "", $current->getAllowedLanguages(getSurveyMode())) . "</td></tr>";
         $returnStr .= '</table>';
         $returnStr .= '</div>';
         $returnStr .= '<button type="submit" class="btn btn-default navbar-btn">' . Language::buttonTest() . '</button>';
         $returnStr .= "</form>";
     } else {
         $returnStr .= $this->displayInfo(Language::messageNoSurveysAvailable());
     }
     $returnStr .= '</p></div></div>';
     //container and wrap
     $returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter(false);
     return $returnStr;
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:47,代码来源:displaysysadmin.php

示例3: showEditUserRes

 function showEditUserRes()
 {
     /* update last page */
     $_SESSION['LASTPAGE'] = 'sysadmin.users.edituser';
     $displayUsers = new DisplayUsers();
     $urid = getFromSessionParams('urid');
     $content = "";
     if ($urid != '') {
         //edit
         $content = $displayUsers->displaySuccess(Language::messageUserChanged(loadvar('name')));
         $_SESSION['LASTURID'] = $urid;
     } else {
         //add user!
         if (loadvar('username') != "" && loadvar('name') != '') {
             //ADD NEW!!!
             $user = new User('', true);
             $urid = $user->getUrid();
             $_SESSION['LASTURID'] = $urid;
             $content = $displayUsers->displaySuccess(Language::messageUserAdded(loadvar('name')));
         }
     }
     //ADD ALL SORTS OF CHECKS!!
     if ($urid != '' && loadvar('name') != "" && loadvar('username') != '') {
         $user = new User($urid);
         $user->setName(loadvar('name'));
         $user->setUsername(loadvar('username'));
         if (loadvar('pwd1') != '') {
             if (loadvar('pwd1') == loadvar('pwd2')) {
                 $user->setPassword(loadvar('pwd1'));
             } else {
                 $content = $displayUsers->displayWarning(Language::messageUserNoMatch());
             }
         }
         $user->setSupervisor(loadvar('uridsel'));
         $user->setStatus(loadvar('status'));
         $user->setUserType(loadvar('usertype'));
         $user->setUserSubType(loadvar('usersubtype'));
         $current = $user->getSurveysAccess();
         $allowedsurveys = loadvar(SETTING_USER_SURVEYS);
         // add access to all modes and languages if not specified in current access
         foreach ($allowedsurveys as $a) {
             if (!inArray($a, $current)) {
                 $surv = new Survey($a);
                 $mods = explode("~", $surv->getAllowedModes());
                 foreach ($mods as $m) {
                     $user->setLanguages($a, $m, $surv->getAllowedLanguages($m));
                 }
             }
         }
         foreach ($current as $c) {
             if (!inArray($c, $allowedsurveys)) {
                 $user->removeSurvey($c);
             }
         }
         $user->saveChanges();
         // current survey not in allowed, then update to first survey for user
         if (!inArray($_SESSION['SUID'], $allowedsurveys)) {
             $surveys = new Surveys();
             $_SESSION['SUID'] = $surveys->getFirstSurvey();
         }
     } else {
         $content = $displayUsers->displayWarning(Language::messageUserCorrectErrors());
     }
     return $displayUsers->showEditUser($_SESSION['LASTURID'], $content);
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:65,代码来源:sysadmin.php

示例4: showEditUser


//.........这里部分代码省略.........
     $returnStr .= "</script>";
     if (inArray($user->getUserType(), array(USER_NURSE))) {
         $returnStr .= '<tr id=subtype><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
         $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype');
         $returnStr .= '</td></tr>';
     } else {
         if (inArray($user->getUserType(), array(USER_SYSADMIN))) {
             $returnStr .= '<tr id=subtype2><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
             $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype');
             $returnStr .= '</td></tr>';
         } else {
             $returnStr .= '<tr id=subtype style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
             $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype');
             $returnStr .= '</td></tr>';
             $returnStr .= '<tr id=subtype2 style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
             $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype');
             $returnStr .= '</td></tr>';
         }
     }
     if (inArray($user->getUserType(), array(USER_INTERVIEWER, USER_CATIINTERVIEWER, USER_NURSE, USER_SUPERVISOR))) {
         $returnStr .= '<tr id=super><td>' . Language::labelUserSupervisor() . '</td><td>';
         $users = new Users();
         $users = $users->getUsersByType(USER_SUPERVISOR);
         $returnStr .= $this->displayUsers($users, $user->getSupervisor(), 'uridsel', true);
         $returnStr .= '</td></tr>';
     }
     $extra = '';
     if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) {
         $extra = "style='display: none;'";
     }
     $returnStr .= '<tr id="surveyaccess"' . $extra . '><td>' . Language::labelUserSurveyAllowed() . '</td><td>' . $this->displaySurveys(SETTING_USER_SURVEYS . "[]", SETTING_USER_SURVEYS, implode("~", $user->getSurveysAccess()), '', "multiple") . '</td></tr>';
     $returnStr .= '</table></div>';
     $returnStr .= '<div class="col-md-6">';
     $returnStr .= '<table>';
     $returnStr .= '<tr><td align=top>' . Language::labelUserPassword() . '</td><td><input type="text" class="form-control" name="pwd1"></td></tr>';
     $returnStr .= '<tr><td align=top>' . Language::labelUserPassword2() . '</td><td><input type="text" class="form-control" name="pwd2"></td></tr>';
     $returnStr .= '</table></div></div>';
     if ($urid != "") {
         $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>';
     } else {
         $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonAdd() . '"/>';
     }
     $returnStr .= '</div></form>';
     $suid = $_SESSION['SUID'];
     /* available surveys */
     if ($urid != "") {
         $extra = '';
         if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) {
             $extra = "style='display: none;'";
         }
         $returnStr .= "<div " . $extra . " id='accessdiv'>";
         $returnStr .= "<form id=refreshform method=post>";
         $returnStr .= '<input type=hidden name=page value="sysadmin.users.edituser">';
         $returnStr .= '<input type=hidden name="' . SMS_POST_SURVEY . '" id="' . SMS_POST_SURVEY . '_hidden" value="' . getSurvey() . '">';
         $returnStr .= "</form>";
         $returnStr .= '<form id="editform1" method="post">';
         $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituseraccessres', 'urid' => $urid));
         $returnStr .= '<span class="label label-default">' . Language::labelUserAccess() . '</span>';
         $returnStr .= '<div class="well">';
         $returnStr .= "<table>";
         $allsurveys = $user->getSurveysAccess();
         if (!inArray($suid, $allsurveys)) {
             $suid = $allsurveys[0];
         }
         $survey = new Survey($suid);
         $u = $_SESSION['URID'];
         $_SESSION['URID'] = $urid;
         // pretend to be edited user for a moment to get surveys to display
         $returnStr .= '<tr><td>' . Language::labelUserSurveyAccess() . '</td><td>' . $this->displaySurveys(SMS_POST_SURVEY, SMS_POST_SURVEY, $suid, '', "") . '</td></tr>';
         $_SESSION['URID'] = $u;
         $returnStr .= "<script type='text/javascript'>";
         $returnStr .= '$( document ).ready(function() {
                                             $("#' . SMS_POST_SURVEY . '").change(function (e) {
                                                 $("#' . SMS_POST_SURVEY . '_hidden").val(this.value);                                                     
                                                 $("#refreshform").submit();
                                             });
                                             })';
         $returnStr .= "</script>";
         /* available modes */
         $modes = Common::surveyModes();
         $allowedmodes = explode("~", $survey->getAllowedModes());
         $usermodes = $user->getModes($suid);
         foreach ($allowedmodes as $mode) {
             $returnStr .= "<tr class='modesrow'><td>" . $modes[$mode] . "</td><td>";
             $returnStr .= $this->displayUserMode(SETTING_USER_MODE . $mode, inArray($mode, $usermodes));
             $userlanguages = $user->getLanguages($suid, $mode);
             $returnStr .= "<td>" . Language::labelUserLanguageAllowed() . "</td>";
             $returnStr .= "<td>" . $this->displayLanguagesAdmin(SETTING_USER_LANGUAGES . $mode, SETTING_USER_LANGUAGES . $mode, $userlanguages, true, false, false, "multiple", $survey->getAllowedLanguages($mode)) . "</td>";
             $returnStr .= "</tr>";
         }
         $returnStr .= '</table>';
         $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>';
         $returnStr .= '</div></form></div>';
     }
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     $returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter(false);
     return $returnStr;
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:101,代码来源:displayusers.php


注:本文中的Survey::getAllowedModes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。