本文整理汇总了PHP中LimeExpressionManager::JumpTo方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::JumpTo方法的具体用法?PHP LimeExpressionManager::JumpTo怎么用?PHP LimeExpressionManager::JumpTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LimeExpressionManager
的用法示例。
在下文中一共展示了LimeExpressionManager::JumpTo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preview
/**
* Load preview of a question screen.
*
* @access public
* @param int $surveyid
* @param int $qid
* @param string $lang
* @return void
*/
public function preview($surveyid, $qid, $lang = null)
{
$surveyid = sanitize_int($surveyid);
$qid = sanitize_int($qid);
$LEMdebugLevel = 0;
Yii::app()->loadHelper("qanda");
Yii::app()->loadHelper("surveytranslator");
if (empty($surveyid)) {
$this->getController()->error('No Survey ID provided');
}
if (empty($qid)) {
$this->getController()->error('No Question ID provided');
}
if (empty($lang)) {
$language = Survey::model()->findByPk($surveyid)->language;
} else {
$language = $lang;
}
if (!isset(Yii::app()->session['step'])) {
Yii::app()->session['step'] = 0;
}
if (!isset(Yii::app()->session['prevstep'])) {
Yii::app()->session['prevstep'] = 0;
}
if (!isset(Yii::app()->session['maxstep'])) {
Yii::app()->session['maxstep'] = 0;
}
// Use $_SESSION instead of $this->session for frontend features.
$_SESSION['survey_' . $surveyid]['s_lang'] = $language;
$_SESSION['survey_' . $surveyid]['fieldmap'] = createFieldMap($surveyid, 'full', true, $qid, $language);
// Prefill question/answer from defaultvalues
foreach ($_SESSION['survey_' . $surveyid]['fieldmap'] as $field) {
if (isset($field['defaultvalue'])) {
$_SESSION['survey_' . $surveyid][$field['fieldname']] = $field['defaultvalue'];
}
}
$clang = new limesurvey_lang($language);
$thissurvey = getSurveyInfo($surveyid);
setNoAnswerMode($thissurvey);
Yii::app()->session['dateformats'] = getDateFormatData($thissurvey['surveyls_dateformat']);
$qrows = Questions::model()->findByAttributes(array('sid' => $surveyid, 'qid' => $qid, 'language' => $language))->getAttributes();
$ia = array(0 => $qid, 1 => $surveyid . 'X' . $qrows['gid'] . 'X' . $qid, 2 => $qrows['title'], 3 => $qrows['question'], 4 => $qrows['type'], 5 => $qrows['gid'], 6 => $qrows['mandatory'], 7 => 'N', 8 => 'N');
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['seperator'];
$surveyOptions = array('radix' => $radix, 'tempdir' => Yii::app()->getConfig('tempdir'));
LimeExpressionManager::StartSurvey($surveyid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq + 1, true, false, true);
$answers = retrieveAnswers($ia, $surveyid);
if (!$thissurvey['template']) {
$thistpl = getTemplatePath(Yii::app()->getConfig('defaulttemplate'));
} else {
$thistpl = getTemplatePath(validateTemplateDir($thissurvey['template']));
}
doHeader();
$showQuestion = "\$('#question{$qid}').show();";
$dummy_js = <<<EOD
<script type='text/javascript'>
<!--
LEMradix='{$radix}';
var numRegex = new RegExp('[^-' + LEMradix + '0-9]','g');
var intRegex = new RegExp('[^-0-9]','g');
function fixnum_checkconditions(value, name, type, evt_type, intonly)
{
newval = new String(value);
if (typeof intonly !=='undefined' && intonly==1) {
newval = newval.replace(intRegex,'');
}
else {
newval = newval.replace(numRegex,'');
}
if (LEMradix === ',') {
newval = newval.split(',').join('.');
}
if (newval != '-' && newval != '.' && newval != '-.' && newval != parseFloat(newval)) {
newval = '';
}
displayVal = newval;
if (LEMradix === ',') {
displayVal = displayVal.split('.').join(',');
}
if (name.match(/other\$/)) {
\$('#answer'+name+'text').val(displayVal);
}
\$('#answer'+name).val(displayVal);
if (typeof evt_type === 'undefined')
{
evt_type = 'onchange';
}
checkconditions(newval, name, type, evt_type);
//.........这里部分代码省略.........
示例2: 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
//.........这里部分代码省略.........
示例3: 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";
}
//.........这里部分代码省略.........
示例4: ShowSurveyLogicFile
/**
* Create HTML view of the survey, showing everything that uses EM
* @param <type> $sid
* @param <type> $gid
* @param <type> $qid
*/
public static function ShowSurveyLogicFile($sid, $gid = NULL, $qid = NULL, $LEMdebugLevel = 0, $assessments = false)
{
// Title
// Welcome
// G1, name, relevance, text
// *Q1, name [type], relevance [validation], text, help, default, help_msg
// SQ1, name [scale], relevance [validation], text
// A1, code, assessment_value, text
// End Message
$LEM =& LimeExpressionManager::singleton();
$LEM->sPreviewMode = 'logic';
$aSurveyInfo = getSurveyInfo($sid, $_SESSION['LEMlang']);
$allErrors = array();
$warnings = 0;
$surveyOptions = array('assessments' => $aSurveyInfo['assessments'] == 'Y', 'hyperlinkSyntaxHighlighting' => true);
$varNamesUsed = array();
// keeps track of whether variables have been declared
if (!is_null($qid)) {
$surveyMode = 'question';
LimeExpressionManager::StartSurvey($sid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq + 1, true, false, true);
} else {
if (!is_null($gid)) {
$surveyMode = 'group';
LimeExpressionManager::StartSurvey($sid, 'group', $surveyOptions, false, $LEMdebugLevel);
$gseq = LimeExpressionManager::GetGroupSeq($gid);
$moveResult = LimeExpressionManager::JumpTo($gseq + 1, true, false, true);
} else {
$surveyMode = 'survey';
LimeExpressionManager::StartSurvey($sid, 'survey', $surveyOptions, false, $LEMdebugLevel);
$moveResult = LimeExpressionManager::NavigateForwards();
}
}
$qtypes = getQuestionTypeList('', 'array');
if (is_null($moveResult) || is_null($LEM->currentQset) || count($LEM->currentQset) == 0) {
return array('errors' => 1, 'html' => sprintf($LEM->gT('Invalid question - probably missing sub-questions or language-specific settings for language %s'), $_SESSION['LEMlang']));
}
$surveyname = templatereplace('{SURVEYNAME}', array('SURVEYNAME' => $aSurveyInfo['surveyls_title']));
$out = '<div id="showlogicfilediv" ><H3>' . $LEM->gT('Logic File for Survey # ') . '[' . $LEM->sid . "]: {$surveyname}</H3>\n";
$out .= "<table class='table' id='logicfiletable'>";
if (is_null($gid) && is_null($qid)) {
if ($aSurveyInfo['surveyls_description'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_description'], 0);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("Description:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_welcometext'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_welcometext'], 0);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("Welcome:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_endtext'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_endtext']);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("End message:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_url'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_urldescription'] . " - " . $aSurveyInfo['surveyls_url']);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("End URL:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
}
$out .= "<tr><th>#</th><th>" . $LEM->gT('Name [ID]') . "</th><th>" . $LEM->gT('Relevance [Validation] (Default value)') . "</th><th>" . $LEM->gT('Text [Help] (Tip)') . "</th></tr>\n";
$_gseq = -1;
foreach ($LEM->currentQset as $q) {
$gseq = $q['info']['gseq'];
$gid = $q['info']['gid'];
$qid = $q['info']['qid'];
$qseq = $q['info']['qseq'];
$errorCount = 0;
//////
// SHOW GROUP-LEVEL INFO
//////
if ($gseq != $_gseq) {
$LEM->ParseResultCache = array();
// reset for each group so get proper color coding?
$_gseq = $gseq;
$ginfo = $LEM->gseq2info[$gseq];
$grelevance = '{' . ($ginfo['grelevance'] == '' ? 1 : $ginfo['grelevance']) . '}';
$gtext = trim($ginfo['description']) == '' ? ' ' : $ginfo['description'];
$editlink = Yii::app()->getController()->createUrl('admin/questiongroups/sa/view/surveyid/' . $LEM->sid . '/gid/' . $gid);
$groupRow = "<tr class='LEMgroup'>" . "<td>G-{$gseq}</td>" . "<td><b>" . $ginfo['group_name'] . "</b><br />[<a target='_blank' href='{$editlink}'>GID " . $gid . "</a>]</td>" . "<td>" . $grelevance . "</td>" . "<td>" . $gtext . "</td>" . "</tr>\n";
$LEM->ProcessString($groupRow, $qid, NULL, false, 1, 1, false, false);
$out .= $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
}
//////
//.........这里部分代码省略.........
示例5: limesurvey_lang
$_SESSION['s_lang'] = $language;
$clang = new limesurvey_lang($language);
$thissurvey = getSurveyInfo($surveyid);
$_SESSION['dateformats'] = getDateFormatData($thissurvey['surveyls_dateformat']);
require_once dirname(__FILE__) . '/../qanda.php';
$qquery = 'SELECT * FROM ' . db_table_name('questions') . " WHERE sid='{$surveyid}' AND qid='{$qid}' AND language='{$language}'";
$qresult = db_execute_assoc($qquery);
$qrows = $qresult->FetchRow();
$ia = array(0 => $qid, 1 => $surveyid . 'X' . $qrows['gid'] . 'X' . $qid, 2 => $qrows['title'], 3 => $qrows['question'], 4 => $qrows['type'], 5 => $qrows['gid'], 6 => $qrows['mandatory'], 7 => 'N', 8 => 'N');
// ia[8] is usedinconditions
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['seperator'];
$surveyOptions = array('radix' => $radix);
LimeExpressionManager::StartSurvey($thissurvey['sid'], 'question', $surveyOptions, false, $LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq + 1, true, false, true);
$answers = retrieveAnswers($ia);
if (!$thissurvey['template']) {
$thistpl = sGetTemplatePath($defaulttemplate);
} else {
$thistpl = sGetTemplatePath(validate_templatedir($thissurvey['template']));
}
doHeader();
$showQuestion = "\$('#question{$qid}').show();";
$dummy_js = <<<EOD
<script type='text/javascript'>
<!--
LEMradix='{$radix}';
var numRegex = new RegExp('[^-' + LEMradix + '0-9]','g');
var intRegex = new RegExp('[^-0-9]','g');
\tfunction fixnum_checkconditions(value, name, type, evt_type, intonly)
示例6: ShowSurveyLogicFile
/**
* Create HTML view of the survey, showing everything that uses EM
* @param <type> $sid
* @param <type> $gid
* @param <type> $qid
*/
public static function ShowSurveyLogicFile($sid, $gid = NULL, $qid = NULL, $LEMdebugLevel = 0, $assessments = false)
{
// Title
// Welcome
// G1, name, relevance, text
// *Q1, name [type], relevance [validation], text, help, default, help_msg
// SQ1, name [scale], relevance [validation], text
// A1, code, assessment_value, text
// End Message
global $rooturl;
$LEM =& LimeExpressionManager::singleton();
$allErrors = array();
$surveyOptions = array('assessments' => $assessments, 'hyperlinkSyntaxHighlighting' => true, 'rooturl' => $rooturl);
$varNamesUsed = array();
// keeps track of whether variables have been declared
if (!is_null($qid)) {
$surveyMode = 'question';
LimeExpressionManager::StartSurvey($sid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq + 1, true, false, true);
} else {
if (!is_null($gid)) {
$surveyMode = 'group';
LimeExpressionManager::StartSurvey($sid, 'group', $surveyOptions, false, $LEMdebugLevel);
$gseq = LimeExpressionManager::GetGroupSeq($gid);
$moveResult = LimeExpressionManager::JumpTo($gseq + 1, true, false, true);
} else {
$surveyMode = 'survey';
LimeExpressionManager::StartSurvey($sid, 'survey', $surveyOptions, false, $LEMdebugLevel);
$moveResult = LimeExpressionManager::NavigateForwards();
}
}
$qtypes = getqtypelist('', 'array');
templatereplace('{SITENAME}');
// to ensure that lime replacement fields loaded
if (is_null($moveResult) || is_null($LEM->currentQset) || count($LEM->currentQset) == 0) {
return array('errors' => 1, 'html' => $LEM->gT('Invalid question - probably missing sub-questions or language-specific settings for language ') . $_SESSION['LEMlang']);
}
$out = "<table border='1'>" . "<tr><th>#</th><th>" . $LEM->gT('Name [ID]') . "</th><th>" . $LEM->gT('Relevance [Validation] (Default)') . "</th><th>" . $LEM->gT('Text [Help] (Tip)') . "</th></tr>\n";
$_gseq = -1;
foreach ($LEM->currentQset as $q) {
$gseq = $q['info']['gseq'];
$gid = $q['info']['gid'];
$qid = $q['info']['qid'];
$qseq = $q['info']['qseq'];
$errorCount = 0;
//////
// SHOW GROUP-LEVEL INFO
//////
if ($gseq != $_gseq) {
$LEM->ParseResultCache = array();
// reset for each group so get proper color coding?
$_gseq = $gseq;
$ginfo = $LEM->gseq2info[$gseq];
$grelevance = '{' . ($ginfo['grelevance'] == '' ? 1 : $ginfo['grelevance']) . '}';
$gtext = trim($ginfo['description']) == '' ? ' ' : $ginfo['description'];
$groupRow = "<tr class='LEMgroup'>" . "<td>G-{$gseq}</td>" . "<td><b>" . $ginfo['group_name'] . "</b><br/>[<a target='_blank' href='{$rooturl}/admin/admin.php?action=orderquestions&sid={$sid}&gid={$gid}'>GID " . $gid . "</a>]</td>" . "<td>" . $grelevance . "</td>" . "<td>" . $gtext . "</td>" . "</tr>\n";
$LEM->ProcessString($groupRow, $qid, NULL, false, 1, 1, false, false);
$out .= $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
}
//////
// SHOW QUESTION-LEVEL INFO
//////
$mandatory = $q['info']['mandatory'] == 'Y' ? "<span style='color:red'>*</span>" : '';
$type = $q['info']['type'];
$typedesc = $qtypes[$type]['description'];
$sgqas = explode('|', $q['sgqa']);
if (count($sgqas) == 1 && !is_null($q['info']['default'])) {
$LEM->ProcessString($q['info']['default'], $qid, NULL, false, 1, 1, false, false);
$_default = $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
$default = '<br/>(' . $LEM->gT('DEFAULT:') . ' ' . $_default . ')';
} else {
$default = '';
}
$qtext = $q['info']['qtext'] != '' ? $q['info']['qtext'] : ' ';
$help = $q['info']['help'] != '' ? '<hr/>[' . $LEM->gT("HELP:") . ' ' . $q['info']['help'] . ']' : '';
$prettyValidTip = $q['prettyValidTip'] == '' ? '' : '<hr/>(' . $LEM->gT("TIP:") . ' ' . $q['prettyValidTip'] . ')';
//////
// SHOW QUESTION ATTRIBUTES THAT ARE PROCESSED BY EM
//////
$attrTable = '';
if (isset($LEM->qattr[$qid]) && count($LEM->qattr[$qid]) > 0) {
$attrTable = "<hr/><table border='1'><tr><th>" . $LEM->gT("Question Attribute") . "</th><th>" . $LEM->gT("Value") . "</th></tr>\n";
$count = 0;
foreach ($LEM->qattr[$qid] as $key => $value) {
if (is_null($value) || trim($value) == '') {
continue;
}
//.........这里部分代码省略.........
示例7: templatereplace
echo "\t" . $clang->gT("Sorry. There is no matching survey.") . "<br /></center> \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;