本文整理汇总了PHP中LimeExpressionManager::FinishProcessingGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::FinishProcessingGroup方法的具体用法?PHP LimeExpressionManager::FinishProcessingGroup怎么用?PHP LimeExpressionManager::FinishProcessingGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LimeExpressionManager
的用法示例。
在下文中一共展示了LimeExpressionManager::FinishProcessingGroup方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
//.........这里部分代码省略.........
if (!$previewquestion && trim($redata['groupdescription']) == "") {
echo templatereplace(file_get_contents($sTemplateViewPath . "groupdescription.pstpl"), array(), $redata);
}
echo "\n";
echo "\n\n<!-- PRESENT THE QUESTIONS (in SurveyRunTime ) -->\n";
foreach ($qanda as $qa) {
// Test if finalgroup is in this qid (for all in one survey, else we do only qanda for needed question (in one by one or group by goup)
if ($gid != $qa['finalgroup']) {
continue;
}
$qid = $qa[4];
$qinfo = LimeExpressionManager::GetQuestionStatus($qid);
$lastgrouparray = explode("X", $qa[7]);
$lastgroup = $lastgrouparray[0] . "X" . $lastgrouparray[1];
// id of the last group, derived from question id
$lastanswer = $qa[7];
$n_q_display = '';
if ($qinfo['hidden'] && $qinfo['info']['type'] != '*') {
continue;
// skip this one
}
$aReplacement = array();
$question = $qa[0];
//===================================================================
// The following four variables offer the templating system the
// capacity to fully control the HTML output for questions making the
// above echo redundant if desired.
$question['sgq'] = $qa[7];
$question['aid'] = !empty($qinfo['info']['aid']) ? $qinfo['info']['aid'] : 0;
$question['sqid'] = !empty($qinfo['info']['sqid']) ? $qinfo['info']['sqid'] : 0;
//===================================================================
$question_template = file_get_contents($sTemplateViewPath . 'question.pstpl');
// Fix old template : can we remove it ? Old template are surely already broken by another issue
if (preg_match('/\\{QUESTION_ESSENTIALS\\}/', $question_template) === false || preg_match('/\\{QUESTION_CLASS\\}/', $question_template) === false) {
// if {QUESTION_ESSENTIALS} is present in the template but not {QUESTION_CLASS} remove it because you don't want id="" and display="" duplicated.
$question_template = str_replace('{QUESTION_ESSENTIALS}', '', $question_template);
$question_template = str_replace('{QUESTION_CLASS}', '', $question_template);
$question_template = "<div {QUESTION_ESSENTIALS} class='{QUESTION_CLASS} {QUESTION_MAN_CLASS} {QUESTION_INPUT_ERROR_CLASS}'" . $question_template . "</div>";
}
$redata = compact(array_keys(get_defined_vars()));
$aQuestionReplacement = $this->getQuestionReplacement($qa);
echo templatereplace($question_template, $aQuestionReplacement, $redata, false, false, $qa[4]);
}
if ($surveyMode == 'group') {
echo "<input type='hidden' name='lastgroup' value='{$lastgroup}' id='lastgroup' />\n";
// for counting the time spent on each group
}
if ($surveyMode == 'question') {
echo "<input type='hidden' name='lastanswer' value='{$lastanswer}' id='lastanswer' />\n";
}
echo "\n\n<!-- END THE GROUP -->\n";
echo templatereplace(file_get_contents($sTemplateViewPath . "endgroup.pstpl"), array(), $redata);
echo "\n\n</div>\n";
Yii::app()->setConfig('gid', '');
}
LimeExpressionManager::FinishProcessingGroup($LEMskipReprocessing);
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
/**
* Navigator
*/
if (!$previewgrp && !$previewquestion) {
$aNavigator = surveymover();
$moveprevbutton = $aNavigator['sMovePrevButton'];
$movenextbutton = $aNavigator['sMoveNextButton'];
$navigator = $moveprevbutton . ' ' . $movenextbutton;
$redata = compact(array_keys(get_defined_vars()));
echo "\n\n<!-- PRESENT THE NAVIGATOR -->\n";
echo templatereplace(file_get_contents($sTemplateViewPath . "navigator.pstpl"), array(), $redata);
echo "\n";
if ($thissurvey['active'] != "Y") {
echo "<p style='text-align:center' class='error'>" . gT("This survey is currently not active. You will not be able to save your responses.") . "</p>\n";
}
if ($surveyMode != 'survey' && $thissurvey['questionindex'] == 1) {
$this->createIncrementalQuestionIndex($LEMsessid, $surveyMode);
$this->createIncrementalQuestionIndexMenu($LEMsessid, $surveyMode);
} elseif ($surveyMode != 'survey' && $thissurvey['questionindex'] == 2) {
$this->createFullQuestionIndex($LEMsessid, $surveyMode);
$this->createFullQuestionIndexMenu($LEMsessid, $surveyMode);
}
echo "<input type='hidden' name='thisstep' value='{$_SESSION[$LEMsessid]['step']}' id='thisstep' />\n";
echo "<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
echo "<input type='hidden' name='start_time' value='" . time() . "' id='start_time' />\n";
$_SESSION[$LEMsessid]['LEMpostKey'] = mt_rand();
echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION[$LEMsessid]['LEMpostKey']}' id='LEMpostKey' />\n";
if (isset($token) && !empty($token)) {
echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
}
}
if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) {
echo LimeExpressionManager::GetDebugTimingMessage();
}
if (($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) {
echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>" . $moveResult['message'] . "</td></tr></table>\n";
}
echo "</form>\n";
echo templatereplace(file_get_contents($sTemplateViewPath . "endpage.pstpl"), array(), $redata);
echo "\n";
doFooter();
}
示例2: view
//.........这里部分代码省略.........
//ARRAY (10 POINT CHOICE) radio-buttons
$meaquery = "SELECT title, question FROM {{questions}} WHERE parent_qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery);
$cdata['mearesult'] = $mearesult->readAll();
case "C":
//ARRAY (YES/UNCERTAIN/NO) radio-buttons
$meaquery = "SELECT title, question FROM {{questions}} WHERE parent_qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery);
$cdata['mearesult'] = $mearesult->readAll();
break;
case "E":
//ARRAY (YES/UNCERTAIN/NO) radio-buttons
$meaquery = "SELECT title, question FROM {{questions}} WHERE parent_qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery) or safeDie("Couldn't get answers, Type \"E\"<br />{$meaquery}<br />");
$cdata['mearesult'] = $mearesult->readAll();
break;
case ":":
//ARRAY (Multi Flexi)
// $qidattributes=getQuestionAttributeValues($deqrow['qid']);
$minvalue = 1;
$maxvalue = 10;
if (trim($qidattributes['multiflexible_max']) != '' && trim($qidattributes['multiflexible_min']) == '') {
$maxvalue = $qidattributes['multiflexible_max'];
$minvalue = 1;
}
if (trim($qidattributes['multiflexible_min']) != '' && trim($qidattributes['multiflexible_max']) == '') {
$minvalue = $qidattributes['multiflexible_min'];
$maxvalue = $qidattributes['multiflexible_min'] + 10;
}
if (trim($qidattributes['multiflexible_min']) != '' && trim($qidattributes['multiflexible_max']) != '') {
if ($qidattributes['multiflexible_min'] < $qidattributes['multiflexible_max']) {
$minvalue = $qidattributes['multiflexible_min'];
$maxvalue = $qidattributes['multiflexible_max'];
}
}
if (trim($qidattributes['multiflexible_step']) != '') {
$stepvalue = $qidattributes['multiflexible_step'];
} else {
$stepvalue = 1;
}
if ($qidattributes['multiflexible_checkbox'] != 0) {
$minvalue = 0;
$maxvalue = 1;
$stepvalue = 1;
}
$cdata['minvalue'] = $minvalue;
$cdata['maxvalue'] = $maxvalue;
$cdata['stepvalue'] = $stepvalue;
$lquery = "SELECT question, title FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and scale_id=1 and language='{$sDataEntryLanguage}' ORDER BY question_order";
$lresult = dbExecuteAssoc($lquery) or die("Couldn't get labels, Type \":\"<br />{$lquery}<br />");
$cdata['lresult'] = $lresult->readAll();
$meaquery = "SELECT question, title FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and scale_id=0 and language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery) or die("Couldn't get answers, Type \":\"<br />{$meaquery}<br />");
$cdata['mearesult'] = $mearesult->readAll();
break;
case ";":
//ARRAY (Multi Flexi)
$lquery = "SELECT * FROM {{questions}} WHERE scale_id=1 and parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
$lresult = dbExecuteAssoc($lquery) or die("Couldn't get labels, Type \":\"<br />{$lquery}<br />");
$cdata['lresult'] = $lresult->readAll();
$meaquery = "SELECT * FROM {{questions}} WHERE scale_id=0 and parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery) or die("Couldn't get answers, Type \":\"<br />{$meaquery}<br />");
$cdata['mearesult'] = $mearesult->readAll();
break;
case "F":
//ARRAY (Flexible Labels)
//ARRAY (Flexible Labels)
case "H":
$meaquery = "SELECT * FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery) or safeDie("Couldn't get answers, Type \"E\"<br />{$meaquery}<br />");
$cdata['mearesult'] = $mearesult->readAll();
$fquery = "SELECT * FROM {{answers}} WHERE qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY sortorder, code";
$fresult = dbExecuteAssoc($fquery);
$cdata['fresult'] = $fresult->readAll();
break;
}
$cdata['sDataEntryLanguage'] = $sDataEntryLanguage;
$viewdata = $this->getController()->render("/admin/dataentry/content_view", $cdata, TRUE);
$viewdata_em = LimeExpressionManager::ProcessString($viewdata, $deqrow['qid'], NULL, false, 1, 1);
$aDataentryoutput .= $viewdata_em;
}
LimeExpressionManager::FinishProcessingGroup();
}
LimeExpressionManager::FinishProcessingPage();
$aDataentryoutput .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
$aViewUrls['output'] = $aDataentryoutput;
$aData['thissurvey'] = $thissurvey;
$aData['surveyid'] = $surveyid;
$aData['sDataEntryLanguage'] = $sDataEntryLanguage;
if ($thissurvey['active'] == "Y" && $thissurvey['allowsave'] == "Y") {
$slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$sbaselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($slangs, $sbaselang);
$aData['slangs'] = $slangs;
$aData['baselang'] = $baselang;
}
$aViewUrls[] = 'active_html_view';
$this->_renderWrappedTemplate('dataentry', $aViewUrls, $aData);
}
}
示例3: _showReorderForm
private function _showReorderForm($iSurveyID)
{
// Prepare data for the view
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
LimeExpressionManager::StartSurvey($iSurveyID, 'survey');
LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
$aGrouplist = QuestionGroup::model()->getGroups($iSurveyID);
$initializedReplacementFields = false;
foreach ($aGrouplist as $iGID => $aGroup) {
LimeExpressionManager::StartProcessingGroup($aGroup['gid'], false, $iSurveyID);
if (!$initializedReplacementFields) {
templatereplace("{SITENAME}");
// Hack to ensure the EM sets values of LimeReplacementFields
$initializedReplacementFields = true;
}
$oQuestionData = Question::model()->getQuestions($iSurveyID, $aGroup['gid'], $sBaseLanguage);
$qs = array();
$junk = array();
foreach ($oQuestionData->readAll() as $q) {
$relevance = $q['relevance'] == '' ? 1 : $q['relevance'];
$question = '[{' . $relevance . '}] ' . $q['question'];
LimeExpressionManager::ProcessString($question, $q['qid']);
$q['question'] = LimeExpressionManager::GetLastPrettyPrintExpression();
$q['gid'] = $aGroup['gid'];
$qs[] = $q;
}
$aGrouplist[$iGID]['questions'] = $qs;
LimeExpressionManager::FinishProcessingGroup();
}
LimeExpressionManager::FinishProcessingPage();
$aData['aGroupsAndQuestions'] = $aGrouplist;
$aData['surveyid'] = $iSurveyID;
$this->_renderWrappedTemplate('survey', 'organizeGroupsAndQuestions_view', $aData);
}
示例4: actionView
//.........这里部分代码省略.........
if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
doFooter();
exit;
}
//Fin session time out
$sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
//I want to see the answers with this id
//Ensure script is not run directly, avoid path disclosure
//if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
if ($aSurveyInfo['printanswers'] == 'N') {
die;
//Die quietly if print answers is not permitted
}
//CHECK IF SURVEY IS ACTIVATED AND EXISTS
$sSurveyName = $aSurveyInfo['surveyls_title'];
$sAnonymized = $aSurveyInfo['anonymized'];
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
//SHOW HEADER
$sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
if ($sExportType == 'pdf') {
//require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
Yii::import('application.libraries.admin.pdf', true);
Yii::import('application.helpers.pdfHelper');
$aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
$oPDF = new pdf();
$oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
$oPDF->SetSubject($sSurveyName);
$oPDF->SetDisplayMode('fullpage', 'two');
$oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
$oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
$oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
$oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
$oPDF->AddPage();
$oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
}
$sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p> \n";
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
$printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
$aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
//Get the fieldmap @TODO: do we need to filter out some fields?
if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
unset($aFullResponseTable['submitdate']);
} else {
unset($aFullResponseTable['id']);
}
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
$sOutput .= "<table class='printouttable' >\n";
foreach ($aFullResponseTable as $sFieldname => $fname) {
if (substr($sFieldname, 0, 4) == 'gid_') {
$sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
} elseif (substr($sFieldname, 0, 4) == 'qid_') {
$sOutput .= "\t<tr class='printanswersquestionhead'><td colspan='2'>{$fname[0]}</td></tr>\n";
} elseif ($sFieldname == 'submitdate') {
if ($sAnonymized != 'Y') {
$sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]} {$sFieldname}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
}
} else {
$sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>" . flattenText($fname[2]) . "</td></tr>";
}
}
$sOutput .= "</table>\n";
$sData['thissurvey'] = $aSurveyInfo;
$sOutput = templatereplace($sOutput, array(), $sData, '', $aSurveyInfo['anonymized'] == "Y", NULL, array(), true);
// Do a static replacement
if ($sExportType == 'pdf') {
$oPDF->writeHTML($sOutput);
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
$sExportFileName = sanitize_filename($sSurveyName);
$oPDF->Output($sExportFileName . "-" . $iSurveyID . ".pdf", "D");
} else {
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array(), $sData);
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/printanswers.pstpl'), array('ANSWERTABLE' => $sOutput), $sData);
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array(), $sData);
echo "</body></html>";
ob_flush();
}
LimeExpressionManager::FinishProcessingGroup();
LimeExpressionManager::FinishProcessingPage();
}
示例5: run
//.........这里部分代码省略.........
$question['type'] = $qinfo['info']['type'];
//===================================================================
$answer = $qa[1];
$help = $qinfo['info']['help'];
// $qa[2];
$redata = compact(array_keys(get_defined_vars()));
$question_template = file_get_contents($sTemplatePath . 'question.pstpl');
if (preg_match('/\\{QUESTION_ESSENTIALS\\}/', $question_template) === false || preg_match('/\\{QUESTION_CLASS\\}/', $question_template) === false) {
// if {QUESTION_ESSENTIALS} is present in the template but not {QUESTION_CLASS} remove it because you don't want id="" and display="" duplicated.
$question_template = str_replace('{QUESTION_ESSENTIALS}', '', $question_template);
$question_template = str_replace('{QUESTION_CLASS}', '', $question_template);
echo '
<!-- NEW QUESTION -->
<div id="question' . $qa[4] . '" class="' . $q_class . $man_class . '"' . $n_q_display . '>';
echo templatereplace($question_template, array(), $redata, false, false, $qa[4]);
echo '</div>';
} else {
// TMSW - eventually refactor so that only substitutes the QUESTION_** fields - doesn't need full power of template replace
// TMSW - also, want to return a string, and call templatereplace once on that result string once all done.
echo templatereplace($question_template, array(), $redata, false, false, $qa[4]);
}
}
if ($surveyMode == 'group') {
echo "<input type='hidden' name='lastgroup' value='{$lastgroup}' id='lastgroup' />\n";
// for counting the time spent on each group
}
if ($surveyMode == 'question') {
echo "<input type='hidden' name='lastanswer' value='{$lastanswer}' id='lastanswer' />\n";
}
echo "\n\n<!-- END THE GROUP -->\n";
echo templatereplace(file_get_contents($sTemplatePath . "endgroup.pstpl"), array(), $redata);
echo "\n\n</div>\n";
}
LimeExpressionManager::FinishProcessingGroup($LEMskipReprocessing);
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
if (!$previewgrp && !$previewquestion) {
$navigator = surveymover();
//This gets globalised in the templatereplace function
$redata = compact(array_keys(get_defined_vars()));
echo "\n\n<!-- PRESENT THE NAVIGATOR -->\n";
echo templatereplace(file_get_contents($sTemplatePath . "navigator.pstpl"), array(), $redata);
echo "\n";
if ($thissurvey['active'] != "Y") {
echo "<p style='text-align:center' class='error'>" . $clang->gT("This survey is currently not active. You will not be able to save your responses.") . "</p>\n";
}
if ($surveyMode != 'survey' && $thissurvey['allowjumps'] == 'Y') {
echo "\n\n<!-- PRESENT THE INDEX -->\n";
echo '<div id="index"><div class="container"><h2>' . $clang->gT("Question index") . '</h2>';
$stepIndex = LimeExpressionManager::GetStepIndexInfo();
$lastGseq = -1;
$gseq = -1;
$grel = true;
for ($v = 0, $n = 0; $n != $_SESSION[$LEMsessid]['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[$LEMsessid]['grouplist'][$gseq];
$grel = !LimeExpressionManager::GroupIsIrrelevantOrHidden($gseq);
if ($grel) {
示例6: preview
//.........这里部分代码省略.........
\$('#answer'+name).val(displayVal);
if (typeof evt_type === 'undefined')
{
evt_type = 'onchange';
}
checkconditions(newval, name, type, evt_type);
}
function checkconditions(value, name, type, evt_type)
{
if (typeof evt_type === 'undefined')
{
evt_type = 'onchange';
}
if (type == 'radio' || type == 'select-one')
{
var hiddenformname='java'+name;
document.getElementById(hiddenformname).value=value;
}
else if (type == 'checkbox')
{
if (document.getElementById('answer'+name).checked)
{
\$('#java'+name).val('Y');
} else
{
\$('#java'+name).val('');
}
}
else if (type == 'text' && name.match(/other\$/) && typeof document.getElementById('java'+name) !== 'undefined' && document.getElementById('java'+name) != null)
{
\$('#java'+name).val(value);
}
ExprMgr_process_relevance_and_tailoring(evt_type,name,type);
{$showQuestion}
}
\$(document).ready(function() {
{$showQuestion}
});
\$(document).change(function() {
{$showQuestion}
});
\$(document).bind('keydown',function(e) {
if (e.keyCode == 9) {
{$showQuestion}
return true;
}
return true;
});
// -->
</script>
EOD;
$answer = $answers[0][1];
// $help = $answers[0][2];
$qinfo = LimeExpressionManager::GetQuestionStatus($qid);
$help = $qinfo['info']['help'];
$question = $answers[0][0];
$question['code'] = $answers[0][5];
$question['class'] = getQuestionClass($qrows['type']);
$question['essentials'] = 'id="question' . $qrows['qid'] . '"';
$question['sgq'] = $ia[1];
$question['aid'] = 'unknown';
$question['sqid'] = 'unknown';
if ($qrows['mandatory'] == 'Y') {
$question['man_class'] = ' mandatory';
} else {
$question['man_class'] = '';
}
$redata = compact(array_keys(get_defined_vars()));
$content = templatereplace(file_get_contents("{$thistpl}/startpage.pstpl"), array(), $redata);
$content .= CHtml::form('index.php', 'post', array('id' => "limesurvey", 'name' => "limesurvey", 'autocomplete' => 'off'));
$content .= templatereplace(file_get_contents("{$thistpl}/startgroup.pstpl"), array(), $redata);
$question_template = file_get_contents("{$thistpl}/question.pstpl");
// the following has been added for backwards compatiblity.
if (substr_count($question_template, '{QUESTION_ESSENTIALS}') > 0) {
// LS 1.87 and newer templates
$content .= "\n" . templatereplace($question_template, array(), $redata, 'Unspecified', false, $qid) . "\n";
} else {
// LS 1.86 and older templates
$content .= '<div ' . $question['essentials'] . ' class="' . $question['class'] . $question['man_class'] . '">';
$content .= "\n" . templatereplace($question_template, array(), $redata, 'Unspecified', false, $qid) . "\n";
$content .= "\n\t</div>\n";
}
$content .= templatereplace(file_get_contents("{$thistpl}/endgroup.pstpl"), array(), $redata) . $dummy_js;
LimeExpressionManager::FinishProcessingGroup();
$content .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
$content .= '<p> </form>';
$content .= templatereplace(file_get_contents("{$thistpl}/endpage.pstpl"), array(), $redata);
LimeExpressionManager::FinishProcessingPage();
echo $content;
if ($LEMdebugLevel >= 1) {
echo LimeExpressionManager::GetDebugTimingMessage();
}
if ($LEMdebugLevel >= 2) {
echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>" . $moveResult['message'] . "</td></tr></table>\n";
}
echo "</html>\n";
exit;
}
示例7: actionView
//.........这里部分代码省略.........
$thissurvey = getSurveyInfo($surveyid, $language);
//SET THE TEMPLATE DIRECTORY
if (!isset($thissurvey['templatedir']) || !$thissurvey['templatedir']) {
$thistpl = validateTemplateDir("default");
} else {
$thistpl = validateTemplateDir($thissurvey['templatedir']);
}
if ($thissurvey['printanswers'] == 'N') {
die;
//Die quietly if print answers is not permitted
}
//CHECK IF SURVEY IS ACTIVATED AND EXISTS
$surveytable = "{{survey_{$surveyid}}}";
$surveyname = $thissurvey['surveyls_title'];
$anonymized = $thissurvey['anonymized'];
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
//SHOW HEADER
$printoutput = '';
$printoutput .= "<form action='" . Yii::app()->getController()->createUrl('printanswers/view/surveyid/' . $surveyid . '/printableexport/pdf') . "' method='post'>\n<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
if ($printableexport == 'pdf') {
require Yii::app()->getConfig('rootdir') . '/application/config/tcpdf.php';
Yii::import('application.libraries.admin.pdf', true);
$pdf = new pdf();
$pdf->setConfig($tcpdf);
//$pdf->SetFont($pdfdefaultfont,'',$pdffontsize);
$pdf->AddPage();
//$pdf->titleintopdf($clang->gT("Survey name (ID)",'unescaped').": {$surveyname} ({$surveyid})");
$pdf->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$surveyname} ({$surveyid})");
}
$printoutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$surveyname} ({$surveyid})</div><p> \n";
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1, $thissurvey['anonymized'] != "N", $surveyid);
$aFullResponseTable = getFullResponseTable($surveyid, $id, $language, true);
//Get the fieldmap @TODO: do we need to filter out some fields?
unset($aFullResponseTable['id']);
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
$printoutput .= "<table class='printouttable' >\n";
if ($printableexport == 'pdf') {
$pdf->intopdf($clang->gT("Question", 'unescaped') . ": " . $clang->gT("Your answer", 'unescaped'));
}
$oldgid = 0;
$oldqid = 0;
foreach ($aFullResponseTable as $sFieldname => $fname) {
if (substr($sFieldname, 0, 4) == 'gid_') {
if ($printableexport) {
$pdf->intopdf(flattenText($fname[0], false, true));
$pdf->ln(2);
} else {
$printoutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
}
} elseif (substr($sFieldname, 0, 4) == 'qid_') {
if ($printableexport == 'pdf') {
$pdf->intopdf(flattenText($fname[0] . $fname[1], false, true) . ": " . $fname[2]);
$pdf->ln(2);
} else {
$printoutput .= "\t<tr class='printanswersquestionhead'><td colspan='2'>{$fname[0]}</td></tr>\n";
}
} elseif ($sFieldname == 'submitdate') {
if ($anonymized != 'Y') {
if ($printableexport == 'pdf') {
$pdf->intopdf(flattenText($fname[0] . $fname[1], false, true) . ": " . $fname[2]);
$pdf->ln(2);
} else {
$printoutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]} {$sFieldname}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
}
}
} else {
if ($printableexport == 'pdf') {
$pdf->intopdf(flattenText($fname[0] . $fname[1], false, true) . ": " . $fname[2]);
$pdf->ln(2);
} else {
$printoutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
}
}
}
$printoutput .= "</table>\n";
if ($printableexport == 'pdf') {
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
$sExportFileName = sanitize_filename($surveyname);
$pdf->Output($sExportFileName . "-" . $surveyid . ".pdf", "D");
}
//Display the page with user answers
if (!$printableexport) {
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents(getTemplatePath($thistpl) . '/startpage.pstpl'));
echo templatereplace(file_get_contents(getTemplatePath($thistpl) . '/printanswers.pstpl'), array('ANSWERTABLE' => $printoutput));
echo templatereplace(file_get_contents(getTemplatePath($thistpl) . '/endpage.pstpl'));
echo "</body></html>";
}
LimeExpressionManager::FinishProcessingGroup();
LimeExpressionManager::FinishProcessingPage();
}
示例8: UnitTestRelevance
/**
* Unit test Relevance using a simplified syntax to represent questions.
*/
static function UnitTestRelevance()
{
// Tests: varName~relevance~inputType~message
$tests = <<<EOT
name~1~text~What is your name?
age~1~text~How old are you (must be 16-80)?
badage~1~expr~{badage=((age<16) || (age>80))}
agestop~!is_empty(age) && ((age<16) || (age>80))~message~Sorry, {name}, you are too {if((age<16),'young',if((age>80),'old','middle-aged'))} for this test.
kids~!((age<16) || (age>80))~yesno~Do you have children (Y/N)?
kidsO~!is_empty(kids) && !(kids=='Y' or kids=='N')~message~Please answer the question about whether you have children with 'Y' or 'N'.
wantsKids~kids=='N'~yesno~Do you hope to have kids some day (Y/N)?
wantsKidsY~wantsKids=='Y'~message~{name}, I hope you are able to have children some day!
wantsKidsN~wantsKids=='N'~message~{name}, I hope you have a wonderfully fulfilling life!
wantsKidsO~!is_empty(wantsKids) && !(wantsKids=='Y' or wantsKids=='N')~message~Please answer the question about whether you want children with 'Y' or 'N'.
parents~1~expr~{parents = (!badage && kids=='Y')}
numKids~kids=='Y'~text~How many children do you have?
numKidsValidation~parents and strlen(numKids) > 0 and numKids <= 0~message~{name}, please check your entries. You said you do have children, {numKids} of them, which makes no sense.
kid1~numKids >= 1~text~How old is your first child?
kid2~numKids >= 2~text~How old is your second child?
kid3~numKids >= 3~text~How old is your third child?
kid4~numKids >= 4~text~How old is your fourth child?
kid5~numKids >= 5~text~How old is your fifth child?
sumage~1~expr~{sumage=sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)}
report~numKids > 0~message~{name}, you said you are {age} and that you have {numKids} kids. The sum of ages of your first {min(numKids,5)} kids is {sumage}.
EOT;
$vars = array();
$varsNAOK = array();
$varSeq = array();
$testArgs = array();
$argInfo = array();
LimeExpressionManager::SetDirtyFlag();
$LEM =& LimeExpressionManager::singleton();
LimeExpressionManager::StartProcessingPage(true);
LimeExpressionManager::StartProcessingGroup(1);
// pretending this is group 1
// collect variables
$i = 0;
foreach (explode("\n", $tests) as $test) {
$args = explode("~", $test);
$type = $args[1] == 'expr' ? '*' : $args[1] == 'message' ? 'X' : 'S';
$vars[$args[0]] = array('sgqa' => $args[0], 'code' => '', 'jsName' => 'java' . $args[0], 'jsName_on' => 'java' . $args[0], 'readWrite' => 'Y', 'type' => $type, 'relevanceStatus' => '1', 'gid' => 1, 'gseq' => 1, 'qseq' => $i, 'qid' => $i);
$varSeq[] = $args[0];
$testArgs[] = $args;
$LEM->questionId2questionSeq[$i] = $i;
$LEM->questionId2groupSeq[$i] = 1;
$LEM->questionSeq2relevance[$i] = array('relevance' => htmlspecialchars(preg_replace('/[[:space:]]/', ' ', $args[1]), ENT_QUOTES), 'qid' => $i, 'qseq' => $i, 'gseq' => 1, 'jsResultVar' => 'java' . $args[0], 'type' => $type, 'hidden' => false, 'gid' => 1);
++$i;
}
$LEM->knownVars = $vars;
$LEM->gRelInfo[1] = array('gid' => 1, 'gseq' => 1, 'eqn' => '', 'result' => 1, 'numJsVars' => 0, 'relevancejs' => '', 'relevanceVars' => '', 'prettyPrint' => '');
$LEM->ProcessAllNeededRelevance();
// collect relevance
$alias2varName = array();
$varNameAttr = array();
for ($i = 0; $i < count($testArgs); ++$i) {
$testArg = $testArgs[$i];
$var = $testArg[0];
$rel = LimeExpressionManager::QuestionIsRelevant($i);
$question = LimeExpressionManager::ProcessString($testArg[3], $i, NULL, true, 1, 1);
$jsVarName = 'java' . str_replace('#', '_', $testArg[0]);
$argInfo[] = array('num' => $i, 'name' => $jsVarName, 'sgqa' => $testArg[0], 'type' => $testArg[2], 'question' => $question, 'relevance' => $testArg[1], 'relevanceStatus' => $rel);
$alias2varName[$var] = array('jsName' => $jsVarName, 'jsPart' => "'" . $var . "':'" . $jsVarName . "'");
$alias2varName[$jsVarName] = array('jsName' => $jsVarName, 'jsPart' => "'" . $jsVarName . "':'" . $jsVarName . "'");
$varNameAttr[$jsVarName] = "'" . $jsVarName . "':{" . "'jsName':'" . $jsVarName . "','jsName_on':'" . $jsVarName . "','sgqa':'" . substr($jsVarName, 4) . "','qid':" . $i . ",'gid':" . 1 . "}";
}
$LEM->alias2varName = $alias2varName;
$LEM->varNameAttr = $varNameAttr;
LimeExpressionManager::FinishProcessingGroup();
LimeExpressionManager::FinishProcessingPage();
print <<<EOD
<script type='text/javascript'>
<!--
var LEMradix='.';
function checkconditions(value, name, type, evt_type)
{
if (typeof evt_type === 'undefined')
{
evt_type = 'onchange';
}
ExprMgr_process_relevance_and_tailoring(evt_type,name,type);
}
// -->
</script>
EOD;
print LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
// Print Table of questions
print "<h3>This is a test of dynamic relevance.</h3>";
print "Enter your name and age, and try all the permutations of answers to whether you have or want children.<br />\n";
print "Note how the text and sum of ages changes dynamically; that prior answers are remembered; and that irrelevant values are not included in the sum of ages.<br />";
print "<table class='table' border='1'><tr><td>";
foreach ($argInfo as $arg) {
$rel = LimeExpressionManager::QuestionIsRelevant($arg['num']);
print "<div id='question" . $arg['num'] . ($rel ? "'" : "' style='display: none'") . ">\n";
print "<input type='hidden' id='display" . $arg['num'] . "' name='" . $arg['num'] . "' value='" . ($rel ? 'on' : '') . "'/>\n";
if ($arg['type'] == 'expr') {
// Hack for testing purposes - rather than using LimeSurvey internals to store the results of equations, process them via a hidden <div>
print "<div style='display: none' id='hack_" . $arg['name'] . "'>" . $arg['question'];
//.........这里部分代码省略.........
示例9: actionView
//.........这里部分代码省略.........
$sSurveyName = $aSurveyInfo['surveyls_title'];
$sAnonymized = $aSurveyInfo['anonymized'];
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
//SHOW HEADER
if ($sExportType != 'pdf') {
$sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input class='btn btn-default' type='submit' value='" . gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
$sOutput .= "\t<div class='printouttitle'><strong>" . gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p> \n";
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
$printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
$aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
//Get the fieldmap @TODO: do we need to filter out some fields?
if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
unset($aFullResponseTable['submitdate']);
} else {
unset($aFullResponseTable['id']);
}
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
$sOutput .= "<table class='printouttable' >\n";
foreach ($aFullResponseTable as $sFieldname => $fname) {
if (substr($sFieldname, 0, 4) == 'gid_') {
$sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
$sOutput .= "\t<tr class='printanswersgroupdesc'><td colspan='2'>{$fname[1]}</td></tr>\n";
} elseif ($sFieldname == 'submitdate') {
if ($sAnonymized != 'Y') {
$sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]} {$sFieldname}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
}
} elseif (substr($sFieldname, 0, 4) != 'qid_') {
$sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>" . flattenText($fname[2]) . "</td></tr>";
}
}
$sOutput .= "</table>\n";
$sData['thissurvey'] = $aSurveyInfo;
$sOutput = templatereplace($sOutput, array(), $sData, '', $aSurveyInfo['anonymized'] == "Y", NULL, array(), true);
// Do a static replacement
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents($oTemplate->viewPath . '/startpage.pstpl'), array(), $sData);
echo templatereplace(file_get_contents($oTemplate->viewPath . '/printanswers.pstpl'), array('ANSWERTABLE' => $sOutput), $sData);
echo templatereplace(file_get_contents($oTemplate->viewPath . '/endpage.pstpl'), array(), $sData);
echo "</body></html>";
ob_flush();
}
if ($sExportType == 'pdf') {
// Get images for TCPDF from template directory
define('K_PATH_IMAGES', getTemplatePath($aSurveyInfo['template']) . DIRECTORY_SEPARATOR);
Yii::import('application.libraries.admin.pdf', true);
Yii::import('application.helpers.pdfHelper');
$aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings(App()->language);
$oPDF = new pdf();
$sDefaultHeaderString = $sSurveyName . " (" . gT("ID", 'unescaped') . ":" . $iSurveyID . ")";
$oPDF->initAnswerPDF($aSurveyInfo, $aPdfLanguageSettings, Yii::app()->getConfig('sitename'), $sSurveyName, $sDefaultHeaderString);
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
$printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
$aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
//Get the fieldmap @TODO: do we need to filter out some fields?
if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
unset($aFullResponseTable['submitdate']);
} else {
unset($aFullResponseTable['id']);
}
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
foreach ($aFullResponseTable as $sFieldname => $fname) {
if (substr($sFieldname, 0, 4) == 'gid_') {
$oPDF->addGidAnswer($fname[0], $fname[1]);
} elseif ($sFieldname == 'submitdate') {
if ($sAnonymized != 'Y') {
$oPDF->addAnswer($fname[0] . " " . $fname[1], $fname[2]);
}
} elseif (substr($sFieldname, 0, 4) != 'qid_') {
$oPDF->addAnswer($fname[0] . " " . $fname[1], $fname[2]);
}
}
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
$sExportFileName = sanitize_filename($sSurveyName);
$oPDF->Output($sExportFileName . "-" . $iSurveyID . ".pdf", "D");
}
LimeExpressionManager::FinishProcessingGroup();
LimeExpressionManager::FinishProcessingPage();
}
示例10: view
//.........这里部分代码省略.........
break;
case ":":
//ARRAY (Multi Flexi)
// $qidattributes=getQuestionAttributeValues($deqrow['qid']);
$minvalue = 1;
$maxvalue = 10;
if (trim($qidattributes['multiflexible_max']) != '' && trim($qidattributes['multiflexible_min']) == '') {
$maxvalue = $qidattributes['multiflexible_max'];
$minvalue = 1;
}
if (trim($qidattributes['multiflexible_min']) != '' && trim($qidattributes['multiflexible_max']) == '') {
$minvalue = $qidattributes['multiflexible_min'];
$maxvalue = $qidattributes['multiflexible_min'] + 10;
}
if (trim($qidattributes['multiflexible_min']) != '' && trim($qidattributes['multiflexible_max']) != '') {
if ($qidattributes['multiflexible_min'] < $qidattributes['multiflexible_max']) {
$minvalue = $qidattributes['multiflexible_min'];
$maxvalue = $qidattributes['multiflexible_max'];
}
}
if (trim($qidattributes['multiflexible_step']) != '') {
$stepvalue = $qidattributes['multiflexible_step'];
} else {
$stepvalue = 1;
}
if ($qidattributes['multiflexible_checkbox'] != 0) {
$minvalue = 0;
$maxvalue = 1;
$stepvalue = 1;
}
$cdata['minvalue'] = $minvalue;
$cdata['maxvalue'] = $maxvalue;
$cdata['stepvalue'] = $stepvalue;
$lquery = "SELECT question, title FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and scale_id=1 and language='{$sDataEntryLanguage}' ORDER BY question_order";
$lresult = dbExecuteAssoc($lquery) or die("Couldn't get labels, Type \":\"<br />{$lquery}<br />");
$lresult = dbExecuteAssoc($lquery);
if (!$lresult) {
$eMessage = "Couldn't get labels, Type \":\"<br />{$lquery}<br />";
Yii::app()->setFlashMessage($eMessage);
$this->getController()->redirect($this->getController()->createUrl("/admin/"));
}
$cdata['lresult'] = $lresult->readAll();
$meaquery = "SELECT question, title FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and scale_id=0 and language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery);
if (!$mearesult) {
$eMessage = "Couldn't get answers, Type \":\"<br />{$meaquery}<br />";
Yii::app()->setFlashMessage($eMessage);
$this->getController()->redirect($this->getController()->createUrl("/admin/"));
}
$cdata['mearesult'] = $mearesult->readAll();
break;
case ";":
//ARRAY (Multi Flexi)
$lquery = "SELECT * FROM {{questions}} WHERE scale_id=1 and parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
$lresult = dbExecuteAssoc($lquery) or die("Couldn't get labels, Type \":\"<br />{$lquery}<br />");
$cdata['lresult'] = $lresult->readAll();
$meaquery = "SELECT * FROM {{questions}} WHERE scale_id=0 and parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery) or die("Couldn't get answers, Type \":\"<br />{$meaquery}<br />");
$cdata['mearesult'] = $mearesult->readAll();
break;
case "F":
//ARRAY (Flexible Labels)
//ARRAY (Flexible Labels)
case "H":
$meaquery = "SELECT * FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = dbExecuteAssoc($meaquery) or safeDie("Couldn't get answers, Type \"E\"<br />{$meaquery}<br />");
$cdata['mearesult'] = $mearesult->readAll();
$fquery = "SELECT * FROM {{answers}} WHERE qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY sortorder, code";
$fresult = dbExecuteAssoc($fquery);
$cdata['fresult'] = $fresult->readAll();
break;
}
$cdata['sDataEntryLanguage'] = $sDataEntryLanguage;
$viewdata = $this->getController()->renderPartial("/admin/dataentry/content_view", $cdata, TRUE);
$viewdata_em = LimeExpressionManager::ProcessString($viewdata, $deqrow['qid'], NULL, false, 1, 1);
$aDataentryoutput .= $viewdata_em;
}
LimeExpressionManager::FinishProcessingGroup();
}
LimeExpressionManager::FinishProcessingPage();
$aDataentryoutput .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
$aViewUrls['output'] = $aDataentryoutput;
$aData['thissurvey'] = $thissurvey;
$aData['surveyid'] = $surveyid;
$aData['sDataEntryLanguage'] = $sDataEntryLanguage;
if ($thissurvey['active'] == "Y" && $thissurvey['allowsave'] == "Y") {
$slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$sbaselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($slangs, $sbaselang);
$aData['slangs'] = $slangs;
$aData['baselang'] = $baselang;
}
$aViewUrls[] = 'active_html_view';
$aData['sidemenu']['state'] = false;
$aData['menu']['edition'] = true;
$aData['menu']['save'] = true;
$aData['menu']['close'] = true;
$this->_renderWrappedTemplate('dataentry', $aViewUrls, $aData);
}
}
示例11: templatereplace
} else {
$question['man_class'] = '';
}
$content = templatereplace(file_get_contents("{$thistpl}/startpage.pstpl"));
$content .= '<form method="post" action="index.php" id="limesurvey" name="limesurvey" autocomplete="off">';
$content .= templatereplace(file_get_contents("{$thistpl}/startgroup.pstpl"));
$question_template = file_get_contents("{$thistpl}/question.pstpl");
if (substr_count($question_template, '{QUESTION_ESSENTIALS}') > 0) {
// LS 1.87 and newer templates
$content .= "\n" . templatereplace($question_template, NULL, false, $qid) . "\n";
} else {
// LS 1.86 and older templates
$content .= '<div ' . $question['essentials'] . ' class="' . $question['class'] . $question['man_class'] . '">';
$content .= "\n" . templatereplace($question_template, NULL, false, $qid) . "\n";
$content .= "\n\t</div>\n";
}
$content .= templatereplace(file_get_contents("{$thistpl}/endgroup.pstpl")) . $dummy_js;
LimeExpressionManager::FinishProcessingGroup();
$content .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
$content .= '<p> </form>';
LimeExpressionManager::FinishProcessingPage();
echo $content;
if ($LEMdebugLevel >= 1) {
echo LimeExpressionManager::GetDebugTimingMessage();
}
if ($LEMdebugLevel >= 2) {
echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>" . $moveResult['message'] . "</td></tr></table>\n";
}
$content .= templatereplace(file_get_contents("{$thistpl}/endpage.pstpl"));
echo "</html>\n";
exit;
示例12: _showReorderForm
/**
* Show the form for Organize question groups/questions
*
* @todo Change function name to _showOrganizeGroupsAndQuestions?
* @param int $iSurveyID
* @return void
*/
private function _showReorderForm($iSurveyID)
{
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
// Prepare data for the view
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
LimeExpressionManager::StartSurvey($iSurveyID, 'survey');
LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
$aGrouplist = QuestionGroup::model()->getGroups($iSurveyID);
$initializedReplacementFields = false;
$aData['organizebar']['savebuttonright'] = true;
//$aData['organizebar']['returnbutton']['url'] = $this->getController()->createUrl("admin/survey/sa/view/", array('surveyid' => $iSurveyID));
//$aData['organizebar']['returnbutton']['text'] = gT('Return to survey summary');
foreach ($aGrouplist as $iGID => $aGroup) {
LimeExpressionManager::StartProcessingGroup($aGroup['gid'], false, $iSurveyID);
if (!$initializedReplacementFields) {
templatereplace("{SITENAME}");
// Hack to ensure the EM sets values of LimeReplacementFields
$initializedReplacementFields = true;
}
$oQuestionData = Question::model()->getQuestions($iSurveyID, $aGroup['gid'], $sBaseLanguage);
$qs = array();
$junk = array();
foreach ($oQuestionData->readAll() as $q) {
$relevance = $q['relevance'] == '' ? 1 : $q['relevance'];
$question = '[{' . $relevance . '}] ' . $q['question'];
LimeExpressionManager::ProcessString($question, $q['qid']);
$q['question'] = viewHelper::stripTagsEM(LimeExpressionManager::GetLastPrettyPrintExpression());
$q['gid'] = $aGroup['gid'];
$qs[] = $q;
}
$aGrouplist[$iGID]['questions'] = $qs;
LimeExpressionManager::FinishProcessingGroup();
}
LimeExpressionManager::FinishProcessingPage();
$aData['aGroupsAndQuestions'] = $aGrouplist;
$aData['surveyid'] = $iSurveyID;
$this->_renderWrappedTemplate('survey', 'organizeGroupsAndQuestions_view', $aData);
}
示例13: templatereplace
echo templatereplace($question_template, NULL, false, $qa[4]);
}
}
if ($surveyMode == 'group') {
echo "<input type='hidden' name='lastgroup' value='{$lastgroup}' id='lastgroup' />\n";
// for counting the time spent on each group
}
if ($surveyMode == 'question') {
echo "<input type='hidden' name='lastanswer' value='{$lastanswer}' id='lastanswer' />\n";
}
echo "\n\n<!-- END THE GROUP -->\n";
echo templatereplace(file_get_contents("{$thistpl}/endgroup.pstpl"));
echo "\n\n</div>\n";
}
}
LimeExpressionManager::FinishProcessingGroup($LEMskipReprocessing);
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
if (!$previewgrp) {
$navigator = surveymover();
//This gets globalised in the templatereplace function
echo "\n\n<!-- PRESENT THE NAVIGATOR -->\n";
echo templatereplace(file_get_contents("{$thistpl}/navigator.pstpl"));
echo "\n";
if ($thissurvey['active'] != "Y") {
echo "<p style='text-align:center' class='error'>" . $clang->gT("This survey is currently not active. You will not be able to save your responses.") . "</p>\n";
}
if ($surveyMode != 'survey' && $thissurvey['allowjumps'] == 'Y') {
echo "\n\n<!-- PRESENT THE INDEX -->\n";
echo '<div id="index"><div class="container"><h2>' . $clang->gT("Question index") . '</h2>';
$stepIndex = LimeExpressionManager::GetStepIndexInfo();