本文整理汇总了PHP中LimeExpressionManager::GetQuestionSeq方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::GetQuestionSeq方法的具体用法?PHP LimeExpressionManager::GetQuestionSeq怎么用?PHP LimeExpressionManager::GetQuestionSeq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LimeExpressionManager
的用法示例。
在下文中一共展示了LimeExpressionManager::GetQuestionSeq方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
//.........这里部分代码省略.........
if ($surveyMode == 'group' && $previewgrp) {
// setcookie("limesurvey_timers", "0"); //@todo fix - sometimes results in headers already sent error
$_gid = sanitize_int($param['gid']);
LimeExpressionManager::StartSurvey($thissurvey['sid'], 'group', $surveyOptions, false, $LEMdebugLevel);
$gseq = LimeExpressionManager::GetGroupSeq($_gid);
if ($gseq == -1) {
echo gT('Invalid group number for this survey: ') . $_gid;
exit;
}
$moveResult = LimeExpressionManager::JumpTo($gseq + 1, true);
if (is_null($moveResult)) {
echo gT('This group contains no questions. You must add questions to this group before you can preview it');
exit;
}
if (isset($moveResult)) {
$_SESSION[$LEMsessid]['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[$LEMsessid]['grouplist'])) {
$gid = -1;
// Make sure the gid is unused. This will assure that the foreach (fieldarray as ia) has no effect.
$groupname = gT("Submit your answers");
$groupdescription = gT("There are no more questions. Please press the <Submit> button to finish this survey.");
} else {
if ($surveyMode != 'survey') {
if ($previewquestion) {
$_qid = sanitize_int($param['qid']);
LimeExpressionManager::StartSurvey($surveyid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qSec = LimeExpressionManager::GetQuestionSeq($_qid);
$moveResult = LimeExpressionManager::JumpTo($qSec + 1, true, false, true);
$stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
} else {
$stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
}
$gid = $stepInfo['gid'];
$groupname = $stepInfo['gname'];
$groupdescription = $stepInfo['gtext'];
}
}
}
if ($previewquestion) {
$_SESSION[$LEMsessid]['step'] = 0;
//maybe unset it after the question has been displayed?
}
if ($_SESSION[$LEMsessid]['step'] > $_SESSION[$LEMsessid]['maxstep']) {
$_SESSION[$LEMsessid]['maxstep'] = $_SESSION[$LEMsessid]['step'];
}
// If the survey uses answer persistence and a srid is registered in SESSION
// then loadanswers from this srid
/* Only survey mode used this - should all?
if ($thissurvey['tokenanswerspersistence'] == 'Y' &&
$thissurvey['anonymized'] == "N" &&
isset($_SESSION[$LEMsessid]['srid']) &&
$thissurvey['active'] == "Y")
{
loadanswers();
}
*/
//******************************************************************************************************
//PRESENT SURVEY
//******************************************************************************************************
示例2: 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);
//.........这里部分代码省略.........
示例3: run
//.........这里部分代码省略.........
if ($surveyMode == 'group' && $previewgrp) {
// setcookie("limesurvey_timers", "0"); //@todo fix - sometimes results in headers already sent error
$_gid = sanitize_int($param['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[$LEMsessid]['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[$LEMsessid]['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 <Submit> button to finish this survey.");
} else {
if ($surveyMode != 'survey') {
if ($previewquestion) {
$_qid = sanitize_int($param['qid']);
LimeExpressionManager::StartSurvey($surveyid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qSec = LimeExpressionManager::GetQuestionSeq($_qid);
$moveResult = LimeExpressionManager::JumpTo($qSec + 1, true, false, true);
$stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
} else {
$stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
}
$gid = $stepInfo['gid'];
$groupname = $stepInfo['gname'];
$groupdescription = $stepInfo['gtext'];
}
}
}
if ($previewquestion) {
$_SESSION[$LEMsessid]['step'] = 0;
//maybe unset it after the question has been displayed?
}
if ($_SESSION[$LEMsessid]['step'] > $_SESSION[$LEMsessid]['maxstep']) {
$_SESSION[$LEMsessid]['maxstep'] = $_SESSION[$LEMsessid]['step'];
}
// If the survey uses answer persistence and a srid is registered in SESSION
// then loadanswers from this srid
/* Only survey mode used this - should all?
if ($thissurvey['tokenanswerspersistence'] == 'Y' &&
$thissurvey['anonymized'] == "N" &&
isset($_SESSION[$LEMsessid]['srid']) &&
$thissurvey['active'] == "Y")
{
loadanswers();
}
*/
//******************************************************************************************************
//PRESENT SURVEY
//******************************************************************************************************
示例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');
示例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;
}
//.........这里部分代码省略.........