本文整理汇总了PHP中LimeExpressionManager::StartProcessingGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::StartProcessingGroup方法的具体用法?PHP LimeExpressionManager::StartProcessingGroup怎么用?PHP LimeExpressionManager::StartProcessingGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LimeExpressionManager
的用法示例。
在下文中一共展示了LimeExpressionManager::StartProcessingGroup方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
/**
* printanswers::view()
* View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
* @param mixed $surveyid
* @param bool $printableexport
* @return
*/
function actionView($surveyid, $printableexport = FALSE)
{
Yii::app()->loadHelper("frontend");
Yii::import('application.libraries.admin.pdf');
$iSurveyID = (int) $surveyid;
$sExportType = $printableexport;
Yii::app()->loadHelper('database');
if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
$iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
} else {
//die('Invalid survey/session');
}
// Get the survey inforamtion
// Set the language for dispay
if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
$sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
} elseif (Survey::model()->findByPk($iSurveyID)) {
$sLanguage = Survey::model()->findByPk($iSurveyID)->language;
} else {
$iSurveyID = 0;
$sLanguage = Yii::app()->getConfig("defaultlang");
}
$clang = SetSurveyLanguage($iSurveyID, $sLanguage);
$aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
//SET THE TEMPLATE DIRECTORY
if (!isset($aSurveyInfo['templatedir']) || !$aSurveyInfo['templatedir']) {
$aSurveyInfo['templatedir'] = Yii::app()->getConfig('defaulttemplate');
}
$sTemplate = validateTemplateDir($aSurveyInfo['templatedir']);
//Survey is not finished or don't exist
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_') {
//.........这里部分代码省略.........
示例2: view
/**
* dataentry::view()
* view a dataentry
* @param mixed $surveyid
* @param mixed $lang
* @return
*/
public function view($surveyid, $lang = NULL)
{
$surveyid = sanitize_int($surveyid);
$lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
if (isset($lang)) {
$lang = sanitize_languagecode($lang);
}
$aViewUrls = array();
if (hasSurveyPermission($surveyid, 'responses', 'read')) {
$clang = Yii::app()->lang;
$sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
$surveyinfo = getSurveyInfo($surveyid);
$slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($slangs, $baselang);
if (is_null($lang) || !in_array($lang, $slangs)) {
$sDataEntryLanguage = $baselang;
$blang = $clang;
} else {
Yii::app()->loadLibrary('Limesurvey_lang', array($lang));
$blang = new Limesurvey_lang($lang);
$sDataEntryLanguage = $lang;
}
$langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
$thissurvey = getSurveyInfo($surveyid);
//This is the default, presenting a blank dataentry form
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$aData['thissurvey'] = $thissurvey;
$aData['langlistbox'] = $langlistbox;
$aData['surveyid'] = $surveyid;
$aData['blang'] = $blang;
$aData['site_url'] = Yii::app()->homeUrl;
LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
// means that all variables are on the same page
$aViewUrls[] = 'caption_view';
Yii::app()->loadHelper('database');
// SURVEY NAME AND DESCRIPTION TO GO HERE
$degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
$degresult = dbExecuteAssoc($degquery);
// GROUP NAME
$aDataentryoutput = '';
foreach ($degresult->readAll() as $degrow) {
LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
$deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
$deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
$aDataentryoutput .= "\t<tr>\n" . "<td colspan='3' align='center'><strong>" . flattenText($degrow['group_name'], true) . "</strong></td>\n" . "\t</tr>\n";
$gid = $degrow['gid'];
$aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
// Perform a case insensitive natural sort on group name then question title of a multidimensional array
usort($deqrows, 'groupOrderThenQuestionOrder');
$bgc = 'odd';
foreach ($deqrows as $deqrow) {
$qidattributes = getQuestionAttributeValues($deqrow['qid'], $deqrow['type']);
$cdata['qidattributes'] = $qidattributes;
$hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
// TODO - can questions be hidden? Are JavaScript variables names used? Consistently with everywhere else?
// LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
// TMSW Conditions->Relevance: Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
$qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
$relevance = trim($qinfo['info']['relevance']);
$explanation = trim($qinfo['relEqn']);
$validation = trim($qinfo['prettyValidTip']);
$qidattributes = getQuestionAttributeValues($deqrow['qid']);
$array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
$showme = '';
if ($bgc == "even") {
$bgc = "odd";
} else {
$bgc = "even";
}
//Do no alternate on explanation row
if ($relevance != '' && $relevance != '1') {
$showme = "[" . $blang->gT("Only answer this if the following conditions are met:") . "]<br />{$explanation}\n";
}
if ($showme != '' && $validation != '') {
$showme .= '<br/>';
}
if ($validation != '') {
$showme .= "[" . $blang->gT("The answer(s) must meet these validation criteria:") . "]<br />{$validation}\n";
}
if ($showme != '' && $array_filter_help != '') {
$showme .= '<br/>';
}
if ($array_filter_help != '') {
$showme .= "[" . $blang->gT("The answer(s) must meet these array_filter criteria:") . "]<br />{$array_filter_help}\n";
}
$cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
}
//END OF GETTING CONDITIONS
//Alternate bgcolor for different groups
if (!isset($bgc)) {
//.........这里部分代码省略.........
示例3: display_first_page
/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page()
{
global $token, $surveyid, $thissurvey, $navigator;
$totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
$clang = Yii::app()->lang;
// Fill some necessary var for template
$navigator = surveymover();
$sitename = Yii::app()->getConfig('sitename');
$languagechanger = makeLanguageChangerSurvey($clang->langcode);
sendCacheHeaders();
doHeader();
LimeExpressionManager::StartProcessingPage();
LimeExpressionManager::StartProcessingGroup(-1, false, $surveyid);
// start on welcome page
$redata = compact(array_keys(get_defined_vars()));
$sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata, 'frontend_helper[2757]');
echo CHtml::form(array("/survey/index"), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off'));
echo "\n\n<!-- START THE SURVEY -->\n";
echo templatereplace(file_get_contents($sTemplatePath . "welcome.pstpl"), array(), $redata, 'frontend_helper[2762]') . "\n";
if ($thissurvey['anonymized'] == "Y") {
echo templatereplace(file_get_contents($sTemplatePath . "/privacy.pstpl"), array(), $redata, 'frontend_helper[2765]') . "\n";
}
echo templatereplace(file_get_contents($sTemplatePath . "navigator.pstpl"), array(), $redata, 'frontend_helper[2767]');
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";
}
echo "\n<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
if (isset($token) && !empty($token)) {
echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
}
echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n";
//This is to ensure consistency with mandatory checks, and new group test
$loadsecurity = returnGlobal('loadsecurity', true);
if (isset($loadsecurity)) {
echo "\n<input type='hidden' name='loadsecurity' value='{$loadsecurity}' id='loadsecurity' />\n";
}
$_SESSION['survey_' . $surveyid]['LEMpostKey'] = mt_rand();
echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION['survey_' . $surveyid]['LEMpostKey']}' id='LEMpostKey' />\n";
echo "<input type='hidden' name='thisstep' id='thisstep' value='0' />\n";
echo "\n</form>\n";
echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata, 'frontend_helper[2782]');
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
doFooter();
}
示例4: _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);
}
示例5: 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'];
//.........这里部分代码省略.........
示例6: display_first_page
/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page()
{
global $token, $surveyid, $thissurvey, $navigator;
$totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
// Fill some necessary var for template
$aNavigator = surveymover();
$moveprevbutton = $aNavigator['sMovePrevButton'];
$movenextbutton = $aNavigator['sMoveNextButton'];
$navigator = $moveprevbutton . ' ' . $movenextbutton;
$sitename = Yii::app()->getConfig('sitename');
$languagechanger = makeLanguageChangerSurvey(App()->language);
sendCacheHeaders();
doHeader();
LimeExpressionManager::StartProcessingPage();
LimeExpressionManager::StartProcessingGroup(-1, false, $surveyid);
// start on welcome page
$redata = compact(array_keys(get_defined_vars()));
$oTemplate = Template::model()->getInstance('', $surveyid);
$sTemplatePath = $oTemplate->path;
$sTemplateViewPath = $oTemplate->viewPath;
echo templatereplace(file_get_contents($sTemplateViewPath . "startpage.pstpl"), array(), $redata, 'frontend_helper[2757]');
echo CHtml::form(array("/survey/index", "sid" => $surveyid), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off', 'class' => 'frontend_helper'));
echo templatereplace(file_get_contents($sTemplateViewPath . "welcome.pstpl"), array(), $redata, 'frontend_helper[2762]') . "\n";
if ($thissurvey['anonymized'] == "Y") {
echo templatereplace(file_get_contents($sTemplateViewPath . "/privacy.pstpl"), array(), $redata, 'frontend_helper[2765]') . "\n";
}
echo templatereplace(file_get_contents($sTemplateViewPath . "navigator.pstpl"), array(), $redata, 'frontend_helper[2767]');
echo "\n<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
if (isset($token) && !empty($token)) {
echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
}
echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n";
//This is to ensure consistency with mandatory checks, and new group test
$loadsecurity = returnGlobal('loadsecurity', true);
if (isset($loadsecurity)) {
echo "\n<input type='hidden' name='loadsecurity' value='{$loadsecurity}' id='loadsecurity' />\n";
}
$_SESSION['survey_' . $surveyid]['LEMpostKey'] = mt_rand();
echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION['survey_' . $surveyid]['LEMpostKey']}' id='LEMpostKey' />\n";
echo "<input type='hidden' name='thisstep' id='thisstep' value='0' />\n";
echo "<!--frontendhelper --></form>";
echo templatereplace(file_get_contents($sTemplateViewPath . "endpage.pstpl"), array(), $redata, 'frontend_helper[2782]');
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
doFooter();
echo "<!-- end of frontend_helper / display_first_page -->";
}
示例7: actionView
/**
* printanswers::view()
* View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
* @param mixed $surveyid
* @param bool $printableexport
* @return
*/
function actionView($surveyid, $printableexport = FALSE)
{
Yii::app()->loadHelper("frontend");
Yii::import('application.libraries.admin.pdf');
$iSurveyID = (int) $surveyid;
$sExportType = $printableexport;
Yii::app()->loadHelper('database');
if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
$iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
} else {
//die('Invalid survey/session');
}
// Get the survey inforamtion
// Set the language for dispay
if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
$sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
} elseif (Survey::model()->findByPk($iSurveyID)) {
$sLanguage = Survey::model()->findByPk($iSurveyID)->language;
} else {
$iSurveyID = 0;
$sLanguage = Yii::app()->getConfig("defaultlang");
}
SetSurveyLanguage($iSurveyID, $sLanguage);
$aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
$oTemplate = Template::model()->getInstance(null, $iSurveyID);
//Survey is not finished or don't exist
if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
sendCacheHeaders();
doHeader();
/// $oTemplate is a global variable defined in controller/survey/index
echo templatereplace(file_get_contents($oTemplate->viewPath . '/startpage.pstpl'), array());
echo "<center><br />\n" . "\t<font color='RED'><strong>" . gT("Error") . "</strong></font><br />\n" . "\t" . gT("We are sorry but your session has expired.") . "<br />" . 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(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($oTemplate->viewPath . '/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");}
//Ensure Participants printAnswer setting is set to true or that the logged user have read permissions over the responses.
if ($aSurveyInfo['printanswers'] == 'N' && !Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
throw new CHttpException(401, 'You are not allowed to print answers.');
}
//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
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);
//.........这里部分代码省略.........
示例8: actionView
/**
* printanswers::view()
* View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
* @param mixed $surveyid
* @param bool $printableexport
* @return
*/
function actionView($surveyid, $printableexport = FALSE)
{
global $siteadminname, $siteadminemail;
Yii::app()->loadHelper("frontend");
Yii::import('application.libraries.admin.pdf');
$surveyid = (int) $surveyid;
Yii::app()->loadHelper('database');
if (isset($_SESSION['survey_' . $surveyid]['sid'])) {
$surveyid = $_SESSION['survey_' . $surveyid]['sid'];
} else {
die('Invalid survey/session');
}
//Debut session time out
if (!isset($_SESSION['survey_' . $surveyid]['finished']) || !isset($_SESSION['survey_' . $surveyid]['srid'])) {
//require_once($rootdir.'/classes/core/language.php');
$baselang = Survey::model()->findByPk($surveyid)->language;
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($baselang);
//A nice exit
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents(getTemplatePath(validateTemplateDir("default")) . "/startpage.pstpl"), array(), 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."), $siteadminname, $siteadminemail) . "\n" . "</center><br />\n";
echo templatereplace(file_get_contents(getTemplatePath(validateTemplateDir("default")) . "/endpage.pstpl"), array(), array());
doFooter();
exit;
}
//Fin session time out
$id = $_SESSION['survey_' . $surveyid]['srid'];
//I want to see the answers with this id
$clang = $_SESSION['survey_' . $surveyid]['s_lang'];
//Ensure script is not run directly, avoid path disclosure
//if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
// Set the language for dispay
//require_once($rootdir.'/classes/core/language.php'); // has been secured
if (isset($_SESSION['survey_' . $surveyid]['s_lang'])) {
$clang = SetSurveyLanguage($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$language = $_SESSION['survey_' . $surveyid]['s_lang'];
} else {
$language = Survey::model()->findByPk($surveyid)->language;
$clang = SetSurveyLanguage($surveyid, $language);
}
// Get the survey inforamtion
$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_') {
//.........这里部分代码省略.........
示例9: foreach
$tmp_url = $GLOBALS['publicurl'] . '/' . $surveyinfo['sid'];
$surveysummary .= "<td align='left'> <a href='{$tmp_url}/lang-" . $surveyinfo['language'] . "' target='_blank'>{$tmp_url}/lang-" . $surveyinfo['language'] . "</a>";
foreach ($aAdditionalLanguages as $langname) {
$surveysummary .= " <a href='{$tmp_url}/lang-{$langname}' target='_blank'><img title='" . $clang->gT("Survey URL for language:") . " " . getLanguageNameFromCode($langname, false) . "' alt='" . getLanguageNameFromCode($langname, false) . " " . $clang->gT("Flag") . "' src='../images/flags/{$langname}.png' /></a>";
}
} else {
$tmp_url = $GLOBALS['publicurl'] . '/index.php?sid=' . $surveyinfo['sid'];
$surveysummary .= "<td align='left'> <a href='{$tmp_url}&lang=" . $surveyinfo['language'] . "' target='_blank'>{$tmp_url}&lang=" . $surveyinfo['language'] . "</a>";
foreach ($aAdditionalLanguages as $langname) {
$surveysummary .= " <a href='{$tmp_url}&lang={$langname}' target='_blank'><img title='" . $clang->gT("Survey URL for language:") . " " . getLanguageNameFromCode($langname, false) . "' alt='" . getLanguageNameFromCode($langname, false) . " " . $clang->gT("Flag") . "' src='../images/flags/{$langname}.png' /></a>";
}
}
$surveysummary .= "</td></tr>\n" . "<tr><td align='right' valign='top'><strong>" . $clang->gT("Description:") . "</strong></td>\n<td align='left'>";
LimeExpressionManager::StartProcessingPage(false, $rooturl);
// so can click on syntax highlighting to edit questions
LimeExpressionManager::StartProcessingGroup($gid, false, $surveyid);
// loads list of replacement values available for this group
if (trim($surveyinfo['surveyls_description']) != '') {
templatereplace($surveyinfo['surveyls_description']);
$surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
}
$surveysummary .= "</td></tr>\n" . "<tr >\n" . "<td align='right' valign='top'><strong>" . $clang->gT("Welcome:") . "</strong></td>\n" . "<td align='left'>";
templatereplace($surveyinfo['surveyls_welcometext']);
$surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
$surveysummary .= "</td></tr>\n" . "<tr ><td align='right' valign='top'><strong>" . $clang->gT("Administrator:") . "</strong></td>\n" . "<td align='left'> {$surveyinfo['admin']} ({$surveyinfo['adminemail']})</td></tr>\n";
if (trim($surveyinfo['faxto']) != '') {
$surveysummary .= "<tr><td align='right' valign='top'><strong>" . $clang->gT("Fax to:") . "</strong></td>\n<td align='left'>{$surveyinfo['faxto']}";
$surveysummary .= "</td></tr>\n";
}
$surveysummary .= "<tr><td align='right' valign='top'><strong>" . $clang->gT("Start date/time:") . "</strong></td>\n";
$dateformatdetails = getDateFormatData($_SESSION['dateformat']);
示例10: view
/**
* dataentry::view()
* view a dataentry
* @param mixed $surveyid
* @param mixed $lang
* @return
*/
public function view($surveyid, $lang = NULL)
{
$surveyid = sanitize_int($surveyid);
$lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
if (isset($lang)) {
$lang = sanitize_languagecode($lang);
}
$aViewUrls = array();
if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'create')) {
$sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
$surveyinfo = getSurveyInfo($surveyid);
$slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($slangs, $baselang);
if (is_null($lang) || !in_array($lang, $slangs)) {
$sDataEntryLanguage = $baselang;
} else {
$sDataEntryLanguage = $lang;
}
$langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
$thissurvey = getSurveyInfo($surveyid);
//This is the default, presenting a blank dataentry form
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$aData['thissurvey'] = $thissurvey;
$aData['langlistbox'] = $langlistbox;
$aData['surveyid'] = $surveyid;
$aData['sDataEntryLanguage'] = $sDataEntryLanguage;
$aData['site_url'] = Yii::app()->homeUrl;
LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
// means that all variables are on the same page
$aViewUrls[] = 'caption_view';
Yii::app()->loadHelper('database');
// SURVEY NAME AND DESCRIPTION TO GO HERE
$degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
$degresult = dbExecuteAssoc($degquery);
// GROUP NAME
$aDataentryoutput = '';
foreach ($degresult->readAll() as $degrow) {
LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
$deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
$deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
$aDataentryoutput .= "\t<tr class='info'>\n" . "<!-- Inside controller dataentry.php -->" . "<td colspan='3'><h4>" . flattenText($degrow['group_name'], true) . "</h4></td>\n" . "\t</tr>\n";
$gid = $degrow['gid'];
$aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
// Perform a case insensitive natural sort on group name then question title of a multidimensional array
usort($deqrows, 'groupOrderThenQuestionOrder');
$bgc = 'odd';
foreach ($deqrows as $deqrow) {
$cdata = array();
$qidattributes = getQuestionAttributeValues($deqrow['qid']);
$cdata['qidattributes'] = $qidattributes;
$hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
// TODO - can questions be hidden? Are JavaScript variables names used? Consistently with everywhere else?
// LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
// TMSW Condition->Relevance: Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
$qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
$relevance = trim($qinfo['info']['relevance']);
$explanation = trim($qinfo['relEqn']);
$validation = trim($qinfo['prettyValidTip']);
$qidattributes = getQuestionAttributeValues($deqrow['qid']);
$array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
$showme = '<div class="alert alert-warning col-sm-8 col-sm-offset-2" role="alert">';
if ($bgc == "even") {
$bgc = "odd";
} else {
$bgc = "even";
}
//Do no alternate on explanation row
if ($relevance != '' && $relevance != '1') {
$showme = '<strong>' . gT("Only answer this if the following conditions are met:", 'html', $sDataEntryLanguage) . "</strong><br />{$explanation}\n";
}
if ($validation != '') {
$showme .= '<strong>' . gT("The answer(s) must meet these validation criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$validation}\n";
}
if ($showme != '' && $array_filter_help != '') {
$showme .= '<br/>';
}
if ($array_filter_help != '') {
$showme .= '<strong>' . gT("The answer(s) must meet these array_filter criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$array_filter_help}\n";
}
$showme .= '</div>';
$cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
}
//END OF GETTING CONDITIONS
//Alternate bgcolor for different groups
if (!isset($bgc)) {
$bgc = "even";
}
if ($bgc == "even") {
$bgc = "odd";
} else {
//.........这里部分代码省略.........
示例11: _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);
}
示例12: PDF
//SHOW HEADER
$printoutput = '';
if (isset($usepdfexport) && $usepdfexport == 1) {
$printoutput .= "<form action='printanswers.php?printableexport=pdf&sid={$surveyid}' method='post'>\n<center><input type='submit' value='" . $clang->gT("PDF Export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
}
if (isset($_POST['printableexport'])) {
$pdf = new PDF($pdforientation);
$pdf->SetFont($pdfdefaultfont, '', $pdffontsize);
$pdf->AddPage();
$pdf->titleintopdf($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);
$bHonorConditions = $printanswershonorsconditions == 1;
$aFullResponseTable = aGetFullResponseTable($surveyid, $id, $language, $bHonorConditions);
//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 (isset($_POST['printableexport'])) {
$pdf->intopdf($clang->gT("Question", 'unescaped') . ": " . $clang->gT("Your answer", 'unescaped'));
}
$oldgid = 0;
$oldqid = 0;
示例13: display_first_page
/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page()
{
global $clang, $thistpl, $token, $surveyid, $thissurvey, $navigator, $publicurl;
sendcacheheaders();
doHeader();
LimeExpressionManager::StartProcessingPage();
LimeExpressionManager::StartProcessingGroup(-1, false, $surveyid);
// start on welcome page
echo templatereplace(file_get_contents("{$thistpl}/startpage.pstpl"));
echo "\n<form method='post' action='{$publicurl}/index.php' id='limesurvey' name='limesurvey' autocomplete='off'>\n";
echo "\n\n<!-- START THE SURVEY -->\n";
echo templatereplace(file_get_contents("{$thistpl}/welcome.pstpl")) . "\n";
if ($thissurvey['anonymized'] == "Y") {
echo templatereplace(file_get_contents("{$thistpl}/privacy.pstpl")) . "\n";
}
$navigator = surveymover();
echo templatereplace(file_get_contents("{$thistpl}/navigator.pstpl"));
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";
}
echo "\n<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
if (isset($token) && !empty($token)) {
echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
}
echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n";
//This is to ensure consistency with mandatory checks, and new group test
$loadsecurity = returnglobal('loadsecurity');
if (isset($loadsecurity)) {
echo "\n<input type='hidden' name='loadsecurity' value='{$loadsecurity}' id='loadsecurity' />\n";
}
$_SESSION['LEMpostKey'] = mt_rand();
echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION['LEMpostKey']}' id='LEMpostKey' />\n";
echo "<input type='hidden' name='thisstep' id='thisstep' value='0' />\n";
echo "\n</form>\n";
echo templatereplace(file_get_contents("{$thistpl}/endpage.pstpl"));
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
doFooter();
}