($thissurvey['active']=='Y'), 'allowsave'=>($thissurvey['allowsave']=='Y'), 'anonymized'=>($thissurvey['anonymized']!='N'), 'assessments'=>($thissurvey['assessments']=='Y'), 'datestamp'=>($thissurvey['datestamp']=='Y'), 'deletenonvalues'=>(isset($deletenonvalues)? $deletenonvalues: 1), 'hyperlinkSyntaxHighlighting'=>(($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY), // TODO set this to true if in admin mode but not if running a survey 'ipaddr'=>($thissurvey['ipaddr']=='Y'), 'radix'=>$radix, 'refurl'=>(($thissurvey['refurl'] == "Y") ? $_SESSION['refurl'] : NULL), 'rooturl'=>(isset($rooturl) ? $rooturl : ''), 'savetimings'=>($thissurvey['savetimings'] == "Y"), 'surveyls_dateformat'=>(isset($thissurvey['surveyls_dateformat']) ? $thissurvey['surveyls_dateformat'] : 1), 'startlanguage'=>(isset($clang->langcode) ? $clang->langcode : $thissurvey['language']), 'target'=>(isset($uploaddir) ? "{$uploaddir}/surveys/{$thissurvey['sid']}/files/" : "/temp/{$thissurvey['sid']}/files"), 'tempdir'=>(isset($tempdir) ? $tempdir : '/temp/'), 'timeadjust'=>(isset($timeadjust) ? $timeadjust : 0), 'token'=>(isset($clienttoken) ? $clienttoken : NULL), ); //Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB $previewgrp = false; if ( $surveyMode=='group' && isset($_REQUEST['action']) && ($_REQUEST['action']=='previewgroup')){ $previewgrp = true; } if (isset($_REQUEST['newtest'])) if ($_REQUEST['newtest']=="Y") setcookie("limesurvey_timers", "0"); $show_empty_group = false; if ($previewgrp) { $_SESSION['prevstep'] = 1; $_SESSION['maxstep'] = 0; } else { //RUN THIS IF THIS IS THE FIRST TIME , OR THE FIRST PAGE ######################################## if (!isset($_SESSION['step']) || $_SESSION['step'] == -1) // || !$_SESSION['step']) - don't do this for step 0, else rebuild the session { $totalquestions = buildsurveysession(); LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); $_SESSION['step'] = 0; if ($surveyMode == 'survey') { $move = "movenext"; // to force a call to NavigateForwards() } else if (isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') { //If explicitply set, hide the welcome screen $_SESSION['step'] = 1; $move = "movenext"; } } if (!isset($_SESSION['totalsteps'])) {$_SESSION['totalsteps']=0;} if (!isset($_SESSION['maxstep'])) {$_SESSION['maxstep']=0;} if (isset($_SESSION['LEMpostKey']) && isset($_POST['LEMpostKey']) && $_POST['LEMpostKey'] != $_SESSION['LEMpostKey']) { // then trying to resubmit (e.g. Next, Previous, Submit) from a cached copy of the page // Does not try to save anything from the page to the database $moveResult = LimeExpressionManager::GetLastMoveResult(true); if (isset($_POST['thisstep']) && isset($moveResult['seq']) && $_POST['thisstep'] == $moveResult['seq']) { // then pressing F5 or otherwise refreshing the current page, which is OK $LEMskipReprocessing=true; $move = "movenext"; // so will re-display the survey } else { // trying to use browser back buttons, which may be disallowed if no 'previous' button is present $LEMskipReprocessing=true; $move = "movenext"; // so will re-display the survey $invalidLastPage=true; $vpopup="\n"; } } if (!(isset($_POST['saveall']) || isset($_POST['saveprompt']) || isset($_POST['loadall']) || isset($_GET['sid']) || $LEMskipReprocessing || (isset($move) && (preg_match('/^changelang_/',$move))))) { $_SESSION['prevstep']=$_SESSION['step']; } if (!isset($_SESSION['prevstep'])) { $_SESSION['prevstep']=-1; // this only happens on re-load } if (isset($_SESSION['LEMtokenResume'])) { LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,false); // if late in the survey, will re-validate contents, which may be overkill unset($_SESSION['LEMtokenResume']); unset($_SESSION['LEMreload']); } else if (!$LEMskipReprocessing) { //Move current step ########################################################################### if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev']=='Y' || $thissurvey['allowjumps']=='Y')) { $moveResult = LimeExpressionManager::NavigateBackwards(); if ($moveResult['at_start']) { $_SESSION['step']=0; unset($moveResult); // so display welcome page again } } if (isset($move) && $move == "movenext") { if (isset($_SESSION['LEMreload'])) { LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,false); // if late in the survey, will re-validate contents, which may be overkill unset($_SESSION['LEMreload']); } else { $moveResult = LimeExpressionManager::NavigateForwards(); } } if (isset($move) && ($move == 'movesubmit')) { if ($surveyMode == 'survey') { $moveResult = LimeExpressionManager::NavigateForwards(); } else { // may be submitting from the navigation bar, in which case need to process all intervening questions // in order to update equations and ensure there are no intervening relevant mandatory or relevant invalid questions $moveResult = LimeExpressionManager::JumpTo($_SESSION['totalsteps']+1,false); } } if (isset($move) && (preg_match('/^changelang_/',$move))) { // jump to current step using new language, processing POST values $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,true,false,true); // do process the POST data } if (isset($move) && bIsNumericInt($move) && $thissurvey['allowjumps']=='Y') { $move = (int)$move; if ($move > 0 && (($move <= $_SESSION['step']) || (isset($_SESSION['maxstep']) && $move <= $_SESSION['maxstep']))) { $moveResult = LimeExpressionManager::JumpTo($move,false); } } if (!isset($moveResult) && !($surveyMode != 'survey' && $_SESSION['step'] == 0)) { // Just in case not set via any other means, but don't do this if it is the welcome page $moveResult = LimeExpressionManager::GetLastMoveResult(true); $LEMskipReprocessing=true; } } if (isset($moveResult)) { if ($moveResult['finished']==true) { $move = 'movesubmit'; } else { $_SESSION['step']= $moveResult['seq']+1; // step is index base 1 $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); } if ($move == "movesubmit" && $moveResult['finished'] == false) { // then there are errors, so don't finalize the survey $move = "movenext"; // so will re-display the survey $invalidLastPage=true; } } // We do not keep the participant session anymore when the same browser is used to answer a second time a survey (let's think of a library PC for instance). // Previously we used to keep the session and redirect the user to the // submit page. if ($surveyMode != 'survey' && $_SESSION['step'] == 0) { display_first_page(); exit; } //CHECK IF ALL MANDATORY QUESTIONS HAVE BEEN ANSWERED ############################################ //First, see if we are moving backwards or doing a Save so far, and its OK not to check: if ( (isset($move) && ($move == "moveprev" || (is_int($move) && $_SESSION['prevstep'] == $_SESSION['maxstep']) || $_SESSION['prevstep'] == $_SESSION['step'])) || (isset($_POST['saveall']) && $_POST['saveall'] == $clang->gT("Save your responses so far"))) { if ($allowmandbackwards==1) { $backok="Y"; } else { $backok="N"; } } else { $backok="N"; // NA, since not moving backwards } if ($thissurvey['active'] == "Y" && isset($_POST['saveall'])) { // must do this here to process the POSTed values $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false); // by jumping to current step, saves data so far showsaveform(); // generates a form and exits, awaiting input if(!tableExists('tokens_'.$surveyid) || $thissurvey['anonymized']=='Y' || (tableExists('tokens_'.$surveyid) && $thissurvey['tokenanswerspersistence'] == 'N' )) { $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,true,false,false,true); // by jumping to current step, saves data so far //queXS Removal //showsaveform(); } else { $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,true,false,false,true); // by jumping to current step, saves data so far } } if ($thissurvey['active'] == "Y" && isset($_POST['saveprompt'])) { // The response from the save form // CREATE SAVED CONTROL RECORD USING SAVE FORM INFORMATION $flashmessage = savedcontrol(); if (isset($errormsg) && $errormsg != "") { showsaveform(); // reshow the form if there is an error } $moveResult = LimeExpressionManager::GetLastMoveResult(true); $LEMskipReprocessing=true; // TODO - does this work automatically for token answer persistence? Used to be savedsilent() } //Now, we check mandatory questions if necessary //CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED global $notanswered; if (isset($moveResult) && !$moveResult['finished']) { $unansweredSQList = $moveResult['unansweredSQs']; if (strlen($unansweredSQList) > 0 && $backok != "N") { $notanswered = explode('|',$unansweredSQList); } else { $notanswered = array(); } //CHECK INPUT $invalidSQList = $moveResult['invalidSQs']; if (strlen($invalidSQList) > 0 && $backok != "N") { $notvalidated = explode('|',$invalidSQList); } else { $notvalidated = array(); } } // CHECK UPLOADED FILES // TMSW - Move this into LEM::NavigateForwards? $filenotvalidated = checkUploadedFileValidity($move, $backok); //SEE IF THIS GROUP SHOULD DISPLAY $show_empty_group = false; if ($_SESSION['step']==0) $show_empty_group = true; //SUBMIT ############################################################################### if ((isset($move) && $move == "movesubmit")) { setcookie ("limesurvey_timers", "", time() - 3600);// remove the timers cookies if ($thissurvey['refurl'] == "Y") { if (!in_array("refurl", $_SESSION['insertarray'])) //Only add this if it doesn't already exist { $_SESSION['insertarray'][] = "refurl"; } } //COMMIT CHANGES TO DATABASE if ($thissurvey['active'] != "Y") //If survey is not active, don't really commit { if ($thissurvey['assessments']== "Y") { $assessments = doAssessment($surveyid); } sendcacheheaders(); doHeader(); echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); //Check for assessments if ($thissurvey['assessments']== "Y" && $assessments) { echo templatereplace(file_get_contents("$thistpl/assessment.pstpl")); } // fetch all filenames from $_SESSIONS['files'] and delete them all // from the /upload/tmp/ directory /*echo "
";print_r($_SESSION);echo "
"; for($i = 1; isset($_SESSION['files'][$i]); $i++) { unlink('upload/tmp/'.$_SESSION['files'][$i]['filename']); } */ // can't kill session before end message, otherwise INSERTANS doesn't work. $completed = templatereplace($thissurvey['surveyls_endtext']); $completed .= "
".$clang->gT("Did Not Save")."

\n\n"; $completed .= $clang->gT("Your survey responses have not been recorded. This survey is not yet active.")."

\n"; if ($thissurvey['printanswers'] == 'Y') { // ClearAll link is only relevant for survey with printanswers enabled // in other cases the session is cleared at submit time $completed .= "".$clang->gT("Clear Responses")."

\n"; } if($thissurvey['printanswers'] != 'Y') { killSession(); } } else //THE FOLLOWING DEALS WITH SUBMITTING ANSWERS AND COMPLETING AN ACTIVE SURVEY { if ($thissurvey['usecookie'] == "Y" && $tokensexist != 1) //don't use cookies if tokens are being used { $cookiename="PHPSID".returnglobal('sid')."STATUS"; setcookie("$cookiename", "COMPLETE", time() + 31536000); //Cookie will expire in 365 days } //Before doing the "templatereplace()" function, check the $thissurvey['url'] //field for limereplace stuff, and do transformations! $thissurvey['surveyls_url']=passthruReplace($thissurvey['surveyls_url'], $thissurvey); $thissurvey['surveyls_url']=templatereplace($thissurvey['surveyls_url']); // to do INSERTANS substitutions $content=''; $content .= templatereplace(file_get_contents("$thistpl/startpage.pstpl")); //Check for assessments if ($thissurvey['assessments']== "Y") { $assessments = doAssessment($surveyid); if ($assessments) { $content .= templatereplace(file_get_contents("$thistpl/assessment.pstpl")); } } //Update the token if needed and send a confirmation email if (isset($clienttoken) && $clienttoken) { submittokens(); } //Send notifications SendSubmitNotifications(); $content=''; $content .= templatereplace(file_get_contents("$thistpl/startpage.pstpl")); //Check for assessments if ($thissurvey['assessments']== "Y") { $assessments = doAssessment($surveyid); if ($assessments) { $content .= templatereplace(file_get_contents("$thistpl/assessment.pstpl")); } } if (trim(strip_tags($thissurvey['surveyls_endtext']))=='') { $completed = "
".$clang->gT("Thank you!")."

\n\n" . $clang->gT("Your survey responses have been recorded.")."

\n"; } else { $completed = templatereplace($thissurvey['surveyls_endtext']); } // Link to Print Answer Preview ********** if ($thissurvey['printanswers']=='Y') { $completed .= "

" ."" .$clang->gT("Print your answers.") ."
\n"; } //***************************************** if ($thissurvey['publicstatistics']=='Y' && $thissurvey['printanswers']=='Y') {$completed .='
'.$clang->gT("or");} // Link to Public statistics ********** if ($thissurvey['publicstatistics']=='Y') { $completed .= "

" ."" .$clang->gT("View the statistics for this survey.") ."
\n"; } //***************************************** $_SESSION['finished']=true; $_SESSION['sid']=$surveyid; sendcacheheaders(); if (isset($thissurvey['autoredirect']) && $thissurvey['autoredirect'] == "Y" && $thissurvey['surveyls_url']) { //Automatically redirect the page to the "url" setting for the survey $url = templatereplace($thissurvey['surveyls_url']); // TODO - check safety of this - provides access to any replacement value $url = passthruReplace($url, $thissurvey); $url = str_replace("{SAVEDID}",$saved_id, $url); // to activate the SAVEDID in the END URL $url = str_replace("{TOKEN}",$clienttoken, $url); // to activate the TOKEN in the END URL $url = str_replace("{SID}", $surveyid, $url); // to activate the SID in the END URL $url = str_replace("{LANG}", $clang->getlangcode(), $url); // to activate the LANG in the END URL //queXS Addition include_once("quexs.php"); if ($_SESSION['interviewer']) { $quexs_url = get_start_interview_url(); $url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url); $end_url = get_end_interview_url(); $url = str_replace("{ENDINTERVIEWURL}", $end_url, $url); } else { $url = get_end_interview_url($clienttoken); quexs_completed_by_respondent($surveyid,$clienttoken); } killSession(); header("Location: {$url}"); } if($thissurvey['printanswers'] != 'Y') { killSession(); } doHeader(); echo $content; } echo templatereplace(file_get_contents("$thistpl/completed.pstpl")); echo "\n
\n"; if ((($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING)) { echo LimeExpressionManager::GetDebugTimingMessage(); } if ((($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY)) { echo "
Group/Question Validation Results:".$moveResult['message']."
\n"; } echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); doFooter(); exit; } } // IF GOT THIS FAR, THEN DISPLAY THE ACTIVE GROUP OF QUESTIONSs //SEE IF $surveyid EXISTS #################################################################### if ($surveyexists <1) { //SURVEY DOES NOT EXIST. POLITELY EXIT. echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); echo "\t

\n"; echo "\t".$clang->gT("Sorry. There is no matching survey.")."
 \n"; echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); doFooter(); exit; } //GET GROUP DETAILS if ($surveyMode == 'group' && $previewgrp) { setcookie("limesurvey_timers", "0"); $_gid = sanitize_int($_REQUEST['gid']); LimeExpressionManager::StartSurvey($thissurvey['sid'], 'group', $surveyOptions, false,$LEMdebugLevel); $gseq = LimeExpressionManager::GetGroupSeq($_gid); if ($gseq == -1) { echo $clang->gT('Invalid group number for this survey: ') . $_gid; exit; } $moveResult = LimeExpressionManager::JumpTo($gseq+1,true); if (is_null($moveResult)) { echo $clang->gT('This group contains no questions. You must add questions to this group before you can preview it'); exit; } if (isset($moveResult)) { $_SESSION['step']= $moveResult['seq']+1; // step is index base 1? } $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); $gid = $stepInfo['gid']; $groupname = $stepInfo['gname']; $groupdescription = $stepInfo['gtext']; } else { if (($show_empty_group)||!isset($_SESSION['grouplist'])) { $gid=-1; // Make sure the gid is unused. This will assure that the foreach (fieldarray as ia) has no effect. $groupname=$clang->gT("Submit your answers"); $groupdescription=$clang->gT("There are no more questions. Please press the button to finish this survey."); } else if ($surveyMode != 'survey') { $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); $gid = $stepInfo['gid']; $groupname = $stepInfo['gname']; $groupdescription = $stepInfo['gtext']; } } if ($_SESSION['step'] > $_SESSION['maxstep']) { $_SESSION['maxstep'] = $_SESSION['step']; } //****************************************************************************************************** //PRESENT SURVEY //****************************************************************************************************** $okToShowErrors = (!$previewgrp && (isset($invalidLastPage) || $_SESSION['prevstep'] == $_SESSION['step'])); require_once("qanda.php"); //store id's of all the question in $idlist array. $idlist = array(); //Iterate through the questions about to be displayed: $inputnames=array(); if (isset($_SESSION['grouplist'])) foreach ($_SESSION['grouplist'] as $gl) { $gid = $gl[0]; $qnumber = 0; if ($surveyMode != 'survey') { $onlyThisGID = $stepInfo['gid']; if ($onlyThisGID != $gid) { continue; } } // TMSW - could iterate through LEM::currentQset instead foreach ($_SESSION['fieldarray'] as $key => $ia) { ++$qnumber; $ia[9] = $qnumber; // incremental question count; if ((isset($ia[10]) && $ia[10] == $gid) || (!isset($ia[10]) && $ia[5] == $gid)) { if ($surveyMode == 'question' && $ia[0] != $stepInfo['qid']) { continue; } $qidattributes = getQuestionAttributes($ia[0], $ia[4]); if ($ia[4] != '*' && ($qidattributes === false || $qidattributes['hidden'] == 1)) { continue; } //Get the answers/inputnames // TMSW - can content of retrieveAnswers() be provided by LEM? Review scope of what it provides. // TODO - retrieveAnswers is slow - queries database separately for each question. May be fixed in _CI or _YII ports, so ignore for now list($plus_qanda, $plus_inputnames) = retrieveAnswers($ia); //can eliminate extra space for these 2 arrays if $_SESSION['fieldmap'] is used directly! $idlist[] = $ia[1]; if ($plus_qanda) { $plus_qanda[] = $ia[4]; $plus_qanda[] = $ia[6]; // adds madatory identifyer for adding mandatory class to question wrapping div $qanda[] = $plus_qanda; } if ($plus_inputnames) { $inputnames = addtoarray_single($inputnames, $plus_inputnames); } //Display the "mandatory" popup if necessary // TMSW - get question-level error messages - don't call **_popup() directly if ($okToShowErrors && $stepInfo['mandViolation']) { list($mandatorypopup, $popup) = mandatory_popup($ia, $notanswered); } //Display the "validation" popup if necessary if ($okToShowErrors && !$stepInfo['valid']) { list($validationpopup, $vpopup) = validation_popup($ia, $notvalidated); } // Display the "file validation" popup if necessary if ($okToShowErrors && isset($filenotvalidated)) { list($filevalidationpopup, $fpopup) = file_validation_popup($ia, $filenotvalidated); } } if ($ia[4] == "|") $upload_file = TRUE; } //end iteration } if ($surveyMode != 'survey' && isset($thissurvey['showprogress']) && $thissurvey['showprogress'] == 'Y') { if ($show_empty_group) { $percentcomplete = makegraph($_SESSION['totalsteps']+1, $_SESSION['totalsteps']); } else { $percentcomplete = makegraph($_SESSION['step'], $_SESSION['totalsteps']); } } if (!(isset($languagechanger) && strlen($languagechanger) > 0) && function_exists('makelanguagechanger')) { $languagechanger = makelanguagechanger(); } //READ TEMPLATES, INSERT DATA AND PRESENT PAGE sendcacheheaders(); doHeader(); if (isset($popup)) {echo $popup;} if (isset($vpopup)) {echo $vpopup;} if (isset($fpopup)) {echo $fpopup;} echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); //ALTER PAGE CLASS TO PROVIDE WHOLE-PAGE ALTERNATION if ($surveyMode != 'survey' && $_SESSION['step'] != $_SESSION['prevstep'] || (isset($_SESSION['stepno']) && $_SESSION['stepno'] % 2)) { if (!isset($_SESSION['stepno'])) $_SESSION['stepno'] = 0; if ($_SESSION['step'] != $_SESSION['prevstep']) ++$_SESSION['stepno']; if ($_SESSION['stepno'] % 2) { echo "\n"; } } $hiddenfieldnames=implode("|", $inputnames); if (isset($upload_file) && $upload_file) echo "
\n"; else echo " \n"; echo sDefaultSubmitHandler(); if ($surveyMode == 'survey') { if(isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') { //Hide the welcome screen if explicitly set } else { echo templatereplace(file_get_contents("$thistpl/welcome.pstpl"))."\n"; } if ($thissurvey['anonymized'] == "Y") { echo templatereplace(file_get_contents("$thistpl/privacy.pstpl"))."\n"; } } // <-- START THE SURVEY --> if ($surveyMode != 'survey') { echo templatereplace(file_get_contents("{$thistpl}/survey.pstpl")); } // the runonce element has been changed from a hidden to a text/display:none one // in order to workaround an not-reproduced issue #4453 (lemeur) echo " END; //Display the "mandatory" message on page if necessary if (isset($showpopups) && $showpopups == 0 && $stepInfo['mandViolation'] && $okToShowErrors) { echo "

" . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.") . "

