Beispiel #1
0
function startSurvey($primkey)
{
    $content = '<center><h2>UCNets Face-to-Face test site</h2><div style="margin-top: 100px;">Please click next >> to start the survey. ';
    $content .= '<form method="post" action="../surveys/index.php">';
    $content .= '<input type=hidden name=' . POST_PARAM_SE . ' value="' . addslashes(USCIC_SURVEY) . '">';
    $content .= '<input type=hidden name=' . POST_PARAM_PRIMKEY . ' value="' . addslashes(encryptC($primkey, directLoginKey)) . '">';
    $content .= '<input type=hidden name=' . POST_PARAM_LANGUAGE . ' value="1">';
    $content .= '<input type=hidden name=' . POST_PARAM_MODE . ' value="' . MODE_CAPI . '">';
    $content .= '<input type=hidden name=ms value=1>';
    //	$content .= '<input type=hidden name=' . POST_PARAM_PRELOAD . ' value="' .  encodeSession($member->getPreload()) . '">';
    $content .= '<br/><br/><button type="submit" class="btn btn-default">Next >></button>';
    $content .= '</form></div></center>';
    return $content;
}
 function redirect($page)
 {
     global $survey;
     $returnStr = $this->showHeader($survey->getTitle(), '<link href="bootstrap/css/sticky-footer-navbar.min.css" rel="stylesheet">');
     $returnStr .= '<form method="post" action="../../../panel/index.php">';
     $returnStr .= $this->setSessionParamsPost(array('page' => $page));
     $returnStr .= '<input type=hidden name="' . POST_PARAM_PRIMKEY . '" value="' . addslashes(encryptC($this->primkey, Config::directLoginKey())) . '">';
     $returnStr .= '<input type=hidden name="' . POST_PARAM_LANGUAGE . '" value="' . getSurveyLanguage() . '">';
     $returnStr .= '</form>';
     $returnStr .= '<script>';
     $returnStr .= '$(document).ready(function(){ $("form:first").submit(); }); ';
     $returnStr .= '</script></body><html>';
     return $returnStr;
 }
