Ejemplo n.º 1
0
 function getLoginScreen($message = '')
 {
     $returnStr = '';
     global $survey;
     if (isTestMode()) {
         $displayLogin = new DisplayLogin();
         $returnStr .= $displayLogin->showLoginDirect(loadvarSurvey('primkey'), $message);
     } else {
         if ($survey->getAccessType() == LOGIN_ANONYMOUS) {
             $displayLogin = new DisplayLogin();
             //TODO MAKE SURE generateRandomPrimkey doesn't exist yet!!
             $returnStr .= $displayLogin->showLoginAnonymous(generateRandomPrimkey(8));
         } elseif ($survey->getAccessType() == LOGIN_DIRECT) {
             $displayLogin = new DisplayLogin();
             $returnStr .= $displayLogin->showLoginDirect(loadvarSurvey('primkey'), $message);
         } elseif ($survey->getAccessType() == LOGIN_LOGINCODE) {
             $displayLogin = new DisplayLogin();
             $returnStr .= $displayLogin->showLoginCode($message);
         }
     }
     return $returnStr;
 }
Ejemplo n.º 2
0
 function generateCases()
 {
     $suid = loadvar("suid");
     if ($suid == "") {
         $suid = 1;
     }
     $seid = loadvar("seid");
     if ($seid == "") {
         $seid = 1;
     }
     $version = 1;
     setSurvey($suid);
     setSurveyLanguage(loadvar(POST_PARAM_LANGUAGE), true);
     setSurveyMode(loadvar(POST_PARAM_MODE), true);
     setSurveyVersion($version);
     /* generate cases */
     $number = loadvar("number");
     for ($i = 0; $i < $number; $i++) {
         //set_time_limit(0);
         $primkey = generateRandomPrimkey();
         $this->generateCase($suid, $primkey, session_id(), $version, $seid);
         //exit;
     }
 }
Ejemplo n.º 3
0
 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="translator.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>";
         $user = new User($_SESSION['URID']);
         $cm = getSurveyMode();
         $cl = getSurveyLanguage();
         $modes = $user->getModes(getSurvey());
         $langs = explode("~", $user->getLanguages(getSurvey(), getSurveyMode()));
         $default = $current->getDefaultLanguage();
         if (!inArray($default, $langs)) {
             $langs[] = $default;
         }
         $returnStr .= "<tr><td>" . Language::labelTestModeInput() . "</td><td>" . $this->displayModesAdmin(POST_PARAM_MODE, POST_PARAM_MODE, getSurveyMode(), "", implode("~", $modes), "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, "", implode("~", $langs)) . "</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;
 }
Ejemplo n.º 4
0
*/
require_once 'constants.php';
require_once 'functions.php';
// define header
$returnStr = '<html><body>
<center>
Start parallel section';
// start form
$returnStr .= '<form method=post action=index.php>';
// start survey
$returnStr .= '<input type=hidden name=' . POST_PARAM_SE . ' value=1>';
// set survey to start
$returnStr .= '<input type=hidden name=' . POST_PARAM_SUID . ' value=1>';
// set which section to start
$returnStr .= setSessionParamsPost(array(SESSION_PARAM_MAINSEID => 11, SESSION_PARAM_SEID => 11));
$returnStr .= '<input type=hidden name=' . POST_PARAM_RESET_EXTERNAL . ' value=1>';
// generate a random primary key to be used
$returnStr .= '<input type=hidden name=' . POST_PARAM_PRIMKEY . ' value="' . addslashes(encryptC(generateRandomPrimkey(8), Config::directLoginKey())) . '">';
// start a new interview each time
$returnStr .= '<input type=hidden name=' . POST_PARAM_NEW_PRIMKEY . ' value="1">';
// set language to be used
$returnStr .= '<input type=hidden name=language value=1>';
// set interview mode to be used (1=CAPI, 2=CATI, 3=CASI, 4=CADI)
$returnStr .= '<input type=hidden name=mode value=3>';
// survey execution mode (0=normal, 1=test mode)
$returnStr .= '<input type=hidden name=executionmode value=1>';
// close
$returnStr .= '
<input type="submit" value="Start">
</form></center>
</body></html>';