"; } //Display the "validation" message on page if necessary if (isset($showpopups) && $showpopups == 0 && !$stepInfo['valid'] && $okToShowErrors) { echo "

" . $clang->gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid.") . "

"; } //Display the "file validation" message on page if necessary if (isset($showpopups) && $showpopups == 0 && isset($filenotvalidated) && $filenotvalidated == true && $okToShowErrors) { echo "

" . $clang->gT("One or more uploaded files are not in proper format/size. You cannot proceed until these files are valid.") . "

"; } if (isset($_SESSION['grouplist'])) $_gseq = -1; foreach ($_SESSION['grouplist'] as $gl) { $gid=$gl[0]; ++$_gseq; $groupname=$gl[1]; $groupdescription=$gl[2]; if ($surveyMode != 'survey' && $gid != $onlyThisGID) { continue; } echo "\n\n\n"; echo "\n\n\n"; } LimeExpressionManager::FinishProcessingGroup($LEMskipReprocessing); echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript(); LimeExpressionManager::FinishProcessingPage(); if (!$previewgrp){ $navigator = surveymover(); //This gets globalised in the templatereplace function echo "\n\n\n"; echo templatereplace(file_get_contents("$thistpl/navigator.pstpl")); echo "\n"; if ($thissurvey['active'] != "Y") { echo "