Beispiel #3
0
 function addCSVRecord($primkey, $record = null)
 {
     $line = "";
     $skipped = array();
     for ($i = 0; $i < $this->variablenumber; $i++) {
         $fieldname = $this->variablenames[$i];
         $variableobject = null;
         $value = null;
         // skip variable
         if (inArray(strtoupper($fieldname), $this->skipvariables)) {
             $value = $skipped[strtoupper($fieldname)];
         } else {
             if (isset($this->withsuffix[strtoupper($fieldname)])) {
                 $binary = $this->setofenumeratedbinary[strtoupper($fieldname)];
                 $last = strrpos($fieldname, $this->withsuffix[strtoupper($fieldname)]);
                 $num = str_replace("s", "", $this->withsuffix[strtoupper($fieldname)]);
                 $fieldname = substr($fieldname, 0, $last);
                 $value = $this->getValue($primkey, $record, $fieldname);
                 //if ($value != null && !inArray($value, array(ANSWER_DK, ANSWER_RF, ANSWER_NA))) {
                 if ($value != null && !inArray($value, array("", ANSWER_DK, ANSWER_RF, ANSWER_NA, $this->asked))) {
                     $arr = array();
                     if (contains($value, SEPARATOR_SETOFENUMERATED)) {
                         $arr = explode(SEPARATOR_SETOFENUMERATED, $value);
                     } else {
                         if (contains($value, SEPARATOR_SETOFENUMERATED_OLD)) {
                             $arr = explode(SEPARATOR_SETOFENUMERATED_OLD, $value);
                         } else {
                             $arr[] = $value;
                         }
                     }
                     if (inArray($num, $arr)) {
                         $value = $num;
                         if ($binary == SETOFENUMERATED_BINARY) {
                             $value = 1;
                         }
                     } else {
                         $value = "";
                         // set to "", so it appears as just empty rather than skipped (since it was not skipped, just not selected)
                         if ($binary == SETOFENUMERATED_BINARY) {
                             $value = "0";
                         }
                     }
                 }
             } else {
                 $value = $this->getValue($primkey, $record, $fieldname);
             }
         }
         // we have a value, then check for serialized array answer
         if ($value != null) {
             // variable is an instance of an array variable
             if (inArray(strtoupper(getBasicName($fieldname)), $this->arrayfields)) {
                 // this is a compressed string!
                 $v = gzuncompress($value);
                 if ($v !== false) {
                     // this is a serialized string!
                     if (unserialize($v) !== false) {
                         $v1 = unserialize(gzuncompress($value));
                         // the unserialized is an array or object, then output empty string so it appears as empty (not skipped)
                         if (is_array($v1) || is_object($v1)) {
                             $value = "";
                         }
                     }
                 }
             }
         }
         // primary key encryption
         if ($fieldname == VARIABLE_PRIMKEY && $this->getProperty(DATA_OUTPUT_PRIMARY_KEY_ENCRYPTION) != "") {
             $value = encryptC($value, $this->getProperty(DATA_OUTPUT_PRIMARY_KEY_ENCRYPTION));
         }
         // write variable
         $stringobj = "";
         if ($value == ANSWER_RF) {
             $stringobj = ".r";
         } else {
             if ($value == ANSWER_DK) {
                 $stringobj = ".d";
             } else {
                 if ($value == ANSWER_NA) {
                     $stringobj = ".n";
                 } else {
                     if (!inArray($value, array("", null, $this->asked))) {
                         $stringobj = $value;
                     } else {
                         if ($value == $this->asked) {
                             if ($this->getProperty(DATA_OUTPUT_MARK_EMPTY) == MARKEMPTY_IN_VARIABLE) {
                                 $stringobj = ".e";
                             } else {
                                 if ($this->getProperty(DATA_OUTPUT_MARK_EMPTY) == MARKEMPTY_IN_SKIP_VARIABLE) {
                                     if (isset($this->skipvariables[strtoupper($this->variablenames[$i])])) {
                                         $skipped[strtoupper($this->skipvariables[strtoupper($this->variablenames[$i])])] = 1;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         /* add separator */
         if ($line != "" || $i > 0 && $i + 1 < $this->recordcount) {
             $line .= $this->separator;
         }
         $stringobj = str_replace("\"", "\"\"", $stringobj);
         $stringobj = str_replace("\r", "", $stringobj);
         $stringobj = str_replace("\n", "", $stringobj);
         $stringobj = str_replace("\r\n", "", $stringobj);
         $line .= '"' . $stringobj . '"';
         $stringobj = null;
         unset($stringobj);
     }
     fwrite($this->csvhandle, $line . "\n");
     $line = null;
     unset($line);
     //exit;
 }
 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;
 }
				<button type="button" class="btn btn-default' . $active[2] . '" value=2>' . Language::labelInterviewerFiltersHideCompleted() . '</button>
				<button type="button" class="btn btn-default' . $active[3] . '" value=3>' . Language::labelInterviewerFiltersHideCompletedAndFinal() . '</button>
			</div></td></tr>';
        $returnStr .= '<input type=hidden name="region" id="region" value="' . $user->getRegionFilter() . '">';
        $returnStr .= '<tr><td>' . Language::labelInterviewerFilterRegion() . '</td><td style="width:195px">';
        $returnStr .= '<div id="regionselector" class="btn-group">
				<button type="button" class="btn btn-default active" value=0>' . Language::labelInterviewerFilterRegionAll() . '</button>
				<button type="button" class="btn btn-default" value=1>' . Language::labelInterviewerFilterRegionOne() . '</button>
			</div></td><td style="width:10px;"></td><td>';
        $returnStr .= '<div id="regiondiv" style="display: none">';
        $returnStr .= $this->displayPsus($user->getPuid());
        $returnStr .= '</div>';
        $returnStr .= '</td></tr></table>';
        $returnStr .= '
  </div>
</div>';
        $returnStr .= '<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">' . Language::labelSettings() . '</h3>
  </div>
  <div class="panel-body">
';
        $returnStr .= '<input type="hidden" name="testmode" id="testmode" value="' . $user->getTestMode() . '">';
        $returnStr .= '<table><tr><td style="width:110px">Survey:</td><td>
			<div id="testmodeselector" class="btn-group">
				<button type="button" class="btn btn-default active" value=0>' . Language::labelNormalMode() . '</button>
				<button type="button" class="btn btn-default" value=1>' . Language::labelTestMode() . '</button>
			</div></td><td style="width:10px;"></td><td>';
        $returnStr .= '<div id="testmodediv" style="display: none"><a href="' . setSessionParams(array('page' => 'interviewer.preferences.resettest')) . '">' . Language::linkResetTestCases() . '</a></div>';
        $returnStr .= '</td></tr>';
        $returnStr .= '<tr><td style="width:110px">' . Language::labelCommunication() . '</td><td colspan=2>';
        $returnStr .= $this->displayCommunicationSelect($user->getCommunication());
        $returnStr .= '</td></tr>';
        $returnStr .= '</table>';
        $returnStr .= '<script>';
        $returnStr .= '$(\'#filterselector button\').click(function() {
		//  $(\'#filterselector button\').addClass(\'active\').not(this).removeClass(\'active\');
                  $(\'#filterselector button\').removeClass(\'active\');
                $(this).addClass(\'active\');
              // $(\'#filterselector button\').toggleClass("active");
		  $(\'#filter\').val("1");
Beispiel #6
0
 function setDataEncryptionKey($value)
 {
     $this->setSettingValue(SETTING_DATA_ENCRYPTION_KEY, encryptC($value, Config::dataEncryptionKey()));
 }
Beispiel #7
0
 function showStartButton($respondentOrHousehold, $suid = 3, $alert = false, $btntext = 'Start', $ok = false)
 {
     $preload = array();
     $lab = new Lab($respondentOrHousehold->getPrimkey());
     if ($suid == 4) {
         if ($lab->getConsent2() == 1 || $lab->getConsent3() == 1) {
             //station 2 = YES
             $preload['RgetsStation2'] = '1';
         }
         if ($lab->getConsent4() == 1 && $lab->getConsent5() == 1) {
             //station 5a = YES
             $preload['RgetsStation5a'] = '1';
         }
     }
     $content = '';
     $content .= "<form method=post>";
     $content .= '<input type=hidden name=' . POST_PARAM_SE . ' value="' . addslashes(USCIC_SURVEY) . '">';
     $content .= '<input type=hidden name=' . POST_PARAM_PRIMKEY . ' value="' . addslashes(encryptC($respondentOrHousehold->getPrimkey(), Config::directLoginKey())) . '">';
     $content .= '<input type=hidden name=' . POST_PARAM_LANGUAGE . ' value="' . '1' . '">';
     $content .= '<input type=hidden name=' . POST_PARAM_URID . ' value="' . addslashes($_SESSION['URID']) . '">';
     $content .= '<input type=hidden name=' . POST_PARAM_NEW_PRIMKEY . ' value="1">';
     $content .= '<input type=hidden name=' . POST_PARAM_MODE . ' value="' . MODE_CAPI . '">';
     $content .= '<input type=hidden name=' . POST_PARAM_SUID . ' value="' . $suid . '">';
     $content .= '<input type=hidden name=' . POST_PARAM_PRELOAD . ' value="' . encodeSession($respondentOrHousehold->getPreload($preload)) . '">';
     $disabled = '';
     $btntype = 'default';
     if ($alert) {
         $disabled = 'disabled=true';
         $btntype = 'danger';
     }
     if ($ok) {
         $disabled = 'disabled=true';
         $btntype = 'success';
         $type = 'submit';
     }
     $content .= '<button type="submit" id="startsurveybtn" class="btn btn-' . $btntype . ' navbar-btn" ' . $disabled . ' style="width:200px">' . $btntext . '</button>';
     $content .= "</form>";
     return $content;
 }
Beispiel #8
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>';