本文整理汇总了PHP中LimeExpressionManager::GetLastMoveResult方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::GetLastMoveResult方法的具体用法?PHP LimeExpressionManager::GetLastMoveResult怎么用?PHP LimeExpressionManager::GetLastMoveResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LimeExpressionManager
的用法示例。
在下文中一共展示了LimeExpressionManager::GetLastMoveResult方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templatereplace
//.........这里部分代码省略.........
if (stripos($line, "{ASSESSMENTS}")) {
$assessmenthtml = doAssessment($surveyid, false);
}
} else {
$_assessment_current_total = '';
}
if (isset($thissurvey['googleanalyticsapikey']) && trim($thissurvey['googleanalyticsapikey']) != '') {
$_googleAnalyticsAPIKey = trim($thissurvey['googleanalyticsapikey']);
} else {
$_googleAnalyticsAPIKey = trim(getGlobalSetting('googleanalyticsapikey'));
}
$_googleAnalyticsStyle = isset($thissurvey['googleanalyticsstyle']) ? $thissurvey['googleanalyticsstyle'] : '0';
$_googleAnalyticsJavaScript = '';
if ($_googleAnalyticsStyle != '' && $_googleAnalyticsStyle != 0 && $_googleAnalyticsAPIKey != '') {
switch ($_googleAnalyticsStyle) {
case '1':
// Default Google Tracking
$_googleAnalyticsJavaScript = <<<EOD
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{$_googleAnalyticsAPIKey}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
EOD;
break;
case '2':
// SurveyName-[SID]/[GSEQ]-GroupName - create custom GSEQ based upon page step
$moveInfo = LimeExpressionManager::GetLastMoveResult();
if (is_null($moveInfo)) {
$gseq = 'welcome';
} else {
if ($moveInfo['finished']) {
$gseq = 'finished';
} else {
if (isset($moveInfo['at_start']) && $moveInfo['at_start']) {
$gseq = 'welcome';
} else {
if (is_null($_groupname)) {
$gseq = 'printanswers';
} else {
$gseq = $moveInfo['gseq'] + 1;
}
}
}
}
$_trackURL = htmlspecialchars($thissurvey['name'] . '-[' . $surveyid . ']/[' . $gseq . ']-' . $_groupname);
$_googleAnalyticsJavaScript = <<<EOD
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{$_googleAnalyticsAPIKey}']);
_gaq.push(['_trackPageview','{$_trackURL}']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
EOD;
break;
示例2: do_array_dual
function do_array_dual($ia)
{
global $thissurvey;
$aLastMoveResult = LimeExpressionManager::GetLastMoveResult();
$aMandatoryViolationSubQ = $aLastMoveResult['mandViolation'] && $ia[6] == 'Y' ? explode("|", $aLastMoveResult['unansweredSQs']) : array();
$repeatheadings = Yii::app()->getConfig("repeatheadings");
$minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");
$extraclass = "";
$answertypeclass = "";
// Maybe not
$caption = "";
// Just leave empty, are replaced after
$inputnames = array();
$labelans1 = array();
$labelans = array();
$aQuestionAttributes = getQuestionAttributeValues($ia[0]);
if ($aQuestionAttributes['random_order'] == 1) {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY " . dbRandom();
} else {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY question_order";
}
$ansresult = dbExecuteAssoc($ansquery);
//Checked
$aSubQuestions = $ansresult->readAll();
$anscount = count($aSubQuestions);
$lquery = "SELECT * FROM {{answers}} WHERE scale_id=0 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lresult = dbExecuteAssoc($lquery);
//Checked
$aAnswersScale0 = $lresult->readAll();
$lquery1 = "SELECT * FROM {{answers}} WHERE scale_id=1 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lresult1 = dbExecuteAssoc($lquery1);
//Checked
$aAnswersScale1 = $lresult1->readAll();
if ($aQuestionAttributes['use_dropdown'] == 1) {
$useDropdownLayout = true;
$extraclass .= " dropdown-list";
$answertypeclass .= " dropdown";
$doDualScaleFunction = "doDualScaleDropDown";
// javascript funtion to lauch at end of answers
$caption = gT("An array with sub-question on each line, with 2 answers to provide on each line. You have to select the answer.");
} else {
$useDropdownLayout = false;
$extraclass .= " radio-list";
$answertypeclass .= " radio";
$doDualScaleFunction = "doDualScaleRadio";
$caption = gT("An array with sub-question on each line, with 2 answers to provide on each line. The answers are contained in the table header. ");
}
if (ctype_digit(trim($aQuestionAttributes['repeat_headings'])) && trim($aQuestionAttributes['repeat_headings'] != "")) {
$repeatheadings = intval($aQuestionAttributes['repeat_headings']);
$minrepeatheadings = 0;
}
if (trim($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
$leftheader = $aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
} else {
$leftheader = '';
}
if (trim($aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
$rightheader = $aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
} else {
$rightheader = '';
}
if (trim($aQuestionAttributes['answer_width']) != '') {
$answerwidth = $aQuestionAttributes['answer_width'];
} else {
$answerwidth = 20;
}
// Find if we have rigth and center text
// TODO move "|" to attribute
$sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%'";
$rigthCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
$rightexists = $rigthCount > 0;
// $right_exists: flag to find out if there are any right hand answer parts. leaving right column but don't force with
$sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%|%'";
$centerCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
$centerexists = $centerCount > 0;
// $center_exists: flag to find out if there are any center hand answer parts. leaving center column but don't force with
// Label and code for input
foreach ($aAnswersScale0 as $lrow) {
$labels0[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
}
foreach ($aAnswersScale1 as $lrow) {
$labels1[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
}
if (count($aAnswersScale0) > 0 && $anscount) {
$answer = "";
$fn = 1;
// Used by repeat_heading
if ($useDropdownLayout === false) {
$columnswidth = 100 - $answerwidth;
foreach ($aAnswersScale0 as $lrow) {
$labelans0[] = $lrow['answer'];
$labelcode0[] = $lrow['code'];
}
foreach ($aAnswersScale1 as $lrow) {
$labelans1[] = $lrow['answer'];
$labelcode1[] = $lrow['code'];
}
$numrows = count($labelans0) + count($labelans1);
// Add needed row and fill some boolean: shownoanswer, rightexists, centerexists
$shownoanswer = $ia[6] != "Y" && SHOW_NO_ANSWER == 1;
//.........这里部分代码省略.........
示例3: templatereplace
//.........这里部分代码省略.........
if (stripos($line, "{ASSESSMENTS}")) {
$assessmenthtml = doAssessment($surveyid, false);
}
} else {
$_assessment_current_total = '';
}
if (isset($thissurvey['googleanalyticsapikey']) && trim($thissurvey['googleanalyticsapikey']) != '') {
$_googleAnalyticsAPIKey = trim($thissurvey['googleanalyticsapikey']);
} else {
$_googleAnalyticsAPIKey = trim(getGlobalSetting('googleanalyticsapikey'));
}
$_googleAnalyticsStyle = isset($thissurvey['googleanalyticsstyle']) ? $thissurvey['googleanalyticsstyle'] : '0';
$_googleAnalyticsJavaScript = '';
if ($_googleAnalyticsStyle != '' && $_googleAnalyticsStyle != 0 && $_googleAnalyticsAPIKey != '') {
switch ($_googleAnalyticsStyle) {
case '1':
// Default Google Tracking
$_googleAnalyticsJavaScript = <<<EOD
<script>
(function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments) },i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{$_googleAnalyticsAPIKey}', 'auto'); // Replace with your property ID.
ga('send', 'pageview');
</script>
EOD;
break;
case '2':
// SurveyName-[SID]/[GSEQ]-GroupName - create custom GSEQ based upon page step
$moveInfo = LimeExpressionManager::GetLastMoveResult();
if (is_null($moveInfo)) {
$gseq = 'welcome';
} else {
if ($moveInfo['finished']) {
$gseq = 'finished';
} else {
if (isset($moveInfo['at_start']) && $moveInfo['at_start']) {
$gseq = 'welcome';
} else {
if (is_null($_groupname)) {
$gseq = 'printanswers';
} else {
$gseq = $moveInfo['gseq'] + 1;
}
}
}
}
$_trackURL = htmlspecialchars($thissurvey['name'] . '-[' . $surveyid . ']/[' . $gseq . ']-' . $_groupname);
$_googleAnalyticsJavaScript = <<<EOD
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{$_googleAnalyticsAPIKey}', 'auto'); // Replace with your property ID.
ga('send', 'pageview');
ga('send', 'pageview', '{$_trackURL}');
</script>
EOD;
break;
示例4: run
/**
* Main function
*
* @param mixed $surveyid
* @param mixed $args
*/
function run($surveyid, $args)
{
global $errormsg;
extract($args);
if (!$thissurvey) {
$thissurvey = getSurveyInfo($surveyid);
}
$LEMsessid = 'survey_' . $surveyid;
$this->setJavascriptVar($surveyid);
global $oTemplate;
$sTemplatePath = $oTemplate->path;
$sTemplateViewPath = $oTemplate->viewPath;
//$sTemplatePath=getTemplatePath(Yii::app()->getConfig("defaulttemplate")).DIRECTORY_SEPARATOR;
// TODO : check if necessary :
/*
if (isset ($_SESSION['survey_'.$surveyid]['templatepath']))
{
$sTemplatePath=$_SESSION['survey_'.$surveyid]['templatepath'];
}
*/
// $LEMdebugLevel - customizable debugging for Lime Expression Manager
$LEMdebugLevel = 0;
// LEM_DEBUG_TIMING; // (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);
$LEMskipReprocessing = false;
// true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript
switch ($thissurvey['format']) {
case "A":
//All in one
$surveyMode = 'survey';
break;
default:
case "S":
//One at a time
$surveyMode = 'question';
break;
case "G":
//Group at a time
$surveyMode = 'group';
break;
}
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['separator'];
$surveyOptions = array('active' => $thissurvey['active'] == 'Y', 'allowsave' => $thissurvey['allowsave'] == 'Y', 'anonymized' => $thissurvey['anonymized'] != 'N', 'assessments' => $thissurvey['assessments'] == 'Y', 'datestamp' => $thissurvey['datestamp'] == 'Y', 'deletenonvalues' => Yii::app()->getConfig('deletenonvalues'), 'hyperlinkSyntaxHighlighting' => ($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY, 'ipaddr' => $thissurvey['ipaddr'] == 'Y', 'radix' => $radix, 'refurl' => $thissurvey['refurl'] == "Y" && isset($_SESSION[$LEMsessid]['refurl']) ? $_SESSION[$LEMsessid]['refurl'] : NULL, 'savetimings' => $thissurvey['savetimings'] == "Y", 'surveyls_dateformat' => isset($thissurvey['surveyls_dateformat']) ? $thissurvey['surveyls_dateformat'] : 1, 'startlanguage' => isset(App()->language) ? App()->language : $thissurvey['language'], 'target' => Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $thissurvey['sid'] . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR, 'tempdir' => Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR, 'timeadjust' => isset($timeadjust) ? $timeadjust : 0, 'token' => isset($clienttoken) ? $clienttoken : NULL);
//Security Checked: POST, GET, SESSION, REQUEST, returnGlobal, DB
$previewgrp = false;
if ($surveyMode == 'group' && isset($param['action']) && $param['action'] == 'previewgroup') {
$previewgrp = true;
}
$previewquestion = false;
if ($surveyMode == 'question' && isset($param['action']) && $param['action'] == 'previewquestion') {
$previewquestion = true;
}
// if (isset($param['newtest']) && $param['newtest'] == "Y")
// setcookie("limesurvey_timers", "0"); //@todo fix - sometimes results in headers already sent error
$show_empty_group = false;
if ($previewgrp || $previewquestion) {
$_SESSION[$LEMsessid]['prevstep'] = 2;
$_SESSION[$LEMsessid]['maxstep'] = 0;
} else {
//RUN THIS IF THIS IS THE FIRST TIME , OR THE FIRST PAGE ########################################
if (!isset($_SESSION[$LEMsessid]['step'])) {
buildsurveysession($surveyid);
//TODO : check if necessary
//$sTemplatePath = $_SESSION[$LEMsessid]['templatepath'];
if ($surveyid != LimeExpressionManager::getLEMsurveyId()) {
LimeExpressionManager::SetDirtyFlag();
}
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, false, $LEMdebugLevel);
$_SESSION[$LEMsessid]['step'] = 0;
if ($surveyMode == 'survey') {
LimeExpressionManager::JumpTo(1, false, false, true);
} elseif (isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') {
$moveResult = LimeExpressionManager::NavigateForwards();
//$_SESSION[$LEMsessid]['step']=1;
}
} elseif ($surveyid != LimeExpressionManager::getLEMsurveyId()) {
$_SESSION[$LEMsessid]['step'] = $_SESSION[$LEMsessid]['step'] < 0 ? 0 : $_SESSION[$LEMsessid]['step'];
//$_SESSION[$LEMsessid]['step'] can not be less than 0, fix it always #09772
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, false, $LEMdebugLevel);
LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false, false);
}
$totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
if (!isset($_SESSION[$LEMsessid]['totalsteps'])) {
$_SESSION[$LEMsessid]['totalsteps'] = 0;
}
if (!isset($_SESSION[$LEMsessid]['maxstep'])) {
$_SESSION[$LEMsessid]['maxstep'] = 0;
}
if (isset($_SESSION[$LEMsessid]['LEMpostKey']) && isset($_POST['LEMpostKey']) && $_POST['LEMpostKey'] != $_SESSION[$LEMsessid]['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
//.........这里部分代码省略.........
示例5: run
/**
* Main function
*
* @param mixed $surveyid
* @param mixed $args
*/
function run($surveyid, $args)
{
global $errormsg;
extract($args);
$LEMsessid = 'survey_' . $surveyid;
$sTemplatePath = getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . DIRECTORY_SEPARATOR;
if (isset($_SESSION['survey_' . $surveyid]['templatepath'])) {
$sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
}
// $LEMdebugLevel - customizable debugging for Lime Expression Manager
$LEMdebugLevel = 0;
// LEM_DEBUG_TIMING; // (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);
$LEMskipReprocessing = false;
// true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript
switch ($thissurvey['format']) {
case "A":
//All in one
$surveyMode = 'survey';
break;
default:
case "S":
//One at a time
$surveyMode = 'question';
break;
case "G":
//Group at a time
$surveyMode = 'group';
break;
}
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['seperator'];
$surveyOptions = array('active' => $thissurvey['active'] == 'Y', 'allowsave' => $thissurvey['allowsave'] == 'Y', 'anonymized' => $thissurvey['anonymized'] != 'N', 'assessments' => $thissurvey['assessments'] == 'Y', 'datestamp' => $thissurvey['datestamp'] == 'Y', 'hyperlinkSyntaxHighlighting' => ($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY, 'ipaddr' => $thissurvey['ipaddr'] == 'Y', 'radix' => $radix, 'refurl' => $thissurvey['refurl'] == "Y" ? $_SESSION[$LEMsessid]['refurl'] : NULL, 'savetimings' => $thissurvey['savetimings'] == "Y", 'surveyls_dateformat' => isset($thissurvey['surveyls_dateformat']) ? $thissurvey['surveyls_dateformat'] : 1, 'startlanguage' => isset($clang->langcode) ? $clang->langcode : $thissurvey['language'], 'target' => Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $thissurvey['sid'] . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR, 'tempdir' => Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR, 'timeadjust' => isset($timeadjust) ? $timeadjust : 0, 'token' => isset($clienttoken) ? $clienttoken : NULL);
//Security Checked: POST, GET, SESSION, REQUEST, returnGlobal, DB
$previewgrp = false;
if ($surveyMode == 'group' && isset($param['action']) && $param['action'] == 'previewgroup') {
$previewgrp = true;
}
$previewquestion = false;
if ($surveyMode == 'question' && isset($param['action']) && $param['action'] == 'previewquestion') {
$previewquestion = true;
}
// if (isset($param['newtest']) && $param['newtest'] == "Y")
// setcookie("limesurvey_timers", "0"); //@todo fix - sometimes results in headers already sent error
$show_empty_group = false;
if ($previewgrp || $previewquestion) {
$_SESSION[$LEMsessid]['prevstep'] = 1;
$_SESSION[$LEMsessid]['maxstep'] = 0;
} else {
//RUN THIS IF THIS IS THE FIRST TIME , OR THE FIRST PAGE ########################################
if (!isset($_SESSION[$LEMsessid]['step'])) {
buildsurveysession($surveyid);
$sTemplatePath = $_SESSION[$LEMsessid]['templatepath'];
if ($surveyid != LimeExpressionManager::getLEMsurveyId()) {
LimeExpressionManager::SetDirtyFlag();
}
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, false, $LEMdebugLevel);
$_SESSION[$LEMsessid]['step'] = 0;
if ($surveyMode == 'survey') {
$move = "movenext";
// to force a call to NavigateForwards()
} elseif (isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') {
$move = "movenext";
$_SESSION[$LEMsessid]['step'] = 1;
}
} else {
if ($surveyid != LimeExpressionManager::getLEMsurveyId()) {
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, false, $LEMdebugLevel);
LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false, false);
}
}
$totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
if (!isset($_SESSION[$LEMsessid]['totalsteps'])) {
$_SESSION[$LEMsessid]['totalsteps'] = 0;
}
if (!isset($_SESSION[$LEMsessid]['maxstep'])) {
$_SESSION[$LEMsessid]['maxstep'] = 0;
}
if (isset($_SESSION[$LEMsessid]['LEMpostKey']) && isset($_POST['LEMpostKey']) && $_POST['LEMpostKey'] != $_SESSION[$LEMsessid]['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 = "<script type=\"text/javascript\">\n\n <!--\n \$(document).ready(function(){\n alert(\"" . $clang->gT("Please use the LimeSurvey navigation buttons or index. It appears you attempted to use the browser back button to re-submit a page.", "js") . "\");});\n //-->\n\n </script>\n";
}
//.........这里部分代码省略.........
示例6: do_array_dual
function do_array_dual($ia)
{
global $thissurvey;
$aLastMoveResult = LimeExpressionManager::GetLastMoveResult();
$aMandatoryViolationSubQ = $aLastMoveResult['mandViolation'] && $ia[6] == 'Y' ? explode("|", $aLastMoveResult['unansweredSQs']) : array();
$repeatheadings = Yii::app()->getConfig("repeatheadings");
$minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");
$extraclass = "";
$answertypeclass = "";
// Maybe not
$caption = "";
// Just leave empty, are replaced after
$inputnames = array();
$labelans1 = array();
$labelans = array();
/*
* Get Question Attributes
*/
$aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]);
// Get questions and answers by defined order
if ($aQuestionAttributes['random_order'] == 1) {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY " . dbRandom();
} else {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY question_order";
}
$ansresult = dbExecuteAssoc($ansquery);
//Checked
$aSubQuestions = $ansresult->readAll();
$anscount = count($aSubQuestions);
$lquery = "SELECT * FROM {{answers}} WHERE scale_id=0 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lresult = dbExecuteAssoc($lquery);
//Checked
$aAnswersScale0 = $lresult->readAll();
$lquery1 = "SELECT * FROM {{answers}} WHERE scale_id=1 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lresult1 = dbExecuteAssoc($lquery1);
//Checked
$aAnswersScale1 = $lresult1->readAll();
// Set attributes
if ($aQuestionAttributes['use_dropdown'] == 1) {
$useDropdownLayout = true;
$extraclass .= " dropdown-list";
$answertypeclass .= " dropdown";
$doDualScaleFunction = "doDualScaleDropDown";
// javascript funtion to lauch at end of answers
$caption = gT("A table with a subquestion on each row, with two answers to provide on each line. Please select the answers.");
} else {
$useDropdownLayout = false;
$extraclass .= " radio-list";
$answertypeclass .= " radio";
$doDualScaleFunction = "doDualScaleRadio";
$caption = gT("A table with one subquestion on each row and two answers to provide on each row. The related answer options are in the top table header row.");
}
if (ctype_digit(trim($aQuestionAttributes['repeat_headings'])) && trim($aQuestionAttributes['repeat_headings'] != "")) {
$repeatheadings = intval($aQuestionAttributes['repeat_headings']);
$minrepeatheadings = 0;
}
$leftheader = trim($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '' ? $leftheader = $aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']] : '';
$rightheader = trim($aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '' ? $aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']] : '';
$answerwidth = trim($aQuestionAttributes['answer_width']) != '' ? $aQuestionAttributes['answer_width'] : 20;
// Find if we have rigth and center text
$sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%'";
$rigthCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
$rightexists = $rigthCount > 0;
// $right_exists: flag to find out if there are any right hand answer parts. leaving right column but don't force with
$sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%|%'";
$centerCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
$centerexists = $centerCount > 0;
// $center_exists: flag to find out if there are any center hand answer parts. leaving center column but don't force with
// Label and code for input
foreach ($aAnswersScale0 as $lrow) {
$labels0[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
}
foreach ($aAnswersScale1 as $lrow) {
$labels1[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
}
if (count($aAnswersScale0) > 0 && $anscount) {
$answer = "";
$fn = 1;
// Used by repeat_heading
// No drop-down
if ($useDropdownLayout === false) {
$aData = array();
$aData['answertypeclass'] = $answertypeclass;
$columnswidth = 100 - $answerwidth;
$labelans0 = array();
$labelans1 = array();
$labelcode0 = array();
$labelcode1 = array();
foreach ($aAnswersScale0 as $lrow) {
$labelans0[] = $lrow['answer'];
$labelcode0[] = $lrow['code'];
}
foreach ($aAnswersScale1 as $lrow) {
$labelans1[] = $lrow['answer'];
$labelcode1[] = $lrow['code'];
}
$numrows = count($labelans0) + count($labelans1);
// Add needed row and fill some boolean: shownoanswer, rightexists, centerexists
$shownoanswer = $ia[6] != "Y" && SHOW_NO_ANSWER == 1;
if ($shownoanswer) {
//.........这里部分代码省略.........
示例7: templatereplace
//.........这里部分代码省略.........
if (!is_null($surveyid) && function_exists('doAssessment')) {
$assessmentdata = doAssessment($surveyid, true);
$_assessment_current_total = $assessmentdata['total'];
} else {
$_assessment_current_total = '';
}
if (isset($thissurvey['googleanalyticsapikey']) && trim($thissurvey['googleanalyticsapikey']) != '') {
$_googleAnalyticsAPIKey = trim($thissurvey['googleanalyticsapikey']);
} else {
$_googleAnalyticsAPIKey = trim(getGlobalSetting('googleanalyticsapikey'));
}
$_googleAnalyticsStyle = isset($thissurvey['googleanalyticsstyle']) ? $thissurvey['googleanalyticsstyle'] : '0';
$_googleAnalyticsJavaScript = '';
if ($_googleAnalyticsStyle != '' && $_googleAnalyticsStyle != 0 && $_googleAnalyticsAPIKey != '') {
switch ($_googleAnalyticsStyle) {
case '1':
// Default Google Tracking
$_googleAnalyticsJavaScript = <<<EOD
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{$_googleAnalyticsAPIKey}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
EOD;
break;
case '2':
// SurveyName-[SID]/[GSEQ]-GroupName - create custom GSEQ based upon page step
$moveInfo = LimeExpressionManager::GetLastMoveResult();
if (is_null($moveInfo)) {
$gseq = 'welcome';
} else {
if ($moveInfo['finished']) {
$gseq = 'finished';
} else {
if (isset($moveInfo['at_start']) && $moveInfo['at_start']) {
$gseq = 'welcome';
} else {
if (is_null($_groupname)) {
$gseq = 'printanswers';
} else {
$gseq = $moveInfo['gseq'] + 1;
}
}
}
}
$_trackURL = htmlentities($thissurvey['name'] . '-[' . $surveyid . ']/[' . $gseq . ']-' . $_groupname, ENT_QUOTES);
$_googleAnalyticsJavaScript = <<<EOD
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{$_googleAnalyticsAPIKey}']);
_gaq.push(['_trackPageview','{$_trackURL}']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
EOD;
break;
示例8: showsaveform
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 ($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'];