".$clang->gT("This survey is currently not active. You will not be able to save your responses.")."

\n"; } if($surveyMode != 'survey' && $thissurvey['allowjumps']=='Y') { echo "\n\n\n"; echo '

' . $clang->gT("Question index") . '

'; $stepIndex = LimeExpressionManager::GetStepIndexInfo(); $lastGseq=-1; $gseq = -1; $grel=true; for($v = 0, $n = 0; $n != $_SESSION['maxstep']; ++$n) { if (!isset($stepIndex[$n])) { continue; // this is an invalid group - skip it } $stepInfo = $stepIndex[$n]; if ($surveyMode == 'question') { if ($lastGseq != $stepInfo['gseq']) { // show the group label ++$gseq; $g = $_SESSION['grouplist'][$gseq]; $grel = !LimeExpressionManager::GroupIsIrrelevantOrHidden($gseq); if ($grel) { $gtitle = LimeExpressionManager::ProcessString($g[1]); echo '

' . FlattenText($gtitle) . "

"; } $lastGseq = $stepInfo['gseq']; } if (!$grel || !$stepInfo['show']) continue; $q = $_SESSION['fieldarray'][$n]; } else { ++$gseq; if (!$stepInfo['show']) continue; $g = $_SESSION['grouplist'][$gseq]; } if ($surveyMode == 'group') { $indexlabel = LimeExpressionManager::ProcessString($g[1]); } else { $indexlabel = LimeExpressionManager::ProcessString($q[3]); } $sText = (($surveyMode == 'group') ? FlattenText($indexlabel) : FlattenText($indexlabel)); $bGAnsw = !$stepInfo['anyUnanswered']; ++$v; $class = ($n == $_SESSION['step'] - 1? 'current': ($bGAnsw? 'answer': 'missing')); if($v % 2) $class .= " odd"; $s = $n + 1; echo "
$v$sText
"; } if($_SESSION['maxstep'] == $_SESSION['totalsteps']) { echo "\n"; } echo '
'; /* Can be replaced by php or in global js */ echo "\n"; echo "\n"; } echo "\n"; echo "\n"; echo "\n"; $_SESSION['LEMpostKey'] = mt_rand(); echo "\n"; if (isset($token) && !empty($token)) { echo "\n\n"; } } if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) { echo LimeExpressionManager::GetDebugTimingMessage(); } if (($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) { echo "
Group/Question Validation Results:".$moveResult['message']."
\n"; } echo "
\n"; echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); echo "\n"; doFooter(); // Closing PHP tag intentionally left out - yes, it is okay