本文整理汇总了PHP中LimeExpressionManager::FinishProcessingPage方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::FinishProcessingPage方法的具体用法?PHP LimeExpressionManager::FinishProcessingPage怎么用?PHP LimeExpressionManager::FinishProcessingPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LimeExpressionManager
的用法示例。
在下文中一共展示了LimeExpressionManager::FinishProcessingPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: limesurvey_lang
$clang = new limesurvey_lang("en");
$surveyInfo = explode('|', $_POST['sid']);
$surveyid = $surveyInfo[0];
$assessments = $surveyInfo[1] == 'Y';
$surveyMode = $_POST['surveyMode'];
$LEMdebugLevel = (isset($_POST['LEM_DEBUG_TIMING']) && $_POST['LEM_DEBUG_TIMING'] == 'Y' ? LEM_DEBUG_TIMING : 0) + (isset($_POST['LEM_DEBUG_VALIDATION_SUMMARY']) && $_POST['LEM_DEBUG_VALIDATION_SUMMARY'] == 'Y' ? LEM_DEBUG_VALIDATION_SUMMARY : 0) + (isset($_POST['LEM_DEBUG_VALIDATION_DETAIL']) && $_POST['LEM_DEBUG_VALIDATION_DETAIL'] == 'Y' ? LEM_DEBUG_VALIDATION_DETAIL : 0) + (isset($_POST['LEM_DEBUG_LOG_SYNTAX_ERRORS_TO_DB']) && $_POST['LEM_DEBUG_LOG_SYNTAX_ERRORS_TO_DB'] == 'Y' ? LEM_DEBUG_LOG_SYNTAX_ERRORS_TO_DB : 0) + (isset($_POST['LEM_PRETTY_PRINT_ALL_SYNTAX']) && $_POST['LEM_PRETTY_PRINT_ALL_SYNTAX'] == 'Y' ? LEM_PRETTY_PRINT_ALL_SYNTAX : 0);
$surveyOptions = array('active' => false, 'allowsave' => true, 'anonymized' => false, 'assessments' => $assessments, 'datestamp' => true, 'hyperlinkSyntaxHighlighting' => true, 'ipaddr' => true, 'rooturl' => '../../..');
print '<h3>Starting survey ' . $surveyid . " using Survey Mode '" . $surveyMode . ($assessments ? "' [Uses Assessments]" : "'") . "</h3>";
$now = microtime(true);
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, true, $LEMdebugLevel);
print '<b>[StartSurvey() took ' . (microtime(true) - $now) . ' seconds]</b><br/>';
while (true) {
$now = microtime(true);
$result = LimeExpressionManager::NavigateForwards(true);
print $result['message'] . "<br/>";
LimeExpressionManager::FinishProcessingPage();
// print LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) {
print LimeExpressionManager::GetDebugTimingMessage();
}
print '<b>[NavigateForwards() took ' . (microtime(true) - $now) . ' seconds]</b><br/>';
if (is_null($result) || $result['finished'] == true) {
break;
}
}
print "<h3>Finished survey " . $surveyid . "</h3>";
}
?>
</body>
</html>
示例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'];
// 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 -->";
}
示例4: 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;
}
示例5: ShowSurveyLogicFile
//.........这里部分代码省略.........
if (is_null($rowdivid)) {
continue;
}
++$i;
$subQeqn = ' ';
if (isset($LEM->subQrelInfo[$qid][$rowdivid])) {
$sq = $LEM->subQrelInfo[$qid][$rowdivid];
$subQeqn = $sq['prettyPrintEqn'];
// {' . $sq['eqn'] . '}'; // $sq['prettyPrintEqn'];
if ($sq['hasErrors']) {
++$errorCount;
}
}
$sgqaInfo = $LEM->knownVars[$sgqa];
$subqText = $sgqaInfo['subqtext'];
if (isset($sgqaInfo['default']) && $sgqaInfo['default'] !== '') {
$LEM->ProcessString($sgqaInfo['default'], $qid, NULL, false, 1, 1, false, false);
$_default = $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
$subQeqn .= '<br/>(' . $LEM->gT('DEFAULT:') . ' ' . $_default . ')';
}
$sqRows .= "<tr class='LEMsubq'>" . "<td>SQ-{$i}</td>" . "<td><b>" . $varName . "</b></td>" . "<td>{$subQeqn}</td>" . "<td>" . $subqText . "</td>" . "</tr>";
}
$LEM->ProcessString($sqRows, $qid, NULL, false, 1, 1, false, false);
$sqRows = $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
//////
// SHOW ANSWER OPTIONS FOR ENUMERATED LISTS, AND FOR MULTIFLEXI
//////
$answerRows = '';
if (isset($LEM->qans[$qid]) || isset($LEM->multiflexiAnswers[$qid])) {
$_scale = -1;
if (isset($LEM->multiflexiAnswers[$qid])) {
$ansList = $LEM->multiflexiAnswers[$qid];
} else {
$ansList = $LEM->qans[$qid];
}
foreach ($ansList as $ans => $value) {
$ansInfo = explode('~', $ans);
$valParts = explode('|', $value);
$valInfo[0] = array_shift($valParts);
$valInfo[1] = implode('|', $valParts);
if ($_scale != $ansInfo[0]) {
$i = 1;
$_scale = $ansInfo[0];
}
$answerRows .= "<tr class='LEManswer'>" . "<td>A[" . $ansInfo[0] . "]-" . $i++ . "</td>" . "<td><b>" . $ansInfo[1] . "</b></td>" . "<td>[VALUE: " . $valInfo[0] . "]</td>" . "<td>" . $valInfo[1] . "</td>" . "</tr>\n";
}
$LEM->ProcessString($answerRows, $qid, NULL, false, 1, 1, false, false);
$answerRows = $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
}
//////
// FINALLY, SHOW THE QUESTION ROW(S), COLOR-CODING QUESTIONS THAT CONTAIN ERRORS
//////
$errclass = $errorCount > 0 ? "class='LEMerror' title='" . sprintf($LEM->gT("This question has at least %s error(s)"), $errorCount) . "'" : '';
$questionRow = "<tr class='LEMquestion'>" . "<td {$errclass}>Q-" . $q['info']['qseq'] . "</td>" . "<td><b>" . $mandatory;
if ($varNameErrorMsg == '') {
$questionRow .= $rootVarName;
} else {
$editlink = $LEM->surveyOptions['rooturl'] . '/admin/admin.php?sid=' . $LEM->sid . '&gid=' . $varNameError['gid'] . '&qid=' . $varNameError['qid'];
$questionRow .= "<span style='border-style: solid; border-width: 2px; border-color: #FF00FF; color: red;' title='" . $varNameError['message'] . "' " . "onclick='window.open(\"{$editlink}\",\"_blank\")'>" . $rootVarName . "</span>";
}
$questionRow .= "</b><br/>[<a target='_blank' href='{$rooturl}/admin/admin.php?sid={$sid}&gid={$gid}&qid={$qid}'>QID {$qid}</a>]<br/>{$typedesc} [{$type}]</td>" . "<td>" . $relevance . $prettyValidEqn . $default . "</td>" . "<td>" . $qdetails . "</td>" . "</tr>\n";
$out .= $questionRow;
$out .= $sqRows;
$out .= $answerRows;
if ($errorCount > 0) {
$allErrors[$gid . '~' . $qid] = $errorCount;
}
}
$out .= "</table>";
LimeExpressionManager::FinishProcessingPage();
if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) {
$out .= LimeExpressionManager::GetDebugTimingMessage();
}
if (count($allErrors) > 0) {
$out = "<p class='LEMerror'>" . sprintf($LEM->gT("%s question(s) contain errors that need to be corrected"), count($allErrors)) . "</p>\n" . $out;
} else {
switch ($surveyMode) {
case 'survey':
$message = $LEM->gT('No syntax errors detected in this survey');
break;
case 'group':
$message = $LEM->gT('This group, by itself, does not contain any syntax errors');
break;
case 'question':
$message = $LEM->gT('This question, by itself, does not contain any syntax errors');
break;
}
$out = "<p class='LEMerror'>{$message}</p>\n" . $out;
}
return array('errors' => $allErrors, 'html' => $out);
}
示例6: _renderWrappedTemplate
/**
* Renders template(s) wrapped in header and footer
*
* Addition of parameters should be avoided if they can be added to $aData
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
{
// Gather the data
$aData['clang'] = $clang = Yii::app()->lang;
$aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
$aData = $this->_addPseudoParams($aData);
$aViewUrls = (array) $aViewUrls;
$sViewPath = '/admin/';
if (!empty($sAction)) {
$sViewPath .= $sAction . '/';
}
// Header
if (!isset($aData['display']['header']) || $aData['display']['header'] !== false) {
// Send HTTP header
header("Content-type: text/html; charset=UTF-8");
// needed for correct UTF-8 encoding
Yii::app()->getController()->_getAdminHeader();
}
// Menu bars
if (!isset($aData['display']['menu_bars']) || $aData['display']['menu_bars'] !== false && (!is_array($aData['display']['menu_bars']) || !in_array('browse', array_keys($aData['display']['menu_bars'])))) {
Yii::app()->getController()->_showadminmenu(!empty($aData['surveyid']) ? $aData['surveyid'] : null);
if (!empty($aData['surveyid'])) {
LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
// so can click on syntax highlighting to edit questions
$this->_surveybar($aData['surveyid'], !empty($aData['gid']) ? $aData['gid'] : null);
if (isset($aData['display']['menu_bars']['surveysummary'])) {
if ((empty($aData['display']['menu_bars']['surveysummary']) || !is_string($aData['display']['menu_bars']['surveysummary'])) && !empty($aData['gid'])) {
$aData['display']['menu_bars']['surveysummary'] = 'viewgroup';
}
$this->_surveysummary($aData['surveyid'], !empty($aData['display']['menu_bars']['surveysummary']) ? $aData['display']['menu_bars']['surveysummary'] : null, !empty($aData['gid']) ? $aData['gid'] : null);
}
if (!empty($aData['gid'])) {
if (empty($aData['display']['menu_bars']['gid_action']) && !empty($aData['qid'])) {
$aData['display']['menu_bars']['gid_action'] = 'viewquestion';
}
$this->_questiongroupbar($aData['surveyid'], $aData['gid'], !empty($aData['qid']) ? $aData['qid'] : null, !empty($aData['display']['menu_bars']['gid_action']) ? $aData['display']['menu_bars']['gid_action'] : null);
if (!empty($aData['qid'])) {
$this->_questionbar($aData['surveyid'], $aData['gid'], $aData['qid'], !empty($aData['display']['menu_bars']['qid_action']) ? $aData['display']['menu_bars']['qid_action'] : null);
}
}
LimeExpressionManager::FinishProcessingPage();
}
}
if (!empty($aData['display']['menu_bars']['browse']) && !empty($aData['surveyid'])) {
$this->_browsemenubar($aData['surveyid'], $aData['display']['menu_bars']['browse']);
}
if (!empty($aData['display']['menu_bars']['user_group'])) {
$this->_userGroupBar(!empty($aData['ugid']) ? $aData['ugid'] : 0);
}
// Load views
foreach ($aViewUrls as $sViewKey => $viewUrl) {
if (empty($sViewKey) || !in_array($sViewKey, array('message', 'output'))) {
if (is_numeric($sViewKey)) {
Yii::app()->getController()->render($sViewPath . $viewUrl, $aData);
} elseif (is_array($viewUrl)) {
foreach ($viewUrl as $aSubData) {
$aSubData = array_merge($aData, $aSubData);
Yii::app()->getController()->render($sViewPath . $sViewKey, $aSubData);
}
}
} else {
switch ($sViewKey) {
// Message
case 'message':
if (empty($viewUrl['class'])) {
Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message']);
} else {
Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message'], $viewUrl['class']);
}
break;
// Output
// Output
case 'output':
echo $viewUrl;
break;
}
}
}
// Footer
if (!isset($aData['display']['endscripts']) || $aData['display']['endscripts'] !== false) {
Yii::app()->getController()->_loadEndScripts();
}
if (!isset($aData['display']['footer']) || $aData['display']['footer'] !== false) {
Yii::app()->getController()->_getAdminFooter('http://docs.limesurvey.org', $clang->gT('LimeSurvey online manual'));
}
}
示例7: _renderWrappedTemplate
/**
* Renders template(s) wrapped in header and footer
*
* Addition of parameters should be avoided if they can be added to $aData
*
* NOTE FROM LOUIS : We want to remove this function, wich doesn't respect MVC pattern.
* The work it's doing should be handle by layout files, and subviews inside views.
* Eg : for route "admin/survey/sa/listquestiongroups/surveyid/282267"
* the Group controller should use a main layout (with admin menu bar as a widget), then render the list view, in wich the question group bar is called as a subview.
*
* So for now, we try to evacuate all the renderWrappedTemplate logic (if statements, etc.) to subfunctions, then it will be easier to remove.
* Comments starting with //// indicate how it should work in the future
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
{
// Gather the data
$aData = $this->_addPseudoParams($aData);
//// the check of the surveyid should be done in the Admin controller it self.
$aData['sImageURL'] = Yii::app()->getBaseUrl(true) . '/images/lime-icons/328637/';
//// This will be handle by subviews inclusions
$aViewUrls = (array) $aViewUrls;
$sViewPath = '/admin/';
if (!empty($sAction)) {
$sViewPath .= $sAction . '/';
}
ob_start();
//// That was used before the MVC pattern, in procedural code. Will not be used anymore.
$this->_showHeaders($aData);
//// THe headers will be called from the layout
$this->_showadminmenu();
//// The admin menu will be called from the layout, probably as a widget for dynamic content.
$this->_userGroupBar($aData);
//// Here will start the rendering from the controller of the main view.
//// For example, the Group controller will use the main.php layout, and then render the view list_group.php
//// This view will call as a subview the questiongroupbar, and then _listquestiongroup subview.
//// This check will be useless when it will be handle directly by each specific controller.
if (!empty($aData['surveyid'])) {
//// TODO : check what is doing exactly this function. (application/helpers/expressions/em_manager_helper.php)
//// If it's about initialiazing global variables, should be removed and parsed in right controllers.
//// But it seems that it's just useless.
LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
// so can click on syntax highlighting to edit questions
$oSurvey = $aData['oSurvey'] = Survey::model()->findByPk($aData['surveyid']);
$this->_titlebar($aData);
//// Each view will call the correct bar as a subview.
$this->_surveybar($aData);
$this->_nquestiongroupbar($aData);
$this->_questionbar($aData);
$this->_browsemenubar($aData);
$this->_tokenbar($aData);
$this->_organizequestionbar($aData);
//// TODO : check what it's doing exactly, and why it is here (not after or before)
//// It seems that it is not used at all. It's about timing
LimeExpressionManager::FinishProcessingPage();
//// TODO : Move this div inside each correct view ASAP !
echo '<div class="container-fluid" id="in_survey_common"><div class="row">';
$this->_updatenotification();
$this->_notifications();
//// Here the main content views.
$this->_surveysidemenu($aData);
$this->_listquestiongroups($aData);
$this->_listquestions($aData);
$this->_nsurveysummary($aData);
} else {
///
$this->_fullpagebar($aData);
$this->_updatenotification();
$this->_notifications();
//// TODO : Move this div inside each correct view ASAP !
echo '
<!-- Full page, started in Survey_Common_Action::render_wrapped_template() -->
<div class="container-fluid full-page-wrapper" id="in_survey_common_action">
<div class="row">';
}
//// Here the rendering of all the subviews process. Will not be use anymore, because each subview will be directly called from her parent view.
//// TODO : while refactoring, we must replace the use of $aViewUrls by $aData[.. conditions ..], and then call to function such as $this->_nsurveysummary($aData);
// Load views
foreach ($aViewUrls as $sViewKey => $viewUrl) {
if (empty($sViewKey) || !in_array($sViewKey, array('message', 'output'))) {
if (is_numeric($sViewKey)) {
Yii::app()->getController()->renderPartial($sViewPath . $viewUrl, $aData);
} elseif (is_array($viewUrl)) {
foreach ($viewUrl as $aSubData) {
$aSubData = array_merge($aData, $aSubData);
Yii::app()->getController()->renderPartial($sViewPath . $sViewKey, $aSubData);
}
}
} else {
switch ($sViewKey) {
//// We'll use some Bootstrap alerts, and call them inside each correct view.
// Message
case 'message':
if (empty($viewUrl['class'])) {
Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message']);
} else {
Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message'], $viewUrl['class']);
//.........这里部分代码省略.........
示例8: 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();
}
示例9: _renderWrappedTemplate
/**
* Renders template(s) wrapped in header and footer
*
* Addition of parameters should be avoided if they can be added to $aData
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
{
// Gather the data
$aData['clang'] = $clang = Yii::app()->lang;
$aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
$aData = $this->_addPseudoParams($aData);
$aViewUrls = (array) $aViewUrls;
$sViewPath = '/pl/';
if (!empty($sAction)) {
$sViewPath .= $sAction . '/';
}
// Header
ob_start();
if (!isset($aData['display']['header']) || $aData['display']['header'] !== false) {
// Send HTTP header
header("Content-type: text/html; charset=UTF-8");
// needed for correct UTF-8 encoding
Yii::app()->getController()->_getPLHeader();
}
// Menu bars
if (!isset($aData['display']['menu_bars']) || $aData['display']['menu_bars'] !== false && (!is_array($aData['display']['menu_bars']) || !in_array('browse', array_keys($aData['display']['menu_bars'])))) {
Yii::app()->getController()->_showPLmenu(!empty($aData['plid']) ? $aData['plid'] : null);
if (!empty($aData['plid'])) {
LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
// so can click on syntax highlighting to edit questions
$this->_surveybar($aData['plid'], !empty($aData['gid']) ? $aData['gid'] : null);
LimeExpressionManager::FinishProcessingPage();
}
}
// Load views
foreach ($aViewUrls as $sViewKey => $viewUrl) {
if (empty($sViewKey) || !in_array($sViewKey, array('message', 'output'))) {
if (is_numeric($sViewKey)) {
Yii::app()->getController()->renderPartial($sViewPath . $viewUrl, $aData);
} elseif (is_array($viewUrl)) {
foreach ($viewUrl as $aSubData) {
$aSubData = array_merge($aData, $aSubData);
Yii::app()->getController()->renderPartial($sViewPath . $sViewKey, $aSubData);
}
}
} else {
switch ($sViewKey) {
// Message
case 'message':
if (empty($viewUrl['class'])) {
Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message']);
} else {
Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message'], $viewUrl['class']);
}
break;
// Output
// Output
case 'output':
echo $viewUrl;
break;
}
}
}
// Footer
/*
if (!isset($aData['display']['endscripts']) || $aData['display']['endscripts'] !== false)
Yii::app()->getController()->_loadEndScripts();
*/
if (!isset($aData['display']['footer']) || $aData['display']['footer'] !== false) {
Yii::app()->getController()->_getPLFooter('http://docs.gowebsurvey.com', $clang->gT('GoWebSurvey Online Manual'));
}
$out = ob_get_contents();
ob_clean();
App()->getClientScript()->render($out);
echo $out;
}
示例10: 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();
}
示例11: 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();
}
示例12: 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);
}
}
示例13: _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);
}
示例14: _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);
}
示例15: ShowSurveyLogicFile
//.........这里部分代码省略.........
$sgqaInfo = $LEM->knownVars[$sgqa];
$subqText = $sgqaInfo['subqtext'];
if (isset($sgqaInfo['default']) && $sgqaInfo['default'] !== '') {
$LEM->ProcessString(htmlspecialchars($sgqaInfo['default']), $qid, NULL, false, 1, 1, false, false);
$_default = viewHelper::filterScript($LEM->GetLastPrettyPrintExpression());
if ($LEM->em->HasErrors()) {
++$errorCount;
}
$subQeqn .= '<br />(' . $LEM->gT('Default:') . ' ' . $_default . ')';
}
$sqRows .= "<tr class='LEMsubq'>" . "<td>SQ-{$i}</td>" . "<td><b>" . $varName . "</b></td>" . "<td>{$subQeqn}</td>" . "<td>" . $subqText . "</td>" . "</tr>";
}
$LEM->ProcessString($sqRows, $qid, NULL, false, 1, 1, false, false);
$sqRows = viewHelper::filterScript($LEM->GetLastPrettyPrintExpression());
if ($LEM->em->HasErrors()) {
++$errorCount;
}
//////
// SHOW ANSWER OPTIONS FOR ENUMERATED LISTS, AND FOR MULTIFLEXI
//////
$answerRows = '';
if (isset($LEM->qans[$qid]) || isset($LEM->multiflexiAnswers[$qid])) {
$_scale = -1;
if (isset($LEM->multiflexiAnswers[$qid])) {
$ansList = $LEM->multiflexiAnswers[$qid];
} else {
$ansList = $LEM->qans[$qid];
}
foreach ($ansList as $ans => $value) {
$ansInfo = explode('~', $ans);
$valParts = explode('|', $value);
$valInfo[0] = array_shift($valParts);
$valInfo[1] = implode('|', $valParts);
if ($_scale != $ansInfo[0]) {
$i = 1;
$_scale = $ansInfo[0];
}
$subQeqn = '';
$rowdivid = $sgqas[0] . $ansInfo[1];
if ($q['info']['type'] == 'R') {
$rowdivid = $LEM->sid . 'X' . $gid . 'X' . $qid . $ansInfo[1];
}
if (isset($LEM->subQrelInfo[$qid][$rowdivid])) {
$sq = $LEM->subQrelInfo[$qid][$rowdivid];
$subQeqn = ' ' . $sq['prettyPrintEqn'];
if ($sq['hasErrors']) {
++$errorCount;
}
}
$answerRows .= "<tr class='LEManswer'>" . "<td>A[" . $ansInfo[0] . "]-" . $i++ . "</td>" . "<td><b>" . $ansInfo[1] . "</b></td>" . "<td>[VALUE: " . $valInfo[0] . "]" . $subQeqn . "</td>" . "<td>" . $valInfo[1] . "</td>" . "</tr>\n";
}
$LEM->ProcessString($answerRows, $qid, NULL, false, 1, 1, false, false);
$answerRows = viewHelper::filterScript($LEM->GetLastPrettyPrintExpression());
if ($LEM->em->HasErrors()) {
++$errorCount;
}
}
//////
// FINALLY, SHOW THE QUESTION ROW(S), COLOR-CODING QUESTIONS THAT CONTAIN ERRORS
//////
$errclass = $errorCount > 0 ? "class='LEMerror' title='" . $LEM->ngT("This question has at least {n} error.|This question has at least {n} errors.", $errorCount) . "'" : '';
$questionRow = "<tr class='LEMquestion'>" . "<td {$errclass}>Q-" . $q['info']['qseq'] . "</td>" . "<td><b>" . $mandatory;
if ($varNameErrorMsg == '') {
$questionRow .= $rootVarName;
} else {
$editlink = Yii::app()->getController()->createUrl('admin/questions/sa/view/surveyid/' . $LEM->sid . '/gid/' . $varNameError['gid'] . '/qid/' . $varNameError['qid']);
$questionRow .= "<span class='highlighterror' title='" . $varNameError['message'] . "' " . "onclick='window.open(\"{$editlink}\",\"_blank\")'>" . $rootVarName . "</span>";
}
$editlink = Yii::app()->getController()->createUrl('admin/questions/sa/view/surveyid/' . $sid . '/gid/' . $gid . '/qid/' . $qid);
$questionRow .= "</b><br />[<a target='_blank' href='{$editlink}'>QID {$qid}</a>]<br/>{$typedesc} [{$type}]</td>" . "<td>" . $relevance . $prettyValidEqn . $default . "</td>" . "<td>" . $qdetails . "</td>" . "</tr>\n";
$out .= $questionRow;
$out .= $sqRows;
$out .= $answerRows;
if ($errorCount > 0) {
$allErrors[$gid . '~' . $qid] = $errorCount;
}
}
$out .= "</table>";
LimeExpressionManager::FinishProcessingPage();
if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) {
$out .= LimeExpressionManager::GetDebugTimingMessage();
}
if (count($allErrors) > 0) {
$out = "<p class='LEMerror'>" . $LEM->ngT("{n} question contains errors that need to be corrected.|{n} questions contain errors that need to be corrected.", count($allErrors)) . "</p>\n" . $out;
} else {
switch ($surveyMode) {
case 'survey':
$message = $LEM->gT('No syntax errors detected in this survey.');
break;
case 'group':
$message = $LEM->gT('This group, by itself, does not contain any syntax errors.');
break;
case 'question':
$message = $LEM->gT('This question, by itself, does not contain any syntax errors.');
break;
}
$out = "<p class='LEMheading'>{$message}</p>\n" . $out . "</div>";
}
return array('errors' => $allErrors, 'html' => $out);
}