本文整理汇总了PHP中sendCacheHeaders函数的典型用法代码示例。如果您正苦于以下问题:PHP sendCacheHeaders函数的具体用法?PHP sendCacheHeaders怎么用?PHP sendCacheHeaders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendCacheHeaders函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showsaveform
function showsaveform()
{
//Show 'SAVE FORM' only when click the 'Save so far' button the first time, or when duplicate is found on SAVE FORM.
global $errormsg, $thissurvey, $surveyid, $clang, $clienttoken, $thisstep;
$redata = compact(array_keys(get_defined_vars()));
$sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata);
echo "\n\n<!-- JAVASCRIPT FOR CONDITIONAL QUESTIONS -->\n" . "\t<script type='text/javascript'>\n" . "\t<!--\n" . "function checkconditions(value, name, type, evt_type)\n" . "\t{\n" . "\t}\n" . "\t//-->\n" . "\t</script>\n\n";
echo CHtml::form(array("/survey/index"), 'post') . "\n";
//PRESENT OPTIONS SCREEN
if (isset($errormsg) && $errormsg != "") {
$errormsg .= "<p>" . $clang->gT("Please try again.") . "</p>";
}
echo templatereplace(file_get_contents($sTemplatePath . "save.pstpl"), array(), $redata);
//END
echo "<input type='hidden' name='sid' value='{$surveyid}' />\n";
echo "<input type='hidden' name='thisstep' value='{$thisstep}' />\n";
echo CHtml::hiddenField('token', $clienttoken) . "\n";
echo "<input type='hidden' name='saveprompt' value='Y' />\n";
echo "</form>";
echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata);
echo "</html>\n";
exit;
}
示例2: _renderHtml
private function _renderHtml($html, $thistpl, $clang)
{
sendCacheHeaders();
doHeader();
$data['html'] = $html;
$data['thistpl'] = $thistpl;
$data['clang'] = $clang;
$this->render('/opt_view', $data);
doFooter();
}
示例3: _renderHtml
private function _renderHtml($html, $thistpl, $aSurveyInfo)
{
sendCacheHeaders();
doHeader();
$aSupportData = array('thissurvey' => $aSurveyInfo);
echo templatereplace(file_get_contents($thistpl . DIRECTORY_SEPARATOR . 'startpage.pstpl'), array(), $aSupportData);
$aData['html'] = $html;
$aData['thistpl'] = $thistpl;
$this->render('/opt_view', $aData);
echo templatereplace(file_get_contents($thistpl . DIRECTORY_SEPARATOR . 'endpage.pstpl'), array(), $aSupportData);
doFooter();
}
示例4: _renderHtml
private function _renderHtml($html, $thistpl, $aSurveyInfo)
{
sendCacheHeaders();
doHeader();
$aSupportData = array('thissurvey' => $aSurveyInfo);
$oTemplate = Template::model()->getInstance();
$sTemplatePath = $oTemplate->path;
$thistpl = $oTemplate->viewPath;
echo templatereplace(file_get_contents($thistpl . 'startpage.pstpl'), array(), $aSupportData);
$aData['html'] = $html;
$aData['thistpl'] = $thistpl;
$this->render('/opt_view', $aData);
echo templatereplace(file_get_contents($thistpl . 'endpage.pstpl'), array(), $aSupportData);
doFooter();
}
示例5: _renderHtml
private function _renderHtml($html, $thistpl, $aSurveyInfo)
{
sendCacheHeaders();
doHeader();
$aSupportData = array('thissurvey' => $aSurveyInfo);
// $oTemplate is a global variable defined in controller/survey/index
global $oTemplate;
$sTemplatePath = $oTemplate->path;
$thistpl = $oTemplate->viewPath;
echo templatereplace(file_get_contents($thistpl . 'startpage.pstpl'), array(), $aSupportData);
$aData['html'] = $html;
$aData['thistpl'] = $thistpl;
$this->render('/opt_view', $aData);
echo templatereplace(file_get_contents($thistpl . 'endpage.pstpl'), array(), $aSupportData);
doFooter();
}
示例6: _renderHtml
/**
* Render stuff
*
* @param string $html
* @param array $aSurveyInfo
* @param int $iSurveyID
* @return void
*/
private function _renderHtml($html, $aSurveyInfo, $iSurveyID)
{
sendCacheHeaders();
doHeader();
$aSupportData = array('thissurvey' => $aSurveyInfo);
$oTemplate = Template::model()->getInstance(null, $iSurveyID);
if ($oTemplate->cssFramework == 'bootstrap') {
App()->bootstrap->register();
}
$thistpl = $oTemplate->viewPath;
echo templatereplace(file_get_contents($thistpl . 'startpage.pstpl'), array(), $aSupportData);
$aData['html'] = $html;
$aData['thistpl'] = $thistpl;
$this->render('/opt_view', $aData);
echo templatereplace(file_get_contents($thistpl . 'endpage.pstpl'), array(), $aSupportData);
doFooter();
}
示例7: run
function run($args)
{
extract($args);
$redata = compact(array_keys(get_defined_vars()));
$sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata);
echo "\n\n<!-- JAVASCRIPT FOR CONDITIONAL QUESTIONS -->\n" . "\t<script type='text/javascript'>\n" . "function checkconditions(value, name, type, evt_type)\n" . "\t{\n" . "\t}\n" . "\t</script>\n\n";
echo CHtml::form(array("/survey/index", "sid" => $surveyid), 'post') . "\n";
echo templatereplace(file_get_contents($sTemplatePath . "load.pstpl"), array(), $redata);
//PRESENT OPTIONS SCREEN (Replace with Template Later)
//END
echo "<input type='hidden' name='loadall' value='reload' />\n";
if (isset($clienttoken) && $clienttoken != "") {
echo "<input type='hidden' name='token' value='{$clienttoken}' />\n";
}
echo "</form>";
echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata);
doFooter();
exit;
}
示例8: 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();
}
示例9: 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 -->";
}
示例10: _niceExit
function _niceExit(&$redata, $iDebugLine, $sTemplateDir = null, $asMessage = array())
{
global $oTemplate;
$asMessage[] = "<input type='hidden' class='hidemenubutton'/>";
if (isset($redata['surveyid']) && $redata['surveyid'] && !isset($thisurvey)) {
$thissurvey = getSurveyInfo($redata['surveyid']);
$sTemplateDir = $oTemplate->viewPath;
} else {
$sTemplateDir = $oTemplate->viewPath;
}
sendCacheHeaders();
doHeader();
$oTemplate = $this->oTemplate;
//$oTemplate->viewPath;
echo "<!-- survey/index/_niceExit -->";
$this->_printTemplateContent($oTemplate->viewPath . '/startpage.pstpl', $redata, $iDebugLine);
$this->_printMessage($asMessage);
$this->_printTemplateContent($oTemplate->viewPath . '/endpage.pstpl', $redata, $iDebugLine);
doFooter();
exit;
}
示例11: run
//.........这里部分代码省略.........
$notvalidated = explode('|', $invalidSQList);
} else {
$notvalidated = array();
}
}
// CHECK UPLOADED FILES
// TMSW - Move this into LEM::NavigateForwards?
$filenotvalidated = checkUploadedFileValidity($surveyid, $move, $backok);
//SEE IF THIS GROUP SHOULD DISPLAY
$show_empty_group = false;
if ($_SESSION[$LEMsessid]['step'] == 0) {
$show_empty_group = true;
}
$redata = compact(array_keys(get_defined_vars()));
//SUBMIT ###############################################################################
if (isset($move) && $move == "movesubmit") {
// setcookie("limesurvey_timers", "", time() - 3600); // remove the timers cookies //@todo fix - sometimes results in headers already sent error
if ($thissurvey['refurl'] == "Y") {
if (!in_array("refurl", $_SESSION[$LEMsessid]['insertarray'])) {
$_SESSION[$LEMsessid]['insertarray'][] = "refurl";
}
}
resetTimers();
//Before doing the "templatereplace()" function, check the $thissurvey['url']
//field for limereplace stuff, and do transformations!
$thissurvey['surveyls_url'] = passthruReplace($thissurvey['surveyls_url'], $thissurvey);
$thissurvey['surveyls_url'] = templatereplace($thissurvey['surveyls_url'], $thissurvey);
// to do INSERTANS substitutions
//END PAGE - COMMIT CHANGES TO DATABASE
if ($thissurvey['active'] != "Y") {
if ($thissurvey['assessments'] == "Y") {
$assessments = doAssessment($surveyid);
}
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata);
//Check for assessments
if ($thissurvey['assessments'] == "Y" && $assessments) {
echo templatereplace(file_get_contents($sTemplatePath . "assessment.pstpl"), array(), $redata);
}
// fetch all filenames from $_SESSIONS['files'] and delete them all
// from the /upload/tmp/ directory
/* echo "<pre>";print_r($_SESSION);echo "</pre>";
for($i = 1; isset($_SESSION[$LEMsessid]['files'][$i]); $i++)
{
unlink('upload/tmp/'.$_SESSION[$LEMsessid]['files'][$i]['filename']);
}
*/
// can't kill session before end message, otherwise INSERTANS doesn't work.
$completed = templatereplace($thissurvey['surveyls_endtext']);
$completed .= "<br /><strong><font size='2' color='red'>" . $clang->gT("Did Not Save") . "</font></strong><br /><br />\n\n";
$completed .= $clang->gT("Your survey responses have not been recorded. This survey is not yet active.") . "<br /><br />\n";
if ($thissurvey['printanswers'] == 'Y') {
// 'Clear all' link is only relevant for survey with printanswers enabled
// in other cases the session is cleared at submit time
$completed .= "<a href='" . Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}/move/clearall") . "'>" . $clang->gT("Clear Responses") . "</a><br /><br />\n";
}
} else {
if ($thissurvey['usecookie'] == "Y" && $tokensexist != 1) {
setcookie("LS_" . $surveyid . "_STATUS", "COMPLETE", time() + 31536000);
//Cookie will expire in 365 days
}
$content = '';
$content .= templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata);
//Check for assessments
if ($thissurvey['assessments'] == "Y") {
示例12: array
$list .= CHtml::link(stripJavaScript($survey->localizedTitle), array('survey/index', 'sid' => $survey->sid, 'lang' => App()->lang->langcode), array('class' => 'surveytitle'));
$list .= CHtml::closeTag('li');
$list .= CHtml::tag('div', array('data-regformsurvey' => $survey->sid));
}
}
if (empty($list)) {
$list = CHtml::openTag('li', array('class' => 'surveytitle')) . gT("No available surveys") . CHtml::closeTag('li');
}
$data['surveylist'] = array("nosid" => "", "contact" => sprintf(App()->lang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), encodeEmail(Yii::app()->getConfig("siteadminemail"))), "listheading" => App()->lang->gT("The following surveys are available:"), "list" => $list);
$data['templatedir'] = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
$data['templateurl'] = getTemplateURL(Yii::app()->getConfig("defaulttemplate")) . "/";
$data['templatename'] = Yii::app()->getConfig("defaulttemplate");
$data['sitename'] = Yii::app()->getConfig("sitename");
$data['languagechanger'] = makeLanguageChanger(App()->lang->langcode);
//A nice exit
sendCacheHeaders();
doHeader();
// Javascript Var
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
if (isset($thissurvey['surveyls_numberformat'])) {
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
} else {
$aLangData = getLanguageData();
$radix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
// or $clang->langcode . defaultlang ensure it's same for each language ?
}
$aLSJavascriptVar['sLEMradix'] = $radix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar);
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
示例13: actionIndex
//.........这里部分代码省略.........
// Get the survey settings for token length
$tokenlength = $thissurvey['tokenlength'];
//if tokenlength is not set or there are other problems use the default value (15)
if (!isset($tokenlength) || $tokenlength == '') {
$tokenlength = 15;
}
while ($mayinsert != true) {
$newtoken = randomChars($tokenlength);
$oTokenExist = TokenDynamic::model($iSurveyID)->find('token=:token', array(':token' => $newtoken));
if (!$oTokenExist) {
$mayinsert = true;
}
}
$postfirstname = sanitize_xss_string(strip_tags(Yii::app()->request->getPost('register_firstname')));
$postlastname = sanitize_xss_string(strip_tags(Yii::app()->request->getPost('register_lastname')));
$starttime = sanitize_xss_string(Yii::app()->request->getPost('startdate'));
$endtime = sanitize_xss_string(Yii::app()->request->getPost('enddate'));
/*$postattribute1=sanitize_xss_string(strip_tags(returnGlobal('register_attribute1')));
$postattribute2=sanitize_xss_string(strip_tags(returnGlobal('register_attribute2'))); */
// Insert new entry into tokens db
$oToken = Token::create($thissurvey['sid']);
$oToken->firstname = $postfirstname;
$oToken->lastname = $postlastname;
$oToken->email = Yii::app()->request->getPost('register_email');
$oToken->emailstatus = 'OK';
$oToken->token = $newtoken;
if ($starttime && $endtime) {
$oToken->validfrom = $starttime;
$oToken->validuntil = $endtime;
}
$oToken->setAttributes($attributeinsertdata, false);
$result = $oToken->save();
//$tid = $oToken->tid;// Not needed any more
$fieldsarray["{ADMINNAME}"] = $thissurvey['adminname'];
$fieldsarray["{ADMINEMAIL}"] = $thissurvey['adminemail'];
$fieldsarray["{SURVEYNAME}"] = $thissurvey['name'];
$fieldsarray["{SURVEYDESCRIPTION}"] = $thissurvey['description'];
$fieldsarray["{FIRSTNAME}"] = $postfirstname;
$fieldsarray["{LASTNAME}"] = $postlastname;
$fieldsarray["{EXPIRY}"] = $thissurvey["expiry"];
$fieldsarray["{TOKEN}"] = $oToken->token;
$fieldsarray["{EMAIL}"] = $oToken->email;
$token = $oToken->token;
$message = $thissurvey['email_register'];
$subject = $thissurvey['email_register_subj'];
$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
$surveylink = $this->createAbsoluteUrl("/survey/index/sid/{$iSurveyID}", array('lang' => $sBaseLanguage, 'token' => $newtoken));
$optoutlink = $this->createAbsoluteUrl("/optout/tokens/surveyid/{$iSurveyID}", array('langcode' => $sBaseLanguage, 'token' => $newtoken));
$optinlink = $this->createAbsoluteUrl("/optin/tokens/surveyid/{$iSurveyID}", array('langcode' => $sBaseLanguage, 'token' => $newtoken));
if (getEmailFormat($iSurveyID) == 'html') {
$useHtmlEmail = true;
$fieldsarray["{SURVEYURL}"] = "<a href='{$surveylink}'>" . $surveylink . "</a>";
$fieldsarray["{OPTOUTURL}"] = "<a href='{$optoutlink}'>" . $optoutlink . "</a>";
$fieldsarray["{OPTINURL}"] = "<a href='{$optinlink}'>" . $optinlink . "</a>";
} else {
$useHtmlEmail = false;
$fieldsarray["{SURVEYURL}"] = $surveylink;
$fieldsarray["{OPTOUTURL}"] = $optoutlink;
$fieldsarray["{OPTINURL}"] = $optinlink;
}
$message = ReplaceFields($message, $fieldsarray);
$subject = ReplaceFields($subject, $fieldsarray);
$html = "";
//Set variable
$sitename = Yii::app()->getConfig('sitename');
if (SendEmailMessage($message, $subject, Yii::app()->request->getPost('register_email'), $from, $sitename, $useHtmlEmail, getBounceEmail($iSurveyID))) {
// TLR change to put date into sent
$today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
$oToken->sent = $today;
$oToken->save();
$html = "<div id='wrapper' class='message tokenmessage'>" . "<p>" . $clang->gT("Thank you for registering to participate in this survey.") . "</p>\n" . "<p>" . $clang->gT("An email has been sent to the address you provided with access details for this survey. Please follow the link in that email to proceed.") . "</p>\n" . "<p>" . $clang->gT("Survey administrator") . " {ADMINNAME} ({ADMINEMAIL})</p>" . "</div>\n";
$html = ReplaceFields($html, $fieldsarray);
} else {
$html = "Email Error";
}
//PRINT COMPLETED PAGE
if (!$thissurvey['template']) {
$thistpl = getTemplatePath(validateTemplateDir('default'));
} else {
$thistpl = getTemplatePath(validateTemplateDir($thissurvey['template']));
}
// Same fix than http://bugs.limesurvey.org/view.php?id=8441
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
sendCacheHeaders();
doHeader();
Yii::app()->lang = $clang;
// fetch the defined variables and pass it to the header footer templates.
$redata = compact(array_keys(get_defined_vars()));
$this->_printTemplateContent($thistpl . '/startpage.pstpl', $redata, __LINE__);
$this->_printTemplateContent($thistpl . '/survey.pstpl', $redata, __LINE__);
echo $html;
$this->_printTemplateContent($thistpl . '/endpage.pstpl', $redata, __LINE__);
doFooter();
ob_flush();
}
示例14: display
/**
* Display needed public page
* @param $iSurveyId
*/
private function display($iSurveyId)
{
$sLanguage = Yii::app()->language;
$aData['surveyid'] = $surveyid = $iSurveyId;
$aData['thissurvey'] = getSurveyInfo($iSurveyId, $sLanguage);
$sTemplate = getTemplatePath($aData['thissurvey']['template']);
Yii::app()->setConfig('surveyID', $iSurveyId);
//Needed for languagechanger
$aData['sitename'] = Yii::app()->getConfig('sitename');
$aData['aRegisterErrors'] = $this->aRegisterErrors;
$aData['sMessage'] = $this->sMessage;
sendCacheHeaders();
doHeader();
$aViewData['sTemplate'] = $sTemplate;
if (!$this->sMessage) {
$aData['languagechanger'] = makeLanguageChangerSurvey($sLanguage);
// Only show language changer shown the form is shown, not after submission
$aViewData['content'] = self::getRegisterForm($iSurveyId);
} else {
$aViewData['content'] = templatereplace($this->sMessage);
}
$aViewData['aData'] = $aData;
// Test if we come from index or from register
if (empty(App()->clientScript->scripts)) {
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-touch-punch');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
useFirebug();
$this->render('/register/display', $aViewData);
} else {
// urvey/index need renderPartial
$this->renderPartial('/register/display', $aViewData);
}
doFooter();
}
示例15: 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_') {
//.........这里部分代码省略.........