本文整理汇总了PHP中sanitize_languagecode函数的典型用法代码示例。如果您正苦于以下问题:PHP sanitize_languagecode函数的具体用法?PHP sanitize_languagecode怎么用?PHP sanitize_languagecode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sanitize_languagecode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: limesurvey_lang
function limesurvey_lang($langcode)
{
global $rootdir;
$langcode = sanitize_languagecode($langcode);
$streamer = new FileReader($rootdir . '/locale/' . $langcode . '/LC_MESSAGES/' . $langcode . '.mo');
$this->gettextclass = new gettext_reader($streamer);
$this->langcode = $langcode;
}
示例2: actionPublicList
public function actionPublicList($lang = null)
{
if (!empty($lang)) {
App()->setLanguage(sanitize_languagecode($lang));
} else {
App()->setLanguage(App()->getConfig('defaultlang'));
}
$this->render('publicSurveyList', array('publicSurveys' => Survey::model()->active()->open()->public()->with('languagesettings')->findAll(), 'futureSurveys' => Survey::model()->active()->registration()->public()->with('languagesettings')->findAll()));
}
示例3: limesurvey_lang
function limesurvey_lang($sLanguageCode)
{
if (empty($sLanguageCode)) {
trigger_error('langcode param is undefined ', E_USER_WARNING);
}
Yii::app()->loadHelper('sanitize');
$sLanguageCode = sanitize_languagecode($sLanguageCode);
$streamer = new FileReader(getcwd() . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $sLanguageCode . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR . $sLanguageCode . '.mo');
$this->gettextclass = new gettext_reader($streamer);
$this->langcode = $sLanguageCode;
}
示例4: actionLocal
function actionLocal($surveyid, $token, $langcode = '')
{
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
$sLanguageCode = $langcode;
$iSurveyID = $surveyid;
$sToken = $token;
$sToken = sanitize_token($sToken);
if (!$iSurveyID) {
$this->redirect($this->getController()->createUrl('/'));
}
$iSurveyID = (int) $iSurveyID;
//Check that there is a SID
// Get passed language from form, so that we dont loose this!
if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
$baselang = Survey::model()->findByPk($iSurveyID)->language;
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($baselang);
} else {
$sLanguageCode = sanitize_languagecode($sLanguageCode);
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($sLanguageCode);
$baselang = $sLanguageCode;
}
Yii::app()->lang = $clang;
$thissurvey = getSurveyInfo($iSurveyID, $baselang);
if ($thissurvey == false || Yii::app()->db->schema->getTable("{{tokens_{$iSurveyID}}}") == null) {
$html = $clang->gT('This survey does not seem to exist.');
} else {
$row = Tokens_dynamic::getEmailStatus($iSurveyID, $sToken);
if ($row == false) {
$html = $clang->gT('You are not a participant in this survey.');
} else {
$usresult = $row['emailstatus'];
if ($usresult == 'OptOut') {
$usresult = Tokens_dynamic::updateEmailStatus($iSurveyID, $sToken, 'OK');
$html = $clang->gT('You have been successfully added back to this survey.');
} else {
if ($usresult == 'OK') {
$html = $clang->gT('You are already a part of this survey.');
} else {
$html = $clang->gT('You have been already removed from this survey.');
}
}
}
}
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir']) {
$thistpl = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
} else {
$thistpl = getTemplatePath($thissurvey['templatedir']);
}
$this->_renderHtml($html, $thistpl, $clang);
}
示例5: actiontokens
function actiontokens($surveyid, $token, $langcode = '')
{
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
$sLanguageCode = $langcode;
$iSurveyID = $surveyid;
$sToken = $token;
$sToken = sanitize_token($sToken);
if (!$iSurveyID) {
$this->redirect(array('/'));
}
$iSurveyID = (int) $iSurveyID;
//Check that there is a SID
// Get passed language from form, so that we dont loose this!
if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($sBaseLanguage);
} else {
$sLanguageCode = sanitize_languagecode($sLanguageCode);
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($sLanguageCode);
$sBaseLanguage = $sLanguageCode;
}
Yii::app()->lang = $clang;
$aSurveyInfo = getSurveyInfo($iSurveyID, $sBaseLanguage);
if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
$sMessage = $clang->gT('This survey does not seem to exist.');
} else {
$oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $token));
if (!isset($oToken)) {
$sMessage = $clang->gT('You are not a participant in this survey.');
} else {
if ($oToken->emailstatus == 'OptOut') {
$oToken->emailstatus = 'OK';
$oToken->save();
$sMessage = $clang->gT('You have been successfully added back to this survey.');
} elseif ($oToken->emailstatus == 'OK') {
$sMessage = $clang->gT('You are already a part of this survey.');
} else {
$sMessage = $clang->gT('You have been already removed from this survey.');
}
}
}
//PRINT COMPLETED PAGE
if (!$aSurveyInfo['templatedir']) {
$sTemplate = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
} else {
$sTemplate = getTemplatePath($aSurveyInfo['templatedir']);
}
$this->_renderHtml($sMessage, $sTemplate, $clang, $aSurveyInfo);
}
示例6: actiontokens
function actiontokens($surveyid, $token, $langcode = '')
{
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
$sLanguageCode = $langcode;
$iSurveyID = $surveyid;
$sToken = $token;
$sToken = sanitize_token($sToken);
if (!$iSurveyID) {
$this->redirect(array('/'));
}
$iSurveyID = (int) $iSurveyID;
//Check that there is a SID
// Get passed language from form, so that we dont loose this!
if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
} else {
$sBaseLanguage = sanitize_languagecode($sLanguageCode);
}
Yii::app()->setLanguage($sBaseLanguage);
$aSurveyInfo = getSurveyInfo($iSurveyID, $sBaseLanguage);
if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
throw new CHttpException(404, "This survey does not seem to exist. It may have been deleted or the link you were given is outdated or incorrect.");
} else {
LimeExpressionManager::singleton()->loadTokenInformation($iSurveyID, $token, false);
$oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $token));
if (!isset($oToken)) {
$sMessage = gT('You are not a participant in this survey.');
} else {
if ($oToken->emailstatus == 'OptOut') {
$oToken->emailstatus = 'OK';
$oToken->save();
$sMessage = gT('You have been successfully added back to this survey.');
} elseif ($oToken->emailstatus == 'OK') {
$sMessage = gT('You are already a part of this survey.');
} else {
$sMessage = gT('You have been already removed from this survey.');
}
}
}
//PRINT COMPLETED PAGE
if (!$aSurveyInfo['templatedir']) {
$sTemplate = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
} else {
$sTemplate = getTemplatePath($aSurveyInfo['templatedir']);
}
$this->_renderHtml($sMessage, $sTemplate, $aSurveyInfo);
}
示例7: __construct
function __construct($sLanguageCode, $bForceRefresh = false)
{
if (empty($sLanguageCode)) {
trigger_error('langcode param is undefined ', E_USER_WARNING);
}
static $aClassCache = array();
Yii::app()->loadHelper('sanitize');
$sLanguageCode = sanitize_languagecode($sLanguageCode);
if (isset($aClassCache[$sLanguageCode]) && !$bForceRefresh) {
$this->gettextclass = $aClassCache[$sLanguageCode];
} else {
$streamer = new FileReader(getcwd() . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $sLanguageCode . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR . $sLanguageCode . '.mo');
$this->gettextclass = $aClassCache[$sLanguageCode] = new gettext_reader($streamer);
}
$this->langcode = $sLanguageCode;
}
示例8: Date_Time_Converter
else
{
$datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i');
$_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s');
}
$santitizedtoken='';
$tokenoutput .= "\t<div class='header ui-widget-header'>".$clang->gT("Add dummy tokens")."</div>\n"
."\t<div class='messagebox ui-corner-all'>\n";
$data = array('firstname' => $_POST['firstname'],
'lastname' => $_POST['lastname'],
'email' => sanitize_email($_POST['email']),
'emailstatus' => 'OK',
'token' => $santitizedtoken,
'language' => sanitize_languagecode($_POST['language']),
'sent' => 'N',
'remindersent' => 'N',
'completed' => 'N',
'usesleft' => $_POST['usesleft'],
'validfrom' => $_POST['validfrom'],
'validuntil' => $_POST['validuntil']);
// add attributes
$attrfieldnames=GetAttributeFieldnames($surveyid);
foreach ($attrfieldnames as $attr_name)
{
$data[$attr_name]=$_POST[$attr_name];
}
$tblInsert=db_table_name('tokens_'.$surveyid);
$amount = sanitize_int($_POST['amount']);
示例9: actionparticipants
function actionparticipants()
{
$surveyid = Yii::app()->request->getQuery('surveyid');
$langcode = Yii::app()->request->getQuery('langcode');
$token = Yii::app()->request->getQuery('token');
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
$sLanguageCode = $langcode;
$iSurveyID = $surveyid;
$sToken = $token;
$sToken = sanitize_token($sToken);
if (!$iSurveyID) {
$this->redirect(Yii::app()->getController()->createUrl('/'));
}
$iSurveyID = (int) $iSurveyID;
//Make sure it's an integer (protect from SQL injects)
//Check that there is a SID
// Get passed language from form, so that we dont lose this!
if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
$baselang = Survey::model()->findByPk($iSurveyID)->language;
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($baselang);
} else {
$sLanguageCode = sanitize_languagecode($sLanguageCode);
Yii::import('application.libraries.Limesurvey_lang', true);
$clang = new Limesurvey_lang($sLanguageCode);
$baselang = $sLanguageCode;
}
Yii::app()->lang = $clang;
$thissurvey = getSurveyInfo($iSurveyID, $baselang);
if ($thissurvey == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
$html = $clang->gT('This survey does not seem to exist.');
} else {
$row = Tokens_dynamic::getEmailStatus($iSurveyID, $sToken);
$datas = Tokens_dynamic::model($iSurveyID)->find('token = :token', array(":token" => $sToken));
if ($row == false) {
$html = $clang->gT('You are not a participant in this survey.');
} else {
$usresult = $row['emailstatus'];
if ($usresult == 'OK') {
$usresult = Tokens_dynamic::updateEmailStatus($iSurveyID, $sToken, 'OptOut');
$html = $clang->gT('You have been successfully removed from this survey.');
} else {
$html = $clang->gT('You have been already removed from this survey.');
}
if (!empty($datas->participant_id) && $datas->participant_id != "") {
//Participant also exists in central db
$cpdb = Participants::model()->find('participant_id = :participant_id', array(":participant_id" => $datas->participant_id));
if ($cpdb->blacklisted == "Y") {
$html .= "<br />";
$html .= $clang->gt("You have already been removed from the central participants list for this site");
} else {
$cpdb->blacklisted = 'Y';
$cpdb->save();
$html .= "<br />";
$html .= $clang->gT("You have been removed from the central participants list for this site");
}
}
}
}
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir']) {
$thistpl = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
} else {
$thistpl = getTemplatePath($thissurvey['templatedir']);
}
$this->_renderHtml($html, $thistpl);
}
示例10: postLogin
protected function postLogin()
{
$user = $this->getUser();
App()->user->login($this);
// Check for default password
if ($this->password === 'password') {
Yii::app()->setFlashMessage(gT("Warning: You are still using the default password ('password'). Please change your password and re-login again."), 'warning');
}
if ((int) App()->request->getPost('width', '1280') < 1280) {
Yii::app()->setFlashMessage(gT("Your browser screen size is too small to use the administration properly. The minimum size required is 1280*1024 px."), 'error');
}
// Do session setup
Yii::app()->session['loginID'] = (int) $user->uid;
Yii::app()->session['user'] = $user->users_name;
Yii::app()->session['full_name'] = $user->full_name;
Yii::app()->session['htmleditormode'] = $user->htmleditormode;
Yii::app()->session['templateeditormode'] = $user->templateeditormode;
Yii::app()->session['questionselectormode'] = $user->questionselectormode;
Yii::app()->session['dateformat'] = $user->dateformat;
Yii::app()->session['session_hash'] = hash('sha256', getGlobalSetting('SessionName') . $user->users_name . $user->uid);
// Perform language settings
if (App()->request->getPost('loginlang', 'default') != 'default') {
$user->lang = sanitize_languagecode(App()->request->getPost('loginlang'));
$user->save();
$sLanguage = $user->lang;
} else {
if ($user->lang == 'auto' || $user->lang == '') {
$sLanguage = getBrowserLanguage();
} else {
$sLanguage = $user->lang;
}
}
Yii::app()->session['adminlang'] = $sLanguage;
App()->setLanguage($sLanguage);
}
示例11: graph
function graph()
{
Yii::app()->loadHelper('admin/statistics');
Yii::app()->loadHelper("surveytranslator");
// Initialise PCHART
require_once Yii::app()->basePath . '/third_party/pchart/pchart/pChart.class';
require_once Yii::app()->basePath . '/third_party/pchart/pchart/pData.class';
require_once Yii::app()->basePath . '/third_party/pchart/pchart/pCache.class';
Yii::import('application.third_party.ar-php.Arabic', true);
$tempdir = Yii::app()->getConfig("tempdir");
$MyCache = new pCache($tempdir . '/');
$aData['success'] = 1;
$sStatisticsLanguage = sanitize_languagecode($_POST['sStatisticsLanguage']);
$oStatisticsLanguage = new Limesurvey_lang($sStatisticsLanguage);
if (isset($_POST['cmd']) && isset($_POST['id'])) {
list($qsid, $qgid, $qqid) = explode("X", substr($_POST['id'], 0), 3);
if (!is_numeric(substr($qsid, 0, 1))) {
// Strip first char when not numeric (probably T or D)
$qsid = substr($qsid, 1);
}
$aFieldmap = createFieldMap($qsid, 'full', false, false, $sStatisticsLanguage);
$qtype = $aFieldmap[$_POST['id']]['type'];
$qqid = $aFieldmap[$_POST['id']]['qid'];
$aattr = getQuestionAttributeValues($qqid);
$field = substr($_POST['id'], 1);
switch ($_POST['cmd']) {
case 'showmap':
if (isset($aattr['location_mapservice'])) {
$aData['mapdata'] = array("coord" => getQuestionMapData($field, $qsid), "zoom" => $aattr['location_mapzoom'], "width" => $aattr['location_mapwidth'], "height" => $aattr['location_mapheight']);
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showmap', 1);
} else {
$aData['success'] = 0;
}
break;
case 'hidemap':
if (isset($aattr['location_mapservice'])) {
$aData['success'] = 1;
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showmap', 0);
} else {
$aData['success'] = 0;
}
break;
case 'showgraph':
if (isset($aattr['location_mapservice'])) {
$aData['mapdata'] = array("coord" => getQuestionMapData($field, $qsid), "zoom" => $aattr['location_mapzoom'], "width" => $aattr['location_mapwidth'], "height" => $aattr['location_mapheight']);
}
$bChartType = $qtype != "M" && $qtype != "P" && $aattr["statistics_graphtype"] == "1";
$adata = Yii::app()->session['stats'][$_POST['id']];
$aData['chartdata'] = createChart($qqid, $qsid, $bChartType, $adata['lbl'], $adata['gdata'], $adata['grawdata'], $MyCache, $oStatisticsLanguage, $qtype);
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showgraph', 1);
break;
case 'hidegraph':
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showgraph', 0);
break;
case 'showbar':
if ($qtype == "M" || $qtype == "P") {
$aData['success'] = 0;
break;
}
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_graphtype', 0);
$adata = Yii::app()->session['stats'][$_POST['id']];
$aData['chartdata'] = createChart($qqid, $qsid, 0, $adata['lbl'], $adata['gdata'], $adata['grawdata'], $MyCache, $oStatisticsLanguage, $qtype);
break;
case 'showpie':
if ($qtype == "M" || $qtype == "P") {
$aData['success'] = 0;
break;
}
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_graphtype', 1);
$adata = Yii::app()->session['stats'][$_POST['id']];
$aData['chartdata'] = createChart($qqid, $qsid, 1, $adata['lbl'], $adata['gdata'], $adata['grawdata'], $MyCache, $oStatisticsLanguage, $qtype);
break;
default:
$aData['success'] = 0;
break;
}
} else {
$aData['success'] = 0;
}
//$this->_renderWrappedTemplate('export', 'statistics_graph_view', $aData);
$this->getController()->renderPartial('export/statistics_graph_view', $aData);
}
示例12: Date_Time_Converter
//Fix up dates and match to database format
if (trim($_POST['validfrom']) == '') {
$_POST['validfrom'] = null;
} else {
$datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'] . ' H:i');
$_POST['validfrom'] = $datetimeobj->convert('Y-m-d H:i:s');
}
if (trim($_POST['validuntil']) == '') {
$_POST['validuntil'] = null;
} else {
$datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'] . ' H:i');
$_POST['validuntil'] = $datetimeobj->convert('Y-m-d H:i:s');
}
$santitizedtoken = '';
$tokenoutput .= "\t<div class='header ui-widget-header'>" . $clang->gT("Add dummy tokens") . "</div>\n" . "\t<div class='messagebox ui-corner-all'>\n";
$data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => sanitize_email($_POST['email']), 'emailstatus' => 'OK', 'token' => $santitizedtoken, 'language' => sanitize_languagecode($_POST['language']), 'sent' => 'N', 'remindersent' => 'N', 'completed' => 'N', 'usesleft' => $_POST['usesleft'], 'validfrom' => $_POST['validfrom'], 'validuntil' => $_POST['validuntil']);
// add attributes
$attrfieldnames = GetAttributeFieldnames($surveyid);
foreach ($attrfieldnames as $attr_name) {
$data[$attr_name] = $_POST[$attr_name];
}
$tblInsert = db_table_name('tokens_' . $surveyid);
$amount = sanitize_int($_POST['amount']);
$tokenlength = sanitize_int($_POST['tokenlen']);
for ($i = 0; $i < $amount; $i++) {
$dataToInsert = $data;
$dataToInsert['firstname'] = str_replace('{TOKEN_COUNTER}', "{$i}", $dataToInsert['firstname']);
$dataToInsert['lastname'] = str_replace('{TOKEN_COUNTER}', "{$i}", $dataToInsert['lastname']);
$dataToInsert['email'] = str_replace('{TOKEN_COUNTER}', "{$i}", $dataToInsert['email']);
$isvalidtoken = false;
while ($isvalidtoken == false) {
示例13: exportdialog
/**
* Export Dialog
*
*/
public function exportdialog($iSurveyId)
{
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData = array();
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
$aData['sidemenu']["token_menu"] = true;
$aData['sidemenu']['state'] = false;
$aData['token_bar']['exportbutton']['form'] = true;
$aData['token_bar']['closebutton']['url'] = 'admin/tokens/sa/index/surveyid/' . $iSurveyId;
// Close button
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$iSurveyId = sanitize_int($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'export')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
$bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
if (!$bTokenExists) {
self::_newtokentable($iSurveyId);
}
if (!is_null(Yii::app()->request->getPost('submit'))) {
Yii::app()->loadHelper("export");
tokensExport($iSurveyId);
} else {
//$aData['resultr'] = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
$aData['surveyid'] = $iSurveyId;
$aData['thissurvey'] = getSurveyInfo($iSurveyId);
// For tokenbar view
$aData['sAction'] = App()->createUrl("admin/tokens", array("sa" => "exportdialog", "surveyid" => $iSurveyId));
$aData['aButtons'] = array(gT('Export tokens') => array('type' => 'submit', 'name' => 'submit'));
$oSurvey = Survey::model()->findByPk($iSurveyId);
$aOptionsStatus = array('0' => gT('All tokens'), '1' => gT('Completed'), '2' => gT('Not completed'));
if ($oSurvey->anonymized == 'N' && $oSurvey->active == 'Y') {
$aOptionsStatus['3'] = gT('Not started');
$aOptionsStatus['4'] = gT('Started but not yet completed');
}
$oTokenLanguages = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
$aFilterByLanguage = array('' => gT('All'));
foreach ($oTokenLanguages as $oTokenLanguage) {
$sLanguageCode = sanitize_languagecode($oTokenLanguage->language);
$aFilterByLanguage[$sLanguageCode] = getLanguageNameFromCode($sLanguageCode, false);
}
$aData['aSettings'] = array('tokenstatus' => array('type' => 'select', 'label' => gT('Survey status:'), 'options' => $aOptionsStatus), 'invitationstatus' => array('type' => 'select', 'label' => gT('Invitation status:'), 'options' => array('0' => gT('All'), '1' => gT('Invited'), '2' => gT('Not invited'))), 'reminderstatus' => array('type' => 'select', 'label' => gT('Reminder status:'), 'options' => array('0' => gT('All'), '1' => gT('Reminder(s) sent'), '2' => gT('No reminder(s) sent'))), 'tokenlanguage' => array('type' => 'select', 'label' => gT('Filter by language:'), 'options' => $aFilterByLanguage), 'filteremail' => array('type' => 'string', 'label' => gT('Filter by email address:'), 'help' => gT('Only export entries which contain this string in the email address.')), 'tokendeleteexported' => array('type' => 'checkbox', 'label' => gT('Delete exported tokens:'), 'help' => 'Attention: If selected the exported tokens are deleted permanently from the token table.'));
$this->_renderWrappedTemplate('token', array('exportdialog'), $aData);
}
}
示例14: sanitize_languagecode
if (isset($_REQUEST['assessments']))
{
$assessments = ($_REQUEST['assessments'] == 'Y');
}
else
{
$assessments = ($surveyInfo[1] == 'Y');
}
$LEMdebugLevel = (
((isset($_REQUEST['LEM_DEBUG_TIMING']) && $_REQUEST['LEM_DEBUG_TIMING'] == 'Y') ? LEM_DEBUG_TIMING : 0) +
((isset($_REQUEST['LEM_DEBUG_VALIDATION_SUMMARY']) && $_REQUEST['LEM_DEBUG_VALIDATION_SUMMARY'] == 'Y') ? LEM_DEBUG_VALIDATION_SUMMARY : 0) +
((isset($_REQUEST['LEM_DEBUG_VALIDATION_DETAIL']) && $_REQUEST['LEM_DEBUG_VALIDATION_DETAIL'] == 'Y') ? LEM_DEBUG_VALIDATION_DETAIL : 0) +
((isset($_REQUEST['LEM_PRETTY_PRINT_ALL_SYNTAX']) && $_REQUEST['LEM_PRETTY_PRINT_ALL_SYNTAX'] == 'Y') ? LEM_PRETTY_PRINT_ALL_SYNTAX : 0)
);
$language = (isset($_REQUEST['lang']) ? sanitize_languagecode($_REQUEST['lang']) : NULL);
$gid = (isset($_REQUEST['gid']) ? sanitize_int($_REQUEST['gid']) : NULL);
$qid = (isset($_REQUEST['qid']) ? sanitize_int($_REQUEST['qid']) : NULL);
print <<< EOD
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logic File - Survey #$surveyid</title>
<style type="text/css">
tr.LEMgroup td
{
background-color:lightgrey;
}
tr.LEMquestion
示例15: view
/**
* dataentry::view()
* view a dataentry
* @param mixed $surveyid
* @param mixed $lang
* @return
*/
public function view($surveyid, $lang = NULL)
{
$surveyid = sanitize_int($surveyid);
$lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
if (isset($lang)) {
$lang = sanitize_languagecode($lang);
}
$aViewUrls = array();
if (hasSurveyPermission($surveyid, 'responses', 'read')) {
$clang = Yii::app()->lang;
$sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
$surveyinfo = getSurveyInfo($surveyid);
$slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($slangs, $baselang);
if (is_null($lang) || !in_array($lang, $slangs)) {
$sDataEntryLanguage = $baselang;
$blang = $clang;
} else {
Yii::app()->loadLibrary('Limesurvey_lang', array($lang));
$blang = new Limesurvey_lang($lang);
$sDataEntryLanguage = $lang;
}
$langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
$thissurvey = getSurveyInfo($surveyid);
//This is the default, presenting a blank dataentry form
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$aData['thissurvey'] = $thissurvey;
$aData['langlistbox'] = $langlistbox;
$aData['surveyid'] = $surveyid;
$aData['blang'] = $blang;
$aData['site_url'] = Yii::app()->homeUrl;
LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
// means that all variables are on the same page
$aViewUrls[] = 'caption_view';
Yii::app()->loadHelper('database');
// SURVEY NAME AND DESCRIPTION TO GO HERE
$degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
$degresult = dbExecuteAssoc($degquery);
// GROUP NAME
$aDataentryoutput = '';
foreach ($degresult->readAll() as $degrow) {
LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
$deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
$deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
$aDataentryoutput .= "\t<tr>\n" . "<td colspan='3' align='center'><strong>" . flattenText($degrow['group_name'], true) . "</strong></td>\n" . "\t</tr>\n";
$gid = $degrow['gid'];
$aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
// Perform a case insensitive natural sort on group name then question title of a multidimensional array
usort($deqrows, 'groupOrderThenQuestionOrder');
$bgc = 'odd';
foreach ($deqrows as $deqrow) {
$qidattributes = getQuestionAttributeValues($deqrow['qid'], $deqrow['type']);
$cdata['qidattributes'] = $qidattributes;
$hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
// TODO - can questions be hidden? Are JavaScript variables names used? Consistently with everywhere else?
// LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
// TMSW Conditions->Relevance: Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
$qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
$relevance = trim($qinfo['info']['relevance']);
$explanation = trim($qinfo['relEqn']);
$validation = trim($qinfo['prettyValidTip']);
$qidattributes = getQuestionAttributeValues($deqrow['qid']);
$array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
$showme = '';
if ($bgc == "even") {
$bgc = "odd";
} else {
$bgc = "even";
}
//Do no alternate on explanation row
if ($relevance != '' && $relevance != '1') {
$showme = "[" . $blang->gT("Only answer this if the following conditions are met:") . "]<br />{$explanation}\n";
}
if ($showme != '' && $validation != '') {
$showme .= '<br/>';
}
if ($validation != '') {
$showme .= "[" . $blang->gT("The answer(s) must meet these validation criteria:") . "]<br />{$validation}\n";
}
if ($showme != '' && $array_filter_help != '') {
$showme .= '<br/>';
}
if ($array_filter_help != '') {
$showme .= "[" . $blang->gT("The answer(s) must meet these array_filter criteria:") . "]<br />{$array_filter_help}\n";
}
$cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
}
//END OF GETTING CONDITIONS
//Alternate bgcolor for different groups
if (!isset($bgc)) {
//.........这里部分代码省略.........