本文整理汇总了PHP中getTemplateURL函数的典型用法代码示例。如果您正苦于以下问题:PHP getTemplateURL函数的具体用法?PHP getTemplateURL怎么用?PHP getTemplateURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTemplateURL函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: templatereplace
/**
* This function replaces keywords in a text and is mainly intended for templates
* If you use this functions put your replacement strings into the $replacements variable
* instead of using global variables
* NOTE - Don't do any embedded replacements in this function. Create the array of replacement values and
* they will be done in batch at the end
*
* @param mixed $line Text to search in
* @param mixed $replacements Array of replacements: Array( <stringtosearch>=><stringtoreplacewith>
* @param boolean $anonymized Determines if token data is being used or just replaced with blanks
* @param questionNum - needed to support dynamic JavaScript-based tailoring within questions
* @return string Text with replaced strings
*/
function templatereplace($line, $replacements = array(), &$redata = array(), $debugSrc = 'Unspecified', $anonymized = false, $questionNum = NULL, $registerdata = array())
{
/*
global $clienttoken,$token,$sitename,$move,$showxquestions,$showqnumcode,$questioncode,$register_errormsg;
global $s_lang,$errormsg,$saved_id, $relativeurl, $languagechanger,$captchapath,$loadname;
*/
/*
$allowedvars = array('surveylist', 'sitename', 'clienttoken', 'rooturl', 'thissurvey', 'imageurl', 'defaulttemplate',
'percentcomplete', 'move', 'groupname', 'groupdescription', 'question', 'showxquestions',
'showgroupinfo', 'showqnumcode', 'questioncode', 'answer', 'navigator', 'help', 'totalquestions',
'surveyformat', 'completed', 'register_errormsg', 'notanswered', 'privacy', 'surveyid', 'publicurl',
'templatedir', 'token', 'assessments', 's_lang', 'errormsg', 'clang', 'saved_id', 'usertemplaterootdir',
'relativeurl', 'languagechanger', 'printoutput', 'captchapath', 'loadname');
*/
$allowedvars = array('answer', 'assessments', 'captchapath', 'clienttoken', 'completed', 'errormsg', 'groupdescription', 'groupname', 'help', 'imageurl', 'languagechanger', 'loadname', 'move', 'navigator', 'percentcomplete', 'privacy', 'question', 'register_errormsg', 'relativeurl', 's_lang', 'saved_id', 'showgroupinfo', 'showqnumcode', 'showxquestions', 'sitename', 'surveylist', 'templatedir', 'thissurvey', 'token', 'totalBoilerplatequestions', 'totalquestions');
$varsPassed = array();
foreach ($allowedvars as $var) {
if (isset($redata[$var])) {
${$var} = $redata[$var];
$varsPassed[] = $var;
}
}
// if (count($varsPassed) > 0) {
// log_message('debug', 'templatereplace() called from ' . $debugSrc . ' contains: ' . implode(', ', $varsPassed));
// }
// if (isset($redata['question'])) {
// LimeExpressionManager::ShowStackTrace('has QID and/or SGA',$allowedvars);
// }
// extract($redata); // creates variables for each of the keys in the array
// Local over-rides in case not set above
if (!isset($showgroupinfo)) {
$showgroupinfo = Yii::app()->getConfig('showgroupinfo');
}
if (!isset($showqnumcode)) {
$showqnumcode = Yii::app()->getConfig('showqnumcode');
}
$_surveyid = Yii::app()->getConfig('surveyID');
if (!isset($showxquestions)) {
$showxquestions = Yii::app()->getConfig('showxquestions');
}
if (!isset($s_lang)) {
$s_lang = isset(Yii::app()->session['survey_' . $_surveyid]['s_lang']) ? Yii::app()->session['survey_' . $_surveyid]['s_lang'] : 'en';
}
if (!isset($captchapath)) {
$captchapath = '';
}
$clang = Yii::app()->lang;
Yii::app()->loadHelper('surveytranslator');
$questiondetails = array('sid' => 0, 'gid' => 0, 'qid' => 0, 'aid' => 0);
if (isset($question) && isset($question['sgq'])) {
$questiondetails = getSIDGIDQIDAIDType($question['sgq']);
}
//Gets an array containing SID, GID, QID, AID and Question Type)
if (isset($thissurvey['sid'])) {
$surveyid = $thissurvey['sid'];
}
// lets sanitize the survey template
if (isset($thissurvey['templatedir'])) {
$templatename = $thissurvey['templatedir'];
} else {
$templatename = Yii::app()->getConfig('defaulttemplate');
}
if (!isset($templatedir)) {
$templatedir = getTemplatePath($templatename);
}
if (!isset($templateurl)) {
$templateurl = getTemplateURL($templatename) . "/";
}
// TEMPLATECSS and TEMPLATEJS
$_templatecss = "";
$_templatejs = "";
if (stripos($line, "{TEMPLATECSS}")) {
$css_header_includes = Yii::app()->getConfig("css_header_includes");
if (file_exists($templatedir . DIRECTORY_SEPARATOR . 'jquery-ui-custom.css')) {
$template_jqueryui_css = "<link rel='stylesheet' type='text/css' media='all' href='{$templateurl}jquery-ui-custom.css' />\n";
} elseif (file_exists($templatedir . DIRECTORY_SEPARATOR . 'jquery-ui.css')) {
$template_jqueryui_css = "<link rel='stylesheet' type='text/css' media='all' href='{$templateurl}jquery-ui.css' />\n";
} else {
$_templatecss .= "<link rel='stylesheet' type='text/css' media='all' href='" . Yii::app()->getConfig('publicstyleurl') . "jquery-ui.css' />\n";
// Remove it after corrected slider
$template_jqueryui_css = "";
}
if ($css_header_includes) {
foreach ($css_header_includes as $cssinclude) {
if (substr($cssinclude, 0, 4) == 'http' || substr($cssinclude, 0, strlen(Yii::app()->getConfig('publicurl'))) == Yii::app()->getConfig('publicurl')) {
$_templatecss .= "<link rel='stylesheet' type='text/css' media='all' href='" . $cssinclude . "' />\n";
} else {
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:replacements_helper.php
示例2: _initialise
//.........这里部分代码省略.........
}
// Some global data
$aData['sitename'] = Yii::app()->getConfig('sitename');
$siteadminname = Yii::app()->getConfig('siteadminname');
$siteadminemail = Yii::app()->getConfig('siteadminemail');
// Set this so common.php doesn't throw notices about undefined variables
$thissurvey['active'] = 'N';
// FAKE DATA FOR TEMPLATES
$thissurvey['name'] = $clang->gT("Template Sample");
$thissurvey['description'] = "<p>" . $clang->gT('This is a sample survey description. It could be quite long.') . "</p>" . "<p>" . $clang->gT("But this one isn't.") . "<p>";
$thissurvey['welcome'] = "<p>" . $clang->gT('Welcome to this sample survey') . "<p>" . "<p>" . $clang->gT('You should have a great time doing this') . "<p>";
$thissurvey['allowsave'] = "Y";
$thissurvey['active'] = "Y";
$thissurvey['tokenanswerspersistence'] = "Y";
$thissurvey['templatedir'] = $templatename;
$thissurvey['format'] = "G";
$thissurvey['surveyls_url'] = "http://www.limesurvey.org/";
$thissurvey['surveyls_urldescription'] = $clang->gT("Some URL description");
$thissurvey['usecaptcha'] = "A";
$percentcomplete = makegraph(6, 10);
$groupname = $clang->gT("Group 1: The first lot of questions");
$groupdescription = $clang->gT("This group description is fairly vacuous, but quite important.");
$navigator = $this->getController()->render('/admin/templates/templateeditor_navigator_view', array('screenname' => $screenname, 'clang' => $clang), true);
$completed = $this->getController()->render('/admin/templates/templateeditor_completed_view', array('clang' => $clang), true);
$assessments = $this->getController()->render('/admin/templates/templateeditor_assessments_view', array('clang' => $clang), true);
$printoutput = $this->getController()->render('/admin/templates/templateeditor_printoutput_view', array('clang' => $clang), true);
$totalquestions = '10';
$surveyformat = 'Format';
$notanswered = '5';
$privacy = '';
$surveyid = '1295';
$token = 1234567;
$templatedir = getTemplatePath($templatename);
$templateurl = getTemplateURL($templatename);
// Save these variables in an array
$aData['thissurvey'] = $thissurvey;
$aData['percentcomplete'] = $percentcomplete;
$aData['groupname'] = $groupname;
$aData['groupdescription'] = $groupdescription;
$aData['navigator'] = $navigator;
$aData['help'] = $clang->gT("This is some help text.");
$aData['surveyformat'] = $surveyformat;
$aData['totalquestions'] = $totalquestions;
$aData['completed'] = $completed;
$aData['notanswered'] = $notanswered;
$aData['privacy'] = $privacy;
$aData['surveyid'] = $surveyid;
$aData['sid'] = $surveyid;
$aData['token'] = $token;
$aData['assessments'] = $assessments;
$aData['printoutput'] = $printoutput;
$aData['templatedir'] = $templatedir;
$aData['templateurl'] = $templateurl;
$aData['templatename'] = $templatename;
$aData['screenname'] = $screenname;
$aData['editfile'] = $editfile;
$myoutput[] = "";
switch ($screenname) {
case 'surveylist':
unset($files);
$surveylist = array("nosid" => $clang->gT("You have not provided a survey identification number"), "contact" => sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")), "listheading" => $clang->gT("The following surveys are available:"), "list" => $this->getController()->render('/admin/templates/templateeditor_surveylist_view', array(), true));
$aData['surveylist'] = $surveylist;
$myoutput[] = "";
foreach ($SurveyList as $qs) {
$files[] = array("name" => $qs);
$myoutput = array_merge($myoutput, doreplacement(getTemplatePath($templatename) . "/{$qs}", $aData));
开发者ID:Narasimman,项目名称:UrbanExpansion,代码行数:67,代码来源:templates.php
示例3: templatereplace
/**
* This function replaces keywords in a text and is mainly intended for templates
* If you use this functions put your replacement strings into the $replacements variable
* instead of using global variables
* NOTE - Don't do any embedded replacements in this function. Create the array of replacement values and
* they will be done in batch at the end
*
* @param mixed $line Text to search in
* @param mixed $replacements Array of replacements: Array( <stringtosearch>=><stringtoreplacewith>
* @param boolean $anonymized Determines if token data is being used or just replaced with blanks
* @param questionNum - needed to support dynamic JavaScript-based tailoring within questions
* @param bStaticReplacement - Default off, forces non-dynamic replacements without <SPAN> tags (e.g. for the Completed page)
* @return string Text with replaced strings
*/
function templatereplace($line, $replacements = array(), &$redata = array(), $debugSrc = 'Unspecified', $anonymized = false, $questionNum = NULL, $registerdata = array(), $bStaticReplacement = false, $oTemplate = '')
{
/*
global $clienttoken,$token,$sitename,$move,$showxquestions,$showqnumcode,$questioncode;
global $s_lang,$errormsg,$saved_id, $languagechanger,$captchapath,$loadname;
*/
/*
$allowedvars = array('surveylist', 'sitename', 'clienttoken', 'rooturl', 'thissurvey', 'imageurl', 'defaulttemplate',
'percentcomplete', 'move', 'groupname', 'groupdescription', 'question', 'showxquestions',
'showgroupinfo', 'showqnumcode', 'questioncode', 'answer', 'navigator', 'help', 'totalquestions',
'surveyformat', 'completed', 'notanswered', 'privacy', 'surveyid', 'publicurl',
'templatedir', 'token', 'assessments', 's_lang', 'errormsg', 'saved_id', 'usertemplaterootdir',
'languagechanger', 'printoutput', 'captchapath', 'loadname');
*/
$allowedvars = array('assessments', 'captchapath', 'clienttoken', 'completed', 'errormsg', 'groupdescription', 'groupname', 'imageurl', 'languagechanger', 'loadname', 'move', 'navigator', 'moveprevbutton', 'movenextbutton', 'percentcomplete', 'privacy', 's_lang', 'saved_id', 'showgroupinfo', 'showqnumcode', 'showxquestions', 'sitename', 'sitelogo', 'surveylist', 'templatedir', 'thissurvey', 'token', 'totalBoilerplatequestions', 'totalquestions', 'questionindex', 'questionindexmenu');
$varsPassed = array();
foreach ($allowedvars as $var) {
if (isset($redata[$var])) {
${$var} = $redata[$var];
$varsPassed[] = $var;
}
}
// if (count($varsPassed) > 0) {
// log_message('debug', 'templatereplace() called from ' . $debugSrc . ' contains: ' . implode(', ', $varsPassed));
// }
// if (isset($redata['question'])) {
// LimeExpressionManager::ShowStackTrace('has QID and/or SGA',$allowedvars);
// }
// extract($redata); // creates variables for each of the keys in the array
// Local over-rides in case not set above
if (!isset($showgroupinfo)) {
$showgroupinfo = Yii::app()->getConfig('showgroupinfo');
}
if (!isset($showqnumcode)) {
$showqnumcode = Yii::app()->getConfig('showqnumcode');
}
$_surveyid = Yii::app()->getConfig('surveyID');
if (!isset($showxquestions)) {
$showxquestions = Yii::app()->getConfig('showxquestions');
}
if (!isset($s_lang)) {
$s_lang = isset(Yii::app()->session['survey_' . $_surveyid]['s_lang']) ? Yii::app()->session['survey_' . $_surveyid]['s_lang'] : 'en';
}
if ($_surveyid && !isset($thissurvey)) {
$thissurvey = getSurveyInfo($_surveyid, $s_lang);
}
if (!isset($captchapath)) {
$captchapath = '';
}
if (!isset($sitename)) {
$sitename = Yii::app()->getConfig('sitename');
}
if (!isset($saved_id) && isset(Yii::app()->session['survey_' . $_surveyid]['srid'])) {
$saved_id = Yii::app()->session['survey_' . $_surveyid]['srid'];
}
Yii::app()->loadHelper('surveytranslator');
if (isset($thissurvey['sid'])) {
$surveyid = $thissurvey['sid'];
}
// lets sanitize the survey template
if (isset($thissurvey['templatedir'])) {
$templatename = $thissurvey['templatedir'];
} else {
$templatename = Yii::app()->getConfig('defaulttemplate');
}
if (!isset($templatedir)) {
$templatedir = getTemplatePath($templatename);
}
if (!isset($templateurl)) {
$templateurl = getTemplateURL($templatename) . "/";
}
if (!$anonymized && isset($thissurvey['anonymized'])) {
$anonymized = $thissurvey['anonymized'] == "Y";
}
// TEMPLATECSS
$_templatecss = "";
$_templatejs = "";
/**
* Template css/js files from the template config files are loaded.
* It use the asset manager (so user never need to empty the cache, even if template is updated)
* If debug mode is on, no asset manager is used.
*
* oTemplate is defined in controller/survey/index
*
* If templatereplace is called from the template editor, a $oTemplate is provided.
*/
//.........这里部分代码省略.........
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:101,代码来源:replacements_helper.php
示例4: if
if (Permission::model()->hasGlobalPermission('superadmin','read') || Permission::model()->hasGlobalPermission('templates','read') || hasTemplateManageRights(Yii::app()->session["loginID"], $tname) == 1 || $esrow['template']==htmlspecialchars($tname) ) { ?>
<option value='<?php echo $tname; ?>'
<?php if ($esrow['template'] && htmlspecialchars($tname) == $esrow['template']) { ?>
selected='selected'
<?php } elseif (!$esrow['template'] && $tname == Yii::app()->getConfig('defaulttemplate')) { ?>
selected='selected'
<?php } ?>
><?php echo $tname; ?></option>
<?php }
} ?>
</select>
</li>
<li><label for='preview'><?php eT("Template Preview:"); ?></label>
<img alt='<?php eT("Template preview image"); ?>' name='preview' id='preview' src='<?php echo getTemplateURL($esrow['template']); ?>/preview.png' />
</li>
<li><label for='showwelcome'><?php eT("Show welcome screen?") ; ?></label>
<select id='showwelcome' name='showwelcome'>
<option value='Y'
<?php if (!$esrow['showwelcome'] || $esrow['showwelcome'] == "Y") { ?>
selected='selected'
<?php } ?>
><?php eT("Yes") ; ?>
</option>
<option value='N'
<?php if ($esrow['showwelcome'] == "N") { ?>
selected='selected'
<?php } ?>
开发者ID:jgianpiere,项目名称:lime-survey,代码行数:30,代码来源:tabPresentation_view.php
示例5: actionAction
function actionAction($surveyid, $language = null)
{
$sLanguage = $language;
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
$iSurveyID = (int) $surveyid;
//$postlang = returnglobal('lang');
Yii::import('application.libraries.admin.progressbar', true);
Yii::app()->loadHelper("admin/statistics");
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('surveytranslator');
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-touch-punch');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
$data = array();
if (!isset($iSurveyID)) {
$iSurveyID = returnGlobal('sid');
} else {
$iSurveyID = (int) $iSurveyID;
}
if (!$iSurveyID) {
//This next line ensures that the $iSurveyID value is never anything but a number.
safeDie('You have to provide a valid survey ID.');
}
if ($iSurveyID) {
$actresult = Survey::model()->findAll('sid = :sid AND active = :active', array(':sid' => $iSurveyID, ':active' => 'Y'));
//Checked
if (count($actresult) == 0) {
safeDie('You have to provide a valid survey ID.');
} else {
$surveyinfo = getSurveyInfo($iSurveyID);
// CHANGE JSW_NZ - let's get the survey title for display
$thisSurveyTitle = $surveyinfo["name"];
// CHANGE JSW_NZ - let's get css from individual template.css - so define path
$thisSurveyCssPath = getTemplateURL($surveyinfo["template"]);
if ($surveyinfo['publicstatistics'] != 'Y') {
safeDie('The public statistics for this survey are deactivated.');
}
//check if graphs should be shown for this survey
if ($surveyinfo['publicgraphs'] == 'Y') {
$publicgraphs = 1;
} else {
$publicgraphs = 0;
}
}
}
//we collect all the output within this variable
$statisticsoutput = '';
//for creating graphs we need some more scripts which are included here
//True -> include
//False -> forget about charts
if (isset($publicgraphs) && $publicgraphs == 1) {
require_once APPPATH . 'third_party/pchart/pchart/pChart.class';
require_once APPPATH . 'third_party/pchart/pchart/pData.class';
require_once APPPATH . 'third_party/pchart/pchart/pCache.class';
$MyCache = new pCache(Yii::app()->getConfig("tempdir") . DIRECTORY_SEPARATOR);
//$currentuser is created as prefix for pchart files
if (isset($_SERVER['REDIRECT_REMOTE_USER'])) {
$currentuser = $_SERVER['REDIRECT_REMOTE_USER'];
} else {
if (session_id()) {
$currentuser = substr(session_id(), 0, 15);
} else {
$currentuser = "standard";
}
}
}
// Set language for questions and labels to base language of this survey
if ($sLanguage == null || !in_array($sLanguage, Survey::model()->findByPk($iSurveyID)->getAllLanguages())) {
$sLanguage = Survey::model()->findByPk($iSurveyID)->language;
} else {
$sLanguage = sanitize_languagecode($sLanguage);
}
//set survey language for translations
SetSurveyLanguage($iSurveyID, $sLanguage);
//Create header
sendCacheHeaders();
$condition = false;
$sitename = Yii::app()->getConfig("sitename");
$data['surveylanguage'] = $sLanguage;
$data['sitename'] = $sitename;
$data['condition'] = $condition;
$data['thisSurveyCssPath'] = $thisSurveyCssPath;
/*
* only show questions where question attribute "public_statistics" is set to "1"
*/
$query = "SELECT q.* , group_name, group_order FROM {{questions}} q, {{groups}} g, {{question_attributes}} qa\n WHERE g.gid = q.gid AND g.language = :lang1 AND q.language = :lang2 AND q.sid = :surveyid AND q.qid = qa.qid AND q.parent_qid = 0 AND qa.attribute = 'public_statistics'";
$databasetype = Yii::app()->db->getDriverName();
if ($databasetype == 'mssql' || $databasetype == "sqlsrv" || $databasetype == "dblib") {
$query .= " AND CAST(CAST(qa.value as varchar) as int)='1'\n";
} else {
$query .= " AND qa.value='1'\n";
}
//execute query
$result = Yii::app()->db->createCommand($query)->bindParam(":lang1", $sLanguage, PDO::PARAM_STR)->bindParam(":lang2", $sLanguage, PDO::PARAM_STR)->bindParam(":surveyid", $iSurveyID, PDO::PARAM_INT)->queryAll();
//store all the data in $rows
//.........这里部分代码省略.........
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:101,代码来源:Statistics_userController.php
示例6: index
/**
* Show printable survey
*/
function index($surveyid, $lang = null)
{
$surveyid = sanitize_int($surveyid);
if (!Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'read')) {
$aData['surveyid'] = $surveyid;
App()->getClientScript()->registerPackage('jquery-superfish');
$message['title'] = gT('Access denied!');
$message['message'] = gT('You do not have sufficient rights to access this page.');
$message['class'] = "error";
$this->_renderWrappedTemplate('survey', array("message" => $message), $aData);
} else {
$aSurveyInfo = getSurveyInfo($surveyid, $lang);
if (!$aSurveyInfo) {
$this->getController()->error('Invalid survey ID');
}
SetSurveyLanguage($surveyid, $lang);
$sLanguageCode = App()->language;
$templatename = $aSurveyInfo['template'];
$welcome = $aSurveyInfo['surveyls_welcometext'];
$end = $aSurveyInfo['surveyls_endtext'];
$surveyname = $aSurveyInfo['surveyls_title'];
$surveydesc = $aSurveyInfo['surveyls_description'];
$surveyactive = $aSurveyInfo['active'];
$surveytable = "{{survey_" . $aSurveyInfo['sid'] . "}}";
$surveyexpirydate = $aSurveyInfo['expires'];
$surveyfaxto = $aSurveyInfo['faxto'];
$dateformattype = $aSurveyInfo['surveyls_dateformat'];
Yii::app()->loadHelper('surveytranslator');
if (!is_null($surveyexpirydate)) {
$dformat = getDateFormatData($dateformattype);
$dformat = $dformat['phpdate'];
$expirytimestamp = strtotime($surveyexpirydate);
$expirytimeofday_h = date('H', $expirytimestamp);
$expirytimeofday_m = date('i', $expirytimestamp);
$surveyexpirydate = date($dformat, $expirytimestamp);
if (!empty($expirytimeofday_h) || !empty($expirytimeofday_m)) {
$surveyexpirydate .= ' – ' . $expirytimeofday_h . ':' . $expirytimeofday_m;
}
sprintf(gT("Please submit by %s"), $surveyexpirydate);
} else {
$surveyexpirydate = '';
}
//Fix $templatename : control if print_survey.pstpl exist
if (is_file(getTemplatePath($templatename) . DIRECTORY_SEPARATOR . 'print_survey.pstpl')) {
$templatename = $templatename;
// Change nothing
} elseif (is_file(getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . DIRECTORY_SEPARATOR . 'print_survey.pstpl')) {
$templatename = Yii::app()->getConfig("defaulttemplate");
} else {
$templatename = "default";
}
$sFullTemplatePath = getTemplatePath($templatename) . DIRECTORY_SEPARATOR;
$sFullTemplateUrl = getTemplateURL($templatename) . "/";
define('PRINT_TEMPLATE_DIR', $sFullTemplatePath, true);
define('PRINT_TEMPLATE_URL', $sFullTemplateUrl, true);
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$condition = "sid = '{$surveyid}' AND language = '{$sLanguageCode}'";
$degresult = QuestionGroup::model()->getAllGroups($condition, array('group_order'));
//xiao,
if (!isset($surveyfaxto) || !$surveyfaxto and isset($surveyfaxnumber)) {
$surveyfaxto = $surveyfaxnumber;
//Use system fax number if none is set in survey.
}
$headelements = getPrintableHeader();
//if $showsgqacode is enabled at config.php show table name for reference
$showsgqacode = Yii::app()->getConfig("showsgqacode");
if (isset($showsgqacode) && $showsgqacode == true) {
$surveyname = $surveyname . "<br />[" . gT('Database') . " " . gT('table') . ": {$surveytable}]";
} else {
$surveyname = $surveyname;
}
$survey_output = array('SITENAME' => Yii::app()->getConfig("sitename"), 'SURVEYNAME' => $surveyname, 'SURVEYDESCRIPTION' => $surveydesc, 'WELCOME' => $welcome, 'END' => $end, 'THEREAREXQUESTIONS' => 0, 'SUBMIT_TEXT' => gT("Submit Your Survey."), 'SUBMIT_BY' => $surveyexpirydate, 'THANKS' => gT("Thank you for completing this survey."), 'HEADELEMENTS' => $headelements, 'TEMPLATEURL' => PRINT_TEMPLATE_URL, 'FAXTO' => $surveyfaxto, 'PRIVACY' => '', 'GROUPS' => '');
$survey_output['FAX_TO'] = '';
if (!empty($surveyfaxto) && $surveyfaxto != '000-00000000') {
$survey_output['FAX_TO'] = gT("Please fax your completed survey to:") . " {$surveyfaxto}";
}
$total_questions = 0;
$mapquestionsNumbers = array();
$answertext = '';
// otherwise can throw an error on line 1617
$fieldmap = createFieldMap($surveyid, 'full', false, false, $sLanguageCode);
// =========================================================
// START doin the business:
foreach ($degresult->readAll() as $degrow) {
// ---------------------------------------------------
// START doing groups
$deqresult = Question::model()->getQuestions($surveyid, $degrow['gid'], $sLanguageCode, 0, '"I"');
$deqrows = array();
//Create an empty array in case FetchRow does not return any rows
foreach ($deqresult->readAll() as $deqrow) {
$deqrows[] = $deqrow;
}
// Get table output into array
// Perform a case insensitive natural sort on group name then question title of a multidimensional array
usort($deqrows, 'groupOrderThenQuestionOrder');
if ($degrow['description']) {
//.........这里部分代码省略.........
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:101,代码来源:printablesurvey.php
示例7: function
'template'=>array(
'type'=>'select',
'label'=>gT("Template"),
'options'=>$aTemplateOptions,
'current'=>$esrow['template'],
'selectOptions'=>array(
'minimumResultsForSearch'=>15,
),
'events'=>array(
'change'=>'js: function(event) { templatechange(event.val) } ',
),
),
'preview'=>array(
'type'=>'info',
'label'=>gT("Template preview"),
'content'=>CHtml::image(getTemplateURL($esrow['template']).'/preview.png',gT("Template preview image"),array('id'=>'preview','class'=>'img-thumbnail')),
),
'showwelcome'=>array(
'type'=>'select',
'label'=>gT("Show welcome screen?"),
'options'=>array(
"Y"=>gT("Yes",'unescaped'),
"N"=>gT("No",'unescaped'),
),
'current'=>$esrow['showwelcome'],
),
'navigationdelay'=>array(
'type'=>'int',
'label'=>gT("Navigation delay (seconds)"),
'htmlOptions'=>array(
'style'=>'width:12em',
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:31,代码来源:tabPresentation_view.php
示例8: gT
}
if (!empty($futureSurveys)) {
$list .= "</ul><div class=\"survey-list-heading\">" . gT("Following survey(s) are not yet active but you can register for them.") . "</div><ul>";
foreach ($futureSurveys as $survey) {
$list .= CHtml::openTag('li');
$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']);
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:31,代码来源:publicSurveyList.php
示例9: getTemplateURL
<?php
}
}
?>
</select>
</li>
<li><label for='preview'><?php
$clang->eT("Template Preview:");
?>
</label>
<img alt='<?php
$clang->eT("Template preview image");
?>
' name='preview' id='preview' src='<?php
echo getTemplateURL($esrow['template']);
?>
/preview.png' />
</li>
<li><label for='showwelcome'><?php
$clang->eT("Show welcome screen?");
?>
</label>
<select id='showwelcome' name='showwelcome'>
<option value='Y'
<?php
if (!$esrow['showwelcome'] || $esrow['showwelcome'] == "Y") {
?>
selected='selected'
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:31,代码来源:tabPresentation_view.php
示例10: action
//.........这里部分代码省略.........
// TODO give it to template
foreach ($aRows as $rows) {
$querylang = "SELECT surveyls_title\n FROM {{surveys_languagesettings}}\n WHERE surveyls_survey_id={$rows['sid']}\n AND surveyls_language='{$sDisplayLanguage}'";
$resultlang = Yii::app()->db->createCommand($querylang)->queryRow();
if ($resultlang['surveyls_title']) {
$rows['surveyls_title'] = $resultlang['surveyls_title'];
$langtag = "";
} else {
$langtag = "lang=\"{$rows['language']}\"";
}
$link = "<li><a href=\"#\" id='inactivesurvey' onclick = 'sendreq(" . $rows['sid'] . ");' ";
//$link = "<li><a href=\"#\" id='inactivesurvey' onclick = 'convertGETtoPOST(".$this->getController()->createUrl('survey/send/')."?sid={$rows['sid']}&)sendreq(".$rows['sid'].",".$rows['startdate'].",".$rows['expires'].");' ";
$link .= " {$langtag} class='surveytitle'>" . $rows['surveyls_title'] . "</a>\n";
$link .= "</li><div id='regform'></div>\n";
$list[] = $link;
}
}
if (count($list) < 1) {
$list[] = "<li class='surveytitle'>" . $clang->gT("No available surveys") . "</li>";
}
if (!$surveyid) {
$thissurvey['name'] = Yii::app()->getConfig("sitename");
$nosid = $clang->gT("You have not provided a survey identification number");
} else {
$thissurvey['name'] = $clang->gT("The survey identification number is invalid");
$nosid = $clang->gT("The survey identification number is invalid");
}
$surveylist = array("nosid" => $nosid, "contact" => sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), encodeEmail(Yii::app()->getConfig("siteadminemail"))), "listheading" => $clang->gT("The following surveys are available:"), "list" => implode("\n", $list));
$data['thissurvey'] = $thissurvey;
//$data['privacy'] = $privacy;
$data['surveylist'] = $surveylist;
$data['surveyid'] = $surveyid;
$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'] = $languagechanger;
//A nice exit
sendCacheHeaders();
doHeader();
$this->_printTemplateContent(getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . "/startpage.pstpl", $data, __LINE__);
$this->_printTemplateContent(getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . "/surveylist.pstpl", $data, __LINE__);
echo '<script type="text/javascript" >
function sendreq(surveyid)
{
$.ajax({
type: "GET",
url: "' . $this->getController()->createUrl("/register/ajaxregisterform/surveyid") . '/" + surveyid,
}).done(function(msg) {
document.getElementById("regform").innerHTML = msg;
});
}
</script>';
$this->_printTemplateContent(getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . "/endpage.pstpl", $data, __LINE__);
doFooter();
exit;
}
// Get token
if (!isset($token)) {
$token = $clienttoken;
}
//GET BASIC INFORMATION ABOUT THIS SURVEY
$thissurvey = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
//SEE IF SURVEY USES TOKENS
if ($surveyExists == 1 && tableExists('{{tokens_' . $thissurvey['sid'] . '}}')) {
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:67,代码来源:index.php
示例11: run
//.........这里部分代码省略.........
//header('Content-Type: application/json');
echo ls_json_encode($return);
Yii::app()->end();
} else {
// check for upload error
if ($_FILES['uploadfile']['error'] > 2) {
$return = array("success" => false, "msg" => gT("Sorry, there was an error uploading your file"));
//header('Content-Type: application/json');
echo ls_json_encode($return);
Yii::app()->end();
} else {
if ($_FILES['uploadfile']['error'] == 1 || $_FILES['uploadfile']['error'] == 2 || $size > $maxfilesize) {
$return = array("success" => false, "msg" => sprintf(gT("Sorry, this file is too large. Only files upto %s KB are allowed."), $maxfilesize));
//header('Content-Type: application/json');
echo ls_json_encode($return);
Yii::app()->end();
} else {
$return = array("success" => false, "msg" => gT("Unknown error"));
//header('Content-Type: application/json');
echo ls_json_encode($return);
Yii::app()->end();
}
}
}
}
return;
}
$meta = '';
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-superfish');
$sNeededScriptVar = '
var uploadurl = "' . $this->createUrl('/uploader/index/mode/upload/') . '";
var imageurl = "' . Yii::app()->getConfig('imageurl') . '/";
var surveyid = "' . $surveyid . '";
var fieldname = "' . $sFieldName . '";
var questgrppreview = ' . $sPreview . ';
csrfToken = ' . ls_json_encode(Yii::app()->request->csrfToken) . ';
showpopups="' . Yii::app()->getConfig("showpopups") . '";
';
$sLangScriptVar = "\n uploadLang = {\n titleFld: '" . gT('Title', 'js') . "',\n commentFld: '" . gT('Comment', 'js') . "',\n errorNoMoreFiles: '" . gT('Sorry, no more files can be uploaded!', 'js') . "',\n errorOnlyAllowed: '" . gT('Sorry, only %s files can be uploaded for this question!', 'js') . "',\n uploading: '" . gT('Uploading', 'js') . "',\n selectfile: '" . gT('Select file', 'js') . "',\n errorNeedMore: '" . gT('Please upload %s more file(s).', 'js') . "',\n errorMoreAllowed: '" . gT('If you wish, you may upload %s more file(s); else you may return back to survey.', 'js') . "',\n errorMaxReached: '" . gT('The maximum number of files has been uploaded. You may return back to survey.', 'js') . "',\n errorTooMuch: '" . gT('The maximum number of files has been uploaded. You may return back to survey.', 'js') . "',\n errorNeedMoreConfirm: '" . gT("You need to upload %s more files for this question.\nAre you sure you want to exit?", 'js') . "',\n deleteFile : '" . gt('Delete', 'js') . "',\n editFile : '" . gt('Edit', 'js') . "',\n };\n ";
$aSurveyInfo = getSurveyInfo($surveyid, $sLanguage);
$oEvent = new PluginEvent('beforeSurveyPage');
$oEvent->set('surveyId', $surveyid);
App()->getPluginManager()->dispatchEvent($oEvent);
if (!is_null($oEvent->get('template'))) {
$aSurveyInfo['templatedir'] = $event->get('template');
}
$sTemplateDir = getTemplatePath($aSurveyInfo['template']);
$sTemplateUrl = getTemplateURL($aSurveyInfo['template']) . "/";
App()->clientScript->registerScript('sNeededScriptVar', $sNeededScriptVar, CClientScript::POS_HEAD);
App()->clientScript->registerScript('sLangScriptVar', $sLangScriptVar, CClientScript::POS_HEAD);
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts") . 'ajaxupload.js');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts") . 'uploader.js');
App()->getClientScript()->registerScriptFile("{$sTemplateUrl}template.js");
App()->clientScript->registerCssFile(Yii::app()->getConfig("publicstyleurl") . "uploader.css");
App()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "uploader-files.css");
if (file_exists($sTemplateDir . DIRECTORY_SEPARATOR . 'jquery-ui-custom.css')) {
Yii::app()->getClientScript()->registerCssFile("{$sTemplateUrl}jquery-ui-custom.css");
} elseif (file_exists($sTemplateDir . DIRECTORY_SEPARATOR . 'jquery-ui.css')) {
Yii::app()->getClientScript()->registerCssFile("{$sTemplateUrl}jquery-ui.css");
} else {
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "jquery-ui.css");
}
App()->clientScript->registerCssFile("{$sTemplateUrl}template.css");
$header = getHeader($meta);
echo $header;
$fn = $sFieldName;
$qid = (int) Yii::app()->request->getParam('qid');
$minfiles = (int) Yii::app()->request->getParam('minfiles');
$maxfiles = (int) Yii::app()->request->getParam('maxfiles');
$qidattributes = getQuestionAttributeValues($qid);
$qidattributes['max_filesize'] = floor(min($qidattributes['max_filesize'] * 1024, getMaximumFileUploadSize()) / 1024);
$body = '</head><body class="uploader">
<div id="notice"></div>
<input type="hidden" id="ia" value="' . $fn . '" />
<input type="hidden" id="' . $fn . '_minfiles" value="' . $minfiles . '" />
<input type="hidden" id="' . $fn . '_maxfiles" value="' . $maxfiles . '" />
<input type="hidden" id="' . $fn . '_maxfilesize" value="' . $qidattributes['max_filesize'] . '" />
<input type="hidden" id="' . $fn . '_allowed_filetypes" value="' . $qidattributes['allowed_filetypes'] . '" />
<input type="hidden" id="preview" value="' . Yii::app()->session['preview'] . '" />
<input type="hidden" id="' . $fn . '_show_comment" value="' . $qidattributes['show_comment'] . '" />
<input type="hidden" id="' . $fn . '_show_title" value="' . $qidattributes['show_title'] . '" />
<input type="hidden" id="' . $fn . '_licount" value="0" />
<input type="hidden" id="' . $fn . '_filecount" value="0" />
<!-- The upload button -->
<div class="upload-div">
<button id="button1" class="button upload-button" type="button" >' . gT("Select file") . '</button>
</div>
<p class="uploadmsg">' . sprintf(gT("You can upload %s under %s KB each."), $qidattributes['allowed_filetypes'], $qidattributes['max_filesize']) . '</p>
<div class="uploadstatus" id="uploadstatus"></div>
<!-- The list of uploaded files -->
</body>
</html>';
App()->getClientScript()->render($body);
echo $body;
}
开发者ID:jordan095,项目名称:pemiluweb-iadel,代码行数:101,代码来源:UploaderController.php
示例12: _initialise
//.........这里部分代码省略.........
}
// Some global data
$aData['sitename'] = Yii::app()->getConfig('sitename');
$siteadminname = Yii::app()->getConfig('siteadminname');
$siteadminemail = Yii::app()->getConfig('siteadminemail');
// Set this so common.php doesn't throw notices about undefined variables
$thissurvey['active'] = 'N';
// FAKE DATA FOR TEMPLATES
$thissurvey['name'] = gT("Template Sample");
$thissurvey['desc
|
请发表评论