本文整理汇总了PHP中getDateFormatData函数的典型用法代码示例。如果您正苦于以下问题:PHP getDateFormatData函数的具体用法?PHP getDateFormatData怎么用?PHP getDateFormatData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDateFormatData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _displaySettings
private function _displaySettings()
{
Yii::app()->loadHelper('surveytranslator');
// Save refurl from where global settings screen is called!
$refurl = Yii::app()->getRequest()->getUrlReferrer(Yii::app()->createUrl('admin'), array('globalsettings'));
// Some URLs are not to be allowed to refered back to.
// These exceptions can be added to the $aReplacements array
$aReplacements = array('admin/update/sa/step4b' => 'admin/sa/index', 'admin/user/sa/adduser' => 'admin/user/sa/index', 'admin/user/sa/setusertemplates' => 'admin/user/sa/index');
$data['title'] = "hi";
$data['message'] = "message";
foreach ($this->_checkSettings() as $key => $row) {
$data[$key] = $row;
}
Yii::app()->loadLibrary('Date_Time_Converter');
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
$datetimeobj = new date_time_converter(dateShift(getGlobalSetting("updatelastcheck"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s');
$data['updatelastcheck'] = $datetimeobj->convert($dateformatdetails['phpdate'] . " H:i:s");
$data['updateavailable'] = getGlobalSetting("updateavailable") && Yii::app()->getConfig("updatable");
$data['updatable'] = Yii::app()->getConfig("updatable");
$data['updateinfo'] = getGlobalSetting("updateinfo");
$data['updatebuild'] = getGlobalSetting("updatebuild");
$data['updateversion'] = getGlobalSetting("updateversion");
$data['aUpdateVersions'] = json_decode(getGlobalSetting("updateversions"), true);
$data['allLanguages'] = getLanguageData(false, Yii::app()->session['adminlang']);
if (trim(Yii::app()->getConfig('restrictToLanguages')) == '') {
$data['restrictToLanguages'] = array_keys($data['allLanguages']);
$data['excludedLanguages'] = array();
} else {
$data['restrictToLanguages'] = explode(' ', trim(Yii::app()->getConfig('restrictToLanguages')));
$data['excludedLanguages'] = array_diff(array_keys($data['allLanguages']), $data['restrictToLanguages']);
}
$data['fullpagebar']['savebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['saveandclosebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['closebutton']['url'] = 'admin/';
// Close button
// List of available encodings
$data['aEncodings'] = aEncodingsArray();
// Get current setting from DB
$data['thischaracterset'] = getGlobalSetting('characterset');
$data['sideMenuBehaviour'] = getGlobalSetting('sideMenuBehaviour');
$data['aListOfThemeObjects'] = AdminTheme::getAdminThemeList();
$this->_renderWrappedTemplate('', 'globalSettings_view', $data);
}
示例2: _displaySettings
private function _displaySettings()
{
Yii::app()->loadHelper('surveytranslator');
// Save refurl from where global settings screen is called!
// Unless it's called from global settings...
$refurl = Yii::app()->getRequest()->getUrlReferrer();
// Some URLs are not to be allowed to refered back to.
// These exceptions can be added to the $aReplacements array
$aReplacements = array('admin/update/sa/step4b' => 'admin/sa/index', 'admin/user/sa/adduser' => 'admin/user/sa/index', 'admin/user/sa/setusertemplates' => 'admin/user/sa/index');
$refurl = str_replace(array_keys($aReplacements), array_values($aReplacements), $refurl);
// Don't update session variable if refurl is empty (happens when user clicks Save)
if ($refurl !== "") {
Yii::app()->session['refurl'] = htmlspecialchars($refurl);
//just to be safe!
}
$data['title'] = "hi";
$data['message'] = "message";
foreach ($this->_checkSettings() as $key => $row) {
$data[$key] = $row;
}
Yii::app()->loadLibrary('Date_Time_Converter');
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
$datetimeobj = new date_time_converter(dateShift(getGlobalSetting("updatelastcheck"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s');
$data['updatelastcheck'] = $datetimeobj->convert($dateformatdetails['phpdate'] . " H:i:s");
$data['updateavailable'] = getGlobalSetting("updateavailable") && Yii::app()->getConfig("updatable");
$data['updatable'] = Yii::app()->getConfig("updatable");
$data['updateinfo'] = getGlobalSetting("updateinfo");
$data['updatebuild'] = getGlobalSetting("updatebuild");
$data['updateversion'] = getGlobalSetting("updateversion");
$data['aUpdateVersions'] = json_decode(getGlobalSetting("updateversions"), true);
$data['allLanguages'] = getLanguageData(false, Yii::app()->session['adminlang']);
if (trim(Yii::app()->getConfig('restrictToLanguages')) == '') {
$data['restrictToLanguages'] = array_keys($data['allLanguages']);
$data['excludedLanguages'] = array();
} else {
$data['restrictToLanguages'] = explode(' ', trim(Yii::app()->getConfig('restrictToLanguages')));
$data['excludedLanguages'] = array_diff(array_keys($data['allLanguages']), $data['restrictToLanguages']);
}
$data['fullpagebar']['savebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['saveandclosebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['closebutton']['url'] = 'admin/';
$this->_renderWrappedTemplate('', 'globalSettings_view', $data);
}
示例3: _displaySettings
private function _displaySettings()
{
Yii::app()->loadHelper('surveytranslator');
//save refurl from where global settings screen is called!
$refurl = Yii::app()->getRequest()->getUrlReferrer();
// Some URLs are not to be allowed to refered back to.
// These exceptions can be added to the $aReplacements array
$aReplacements = array('admin/user/adduser' => 'admin/user/index', 'admin/user/sa/adduser' => 'admin/user/sa/index', 'admin/user/sa/setusertemplates' => 'admin/user/sa/index', 'admin/user/setusertemplates' => 'admin/user/sa/index');
$refurl = str_replace(array_keys($aReplacements), array_values($aReplacements), $refurl);
Yii::app()->session['refurl'] = htmlspecialchars($refurl);
//just to be safe!
$data['clang'] = $this->getController()->lang;
$data['title'] = "hi";
$data['message'] = "message";
foreach ($this->_checkSettings() as $key => $row) {
$data[$key] = $row;
}
$data['thisupdatecheckperiod'] = getGlobalSetting('updatecheckperiod');
Yii::app()->loadLibrary('Date_Time_Converter');
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
$datetimeobj = new date_time_converter(getGlobalSetting("updatelastcheck"), 'Y-m-d H:i:s');
$data['updatelastcheck'] = $datetimeobj->convert($dateformatdetails['phpdate'] . " H:i:s");
$data['updateavailable'] = getGlobalSetting("updateavailable") && Yii::app()->getConfig("updatable");
$data['updatable'] = Yii::app()->getConfig("updatable");
$data['updateinfo'] = getGlobalSetting("updateinfo");
$data['updatebuild'] = getGlobalSetting("updatebuild");
$data['updateversion'] = getGlobalSetting("updateversion");
$data['allLanguages'] = getLanguageData(false, Yii::app()->session['adminlang']);
if (trim(Yii::app()->getConfig('restrictToLanguages')) == '') {
$data['restrictToLanguages'] = array_keys($data['allLanguages']);
$data['excludedLanguages'] = array();
} else {
$data['restrictToLanguages'] = explode(' ', trim(Yii::app()->getConfig('restrictToLanguages')));
$data['excludedLanguages'] = array_diff(array_keys($data['allLanguages']), $data['restrictToLanguages']);
}
$this->_renderWrappedTemplate('', 'globalSettings_view', $data);
}
示例4: templatereplace
//.........这里部分代码省略.........
if ($_totalquestionsAsked < 1)
{
$_therearexquestions = $clang->gT("There are no questions in this survey"); // Singular
}
elseif ($_totalquestionsAsked == 1)
{
$_therearexquestions = $clang->gT("There is 1 question in this survey"); //Singular
}
else
{
$_therearexquestions = $clang->gT("There are {NUMBEROFQUESTIONS} questions in this survey."); //Note this line MUST be before {NUMBEROFQUESTIONS}
};
}
else
{
$_therearexquestions = '';
};
if (isset($token))
{
$_token = $token;
}
elseif (isset($clienttoken))
{
$_token = htmlentities($clienttoken, ENT_QUOTES, 'UTF-8');
}
else
{
$_token = '';
}
if (isset($thissurvey['surveyls_dateformat']))
{
$dateformatdetails = getDateFormatData($thissurvey['surveyls_dateformat']);
}
else {
$dateformatdetails = getDateFormatData();
}
if (isset($thissurvey['expiry']))
{
$_datetimeobj = new Date_Time_Converter($thissurvey['expiry'], "Y-m-d");
$_dateoutput = $_datetimeobj->convert($dateformatdetails['phpdate']);
}
else
{
$_dateoutput = '-';
}
$_submitbutton = "<input class='submit' type='submit' value=' " . $clang->gT("Submit") . " ' name='move2' onclick=\"javascript:document.limesurvey.move.value = 'movesubmit';\" />";
if (isset($thissurvey['surveyls_url']) and $thissurvey['surveyls_url'] != "")
{
if (trim($thissurvey['surveyls_urldescription']) != '')
{
$_linkreplace = "<a href='{$thissurvey['surveyls_url']}'>{$thissurvey['surveyls_urldescription']}</a>";
}
else
{
$_linkreplace = "<a href='{$thissurvey['surveyls_url']}'>{$thissurvey['surveyls_url']}</a>";
}
}
else
{
$_linkreplace='';
}
if (isset($clienttoken))
{
示例5: preview
/**
* Load preview of a question screen.
*
* @access public
* @param int $surveyid
* @param int $qid
* @param string $lang
* @return void
*/
public function preview($surveyid, $qid, $lang = null)
{
$surveyid = sanitize_int($surveyid);
$qid = sanitize_int($qid);
$LEMdebugLevel = 0;
Yii::app()->loadHelper("qanda");
Yii::app()->loadHelper("surveytranslator");
if (empty($surveyid)) {
$this->getController()->error('No Survey ID provided');
}
if (empty($qid)) {
$this->getController()->error('No Question ID provided');
}
if (empty($lang)) {
$language = Survey::model()->findByPk($surveyid)->language;
} else {
$language = $lang;
}
if (!isset(Yii::app()->session['step'])) {
Yii::app()->session['step'] = 0;
}
if (!isset(Yii::app()->session['prevstep'])) {
Yii::app()->session['prevstep'] = 0;
}
if (!isset(Yii::app()->session['maxstep'])) {
Yii::app()->session['maxstep'] = 0;
}
// Use $_SESSION instead of $this->session for frontend features.
$_SESSION['survey_' . $surveyid]['s_lang'] = $language;
$_SESSION['survey_' . $surveyid]['fieldmap'] = createFieldMap($surveyid, 'full', true, $qid, $language);
// Prefill question/answer from defaultvalues
foreach ($_SESSION['survey_' . $surveyid]['fieldmap'] as $field) {
if (isset($field['defaultvalue'])) {
$_SESSION['survey_' . $surveyid][$field['fieldname']] = $field['defaultvalue'];
}
}
$clang = new limesurvey_lang($language);
$thissurvey = getSurveyInfo($surveyid);
setNoAnswerMode($thissurvey);
Yii::app()->session['dateformats'] = getDateFormatData($thissurvey['surveyls_dateformat']);
$qrows = Questions::model()->findByAttributes(array('sid' => $surveyid, 'qid' => $qid, 'language' => $language))->getAttributes();
$ia = array(0 => $qid, 1 => $surveyid . 'X' . $qrows['gid'] . 'X' . $qid, 2 => $qrows['title'], 3 => $qrows['question'], 4 => $qrows['type'], 5 => $qrows['gid'], 6 => $qrows['mandatory'], 7 => 'N', 8 => 'N');
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['seperator'];
$surveyOptions = array('radix' => $radix, 'tempdir' => Yii::app()->getConfig('tempdir'));
LimeExpressionManager::StartSurvey($surveyid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq + 1, true, false, true);
$answers = retrieveAnswers($ia, $surveyid);
if (!$thissurvey['template']) {
$thistpl = getTemplatePath(Yii::app()->getConfig('defaulttemplate'));
} else {
$thistpl = getTemplatePath(validateTemplateDir($thissurvey['template']));
}
doHeader();
$showQuestion = "\$('#question{$qid}').show();";
$dummy_js = <<<EOD
<script type='text/javascript'>
<!--
LEMradix='{$radix}';
var numRegex = new RegExp('[^-' + LEMradix + '0-9]','g');
var intRegex = new RegExp('[^-0-9]','g');
function fixnum_checkconditions(value, name, type, evt_type, intonly)
{
newval = new String(value);
if (typeof intonly !=='undefined' && intonly==1) {
newval = newval.replace(intRegex,'');
}
else {
newval = newval.replace(numRegex,'');
}
if (LEMradix === ',') {
newval = newval.split(',').join('.');
}
if (newval != '-' && newval != '.' && newval != '-.' && newval != parseFloat(newval)) {
newval = '';
}
displayVal = newval;
if (LEMradix === ',') {
displayVal = displayVal.split('.').join(',');
}
if (name.match(/other\$/)) {
\$('#answer'+name+'text').val(displayVal);
}
\$('#answer'+name).val(displayVal);
if (typeof evt_type === 'undefined')
{
evt_type = 'onchange';
}
checkconditions(newval, name, type, evt_type);
//.........这里部分代码省略.........
示例6: getAdminHeader
function getAdminHeader($meta = false)
{
global $sitename, $admintheme, $rooturl, $defaultlang, $css_admin_includes, $homeurl;
if (!isset($_SESSION['adminlang']) || $_SESSION['adminlang'] == '') {
$_SESSION['adminlang'] = $defaultlang;
}
$strAdminHeader = "<?xml version=\"1.0\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" . "<html ";
if (getLanguageRTL($_SESSION['adminlang'])) {
$strAdminHeader .= " dir=\"rtl\" ";
}
$strAdminHeader .= ">\n<head>\n";
if ($meta) {
$strAdminHeader .= $meta;
}
$strAdminHeader .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\n";
$strAdminHeader .= "<script type=\"text/javascript\" src=\"{$homeurl}/scripts/tabpane/js/tabpane.js\"></script>\n" . "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery.js\"></script>\n" . "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery-ui.js\"></script>\n" . "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery.qtip.js\"></script>\n" . "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery.notify.js\"></script>\n" . "<script type=\"text/javascript\" src=\"{$homeurl}/scripts/admin_core.js\"></script>\n";
if ($_SESSION['adminlang'] != 'en') {
$strAdminHeader .= "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/locale/jquery.ui.datepicker-{$_SESSION['adminlang']}.js\"></script>\n";
}
$strAdminHeader .= "<title>{$sitename}</title>\n";
$strAdminHeader .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$homeurl}//styles/{$admintheme}/tab.webfx.css \" />\n" . "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$rooturl}/scripts/jquery/css/start/jquery-ui.css\" />\n" . "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$homeurl}/styles/{$admintheme}/printablestyle.css\" media=\"print\" />\n" . "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$homeurl}/styles/{$admintheme}/adminstyle.css\" />\n" . "<link rel=\"shortcut icon\" href=\"{$homeurl}/favicon.ico\" type=\"image/x-icon\" />\n" . "<link rel=\"icon\" href=\"{$homeurl}/favicon.ico\" type=\"image/x-icon\" />\n";
if (getLanguageRTL($_SESSION['adminlang'])) {
$strAdminHeader .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/{$admintheme}/adminstyle-rtl.css\" />\n";
}
$css_admin_includes = array_unique($css_admin_includes);
foreach ($css_admin_includes as $cssinclude) {
$strAdminHeader .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$cssinclude}\" />\n";
}
$strAdminHeader .= use_firebug() . "</head>\n<body>\n";
if (isset($_SESSION['dateformat'])) {
$formatdata = getDateFormatData($_SESSION['dateformat']);
$strAdminHeader .= "<script type='text/javascript'>\n var userdateformat='" . $formatdata['jsdate'] . "';\n var userlanguage='" . $_SESSION['adminlang'] . "';\n </script>";
}
// Prepare flashmessage
if (isset($_SESSION['flashmessage']) && $_SESSION['flashmessage'] != '') {
$strAdminHeader .= '<div id="flashmessage" style="display:none;">
<div id="themeroller" class="ui-state-highlight ui-corner-all">
<!-- close link -->
<a class="ui-notify-close" href="#">
<span class="ui-icon ui-icon-close" style="float:right"></span>
</a>
<!-- alert icon -->
<span style="float:left; margin:2px 5px 0 0;" class="ui-icon ui-icon-info"></span>
<h1></h1>
<p>' . $_SESSION['flashmessage'] . '</p>
</div>
<!-- other templates here, maybe.. -->
</div>';
unset($_SESSION['flashmessage']);
}
// Standard header
$strAdminHeader .= "<div class='maintitle'>{$sitename}</div>\n";
return $strAdminHeader;
}
示例7: templatereplace
//.........这里部分代码省略.........
$_question_number = '';
}
if (!($showqnumcode == 'both' || $showqnumcode == 'code' || $showqnumcode == 'choose' && !isset($thissurvey['showqnumcode']) || $showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'B' || $showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'C')) {
$_question_code = '';
}
if (!isset($totalquestions)) {
$totalquestions = 0;
}
$_totalquestionsAsked = $totalquestions;
if ($showxquestions == 'show' || $showxquestions == 'choose' && !isset($thissurvey['showxquestions']) || $showxquestions == 'choose' && $thissurvey['showxquestions'] == 'Y') {
if ($_totalquestionsAsked < 1) {
$_therearexquestions = $clang->gT("There are no questions in this survey");
// Singular
} elseif ($_totalquestionsAsked == 1) {
$_therearexquestions = $clang->gT("There is 1 question in this survey");
//Singular
} else {
$_therearexquestions = $clang->gT("There are {NUMBEROFQUESTIONS} questions in this survey.");
//Note this line MUST be before {NUMBEROFQUESTIONS}
}
} else {
$_therearexquestions = '';
}
if (isset($token)) {
$_token = $token;
} elseif (isset($clienttoken)) {
$_token = htmlentities($clienttoken, ENT_QUOTES, 'UTF-8');
// or should it be URL-encoded?
} else {
$_token = '';
}
// Expiry
if (isset($thissurvey['expiry'])) {
$dateformatdetails = getDateFormatData($thissurvey['surveyls_dateformat']);
Yii::import('application.libraries.Date_Time_Converter', true);
$datetimeobj = new Date_Time_Converter($thissurvey['expiry'], "Y-m-d");
$_dateoutput = $datetimeobj->convert($dateformatdetails['phpdate']);
} else {
$_dateoutput = '-';
}
$_submitbutton = "<input class='submit' type='submit' value=' " . $clang->gT("Submit") . " ' name='move2' onclick=\"javascript:document.limesurvey.move.value = 'movesubmit';\" />";
if (isset($thissurvey['surveyls_url']) and $thissurvey['surveyls_url'] != "") {
if (trim($thissurvey['surveyls_urldescription']) != '') {
$_linkreplace = "<a href='{$thissurvey['surveyls_url']}'>{$thissurvey['surveyls_urldescription']}</a>";
} else {
$_linkreplace = "<a href='{$thissurvey['surveyls_url']}'>{$thissurvey['surveyls_url']}</a>";
}
} else {
$_linkreplace = '';
}
if (isset($thissurvey['sid']) && isset($_SESSION['survey_' . $thissurvey['sid']]['srid']) && $thissurvey['active'] == 'Y') {
$iscompleted = Survey_dynamic::model($surveyid)->isCompleted($_SESSION['survey_' . $thissurvey['sid']]['srid']);
} else {
$iscompleted = false;
}
if (isset($surveyid) && !$iscompleted) {
$_clearall = "<input type='button' name='clearallbtn' value='" . $clang->gT("Exit and clear survey") . "' class='clearall' " . "onclick=\"if (confirm('" . $clang->gT("Are you sure you want to clear all your responses?", 'js') . "')) {\nwindow.open('" . Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}", array('move' => 'clearall', 'lang' => $s_lang), '&');
if (returnGlobal('token')) {
$_clearall .= "&token=" . urlencode(trim(sanitize_token(strip_tags(returnGlobal('token')))));
}
$_clearall .= "', '_self')}\" />";
} else {
$_clearall = "";
}
if (isset(Yii::app()->session['datestamp'])) {
$_datestamp = Yii::app()->session['datestamp'];
示例8: convertToGlobalSettingFormat
/**
* This is a convenience function to convert any date, in any date format, to the global setting date format
*
* @param string $sDate
* @return string
*/
function convertToGlobalSettingFormat($sDate)
{
try {
// Workaround for bug in older PHP version (confirmed for 5.5.9)
// The bug is causing invalid dates to create an internal server error which cannot not be caught by try.. catch
if (@strtotime($sDate) === false) {
throw new Exception("Failed to parse date string ({$sDate})");
}
$oDate = new DateTime($sDate);
// We generate the Date object (PHP will deal with the format of the string)
$sDateformatdata = getDateFormatData(Yii::app()->session['dateformat']);
// We get the Global Setting date format
$sDate = $oDate->format($sDateformatdata['phpdate']);
// We apply it to the Date object to generate a string date
return $sDate;
// We return the string date
} catch (Exception $e) {
$oDate = new DateTime('1/1/1980');
// We generate the Date object (PHP will deal with the format of the string)
$sDateformatdata = getDateFormatData(Yii::app()->session['dateformat']);
// We get the Global Setting date format
$sDate = $oDate->format($sDateformatdata['phpdate']);
// We apply it to the Date object to generate a string date
return $sDate;
// We return the string date
}
}
示例9: db_table_name
//echo '<pre>'.print_r($desrow,true).'</pre>';
$template = $desrow['template'];
$welcome = $desrow['surveyls_welcometext'];
$end = $desrow['surveyls_endtext'];
$surveyname = $desrow['surveyls_title'];
$surveydesc = $desrow['surveyls_description'];
$surveyactive = $desrow['active'];
$surveytable = db_table_name("survey_" . $desrow['sid']);
$surveyexpirydate = $desrow['expires'];
$surveystartdate = $desrow['startdate'];
$surveyfaxto = $desrow['faxto'];
$dateformattype = $desrow['surveyls_dateformat'];
if (isset($_POST['printableexport'])) {
$pdf->titleintopdf($surveyname, $surveydesc);
}
$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;
}
//define('PRINT_TEMPLATE' , '/templates/print/' , true);
if (is_file($usertemplaterootdir . '/' . $template . '/print_survey.pstpl')) {
define('PRINT_TEMPLATE_DIR', $usertemplaterootdir . '/' . $template . '/', true);
define('PRINT_TEMPLATE_URL', $usertemplaterooturl . '/' . $template . '/', true);
} else {
define('PRINT_TEMPLATE_DIR', $standardtemplaterootdir . '/default/', true);
define('PRINT_TEMPLATE_URL', $standardtemplaterooturl . '/default/', true);
示例10: StartSurvey
/**
* Initialize a survey so can use EM to manage navigation
* @param int $surveyid
* @param string $surveyMode
* @param array $aSurveyOptions
* @param bool $forceRefresh
* @param int $debugLevel
*/
static function StartSurvey($surveyid, $surveyMode = 'group', $aSurveyOptions = NULL, $forceRefresh = false, $debugLevel = 0)
{
$LEM =& LimeExpressionManager::singleton();
$LEM->sid = sanitize_int($surveyid);
$LEM->sessid = 'survey_' . $LEM->sid;
$LEM->em->StartProcessingGroup($surveyid);
if (is_null($aSurveyOptions)) {
$aSurveyOptions = array();
}
$LEM->surveyOptions['active'] = isset($aSurveyOptions['active']) ? $aSurveyOptions['active'] : false;
$LEM->surveyOptions['allowsave'] = isset($aSurveyOptions['allowsave']) ? $aSurveyOptions['allowsave'] : false;
$LEM->surveyOptions['anonymized'] = isset($aSurveyOptions['anonymized']) ? $aSurveyOptions['anonymized'] : false;
$LEM->surveyOptions['assessments'] = isset($aSurveyOptions['assessments']) ? $aSurveyOptions['assessments'] : false;
$LEM->surveyOptions['datestamp'] = isset($aSurveyOptions['datestamp']) ? $aSurveyOptions['datestamp'] : false;
$LEM->surveyOptions['deletenonvalues'] = isset($aSurveyOptions['deletenonvalues']) ? $aSurveyOptions['deletenonvalues'] == '1' : true;
$LEM->surveyOptions['hyperlinkSyntaxHighlighting'] = isset($aSurveyOptions['hyperlinkSyntaxHighlighting']) ? $aSurveyOptions['hyperlinkSyntaxHighlighting'] : false;
$LEM->surveyOptions['ipaddr'] = isset($aSurveyOptions['ipaddr']) ? $aSurveyOptions['ipaddr'] : false;
$LEM->surveyOptions['radix'] = isset($aSurveyOptions['radix']) ? $aSurveyOptions['radix'] : '.';
$LEM->surveyOptions['refurl'] = isset($aSurveyOptions['refurl']) ? $aSurveyOptions['refurl'] : NULL;
$LEM->surveyOptions['savetimings'] = isset($aSurveyOptions['savetimings']) ? $aSurveyOptions['savetimings'] : '';
$LEM->sgqaNaming = isset($aSurveyOptions['sgqaNaming']) ? $aSurveyOptions['sgqaNaming'] == "Y" : true;
// TODO default should eventually be false
$LEM->surveyOptions['startlanguage'] = isset($aSurveyOptions['startlanguage']) ? $aSurveyOptions['startlanguage'] : 'en';
$LEM->surveyOptions['surveyls_dateformat'] = isset($aSurveyOptions['surveyls_dateformat']) ? $aSurveyOptions['surveyls_dateformat'] : 1;
$LEM->surveyOptions['tablename'] = isset($aSurveyOptions['tablename']) ? $aSurveyOptions['tablename'] : '{{survey_' . $LEM->sid . '}}';
$LEM->surveyOptions['tablename_timings'] = isset($aSurveyOptions['savetimings']) && $aSurveyOptions['savetimings'] == 'Y' ? '{{survey_' . $LEM->sid . '_timings}}' : '';
$LEM->surveyOptions['target'] = isset($aSurveyOptions['target']) ? $aSurveyOptions['target'] : '/temp/files/';
$LEM->surveyOptions['timeadjust'] = isset($aSurveyOptions['timeadjust']) ? $aSurveyOptions['timeadjust'] : 0;
$LEM->surveyOptions['tempdir'] = isset($aSurveyOptions['tempdir']) ? $aSurveyOptions['tempdir'] : '/temp/';
$LEM->surveyOptions['token'] = isset($aSurveyOptions['token']) ? $aSurveyOptions['token'] : NULL;
$LEM->debugLevel = $debugLevel;
$_SESSION[$LEM->sessid]['LEMdebugLevel'] = $debugLevel;
// need acces to SESSSION to decide whether to cache serialized instance of $LEM
switch ($surveyMode) {
case 'survey':
$LEM->allOnOnePage = true;
$LEM->surveyMode = 'survey';
break;
case 'question':
$LEM->allOnOnePage = false;
$LEM->surveyMode = 'question';
break;
default:
case 'group':
$LEM->allOnOnePage = false;
$LEM->surveyMode = 'group';
break;
}
$LEM->setVariableAndTokenMappingsForExpressionManager($surveyid, $forceRefresh, $LEM->surveyOptions['anonymized'], $LEM->allOnOnePage);
$LEM->currentGroupSeq = -1;
$LEM->currentQuestionSeq = -1;
// for question-by-question mode
$LEM->indexGseq = array();
$LEM->indexQseq = array();
$LEM->qrootVarName2arrayFilter = array();
templatereplace("{}");
// Needed for coreReplacements in relevance equation (in all mode)
if (isset($_SESSION[$LEM->sessid]['startingValues']) && is_array($_SESSION[$LEM->sessid]['startingValues']) && count($_SESSION[$LEM->sessid]['startingValues']) > 0) {
$startingValues = array();
foreach ($_SESSION[$LEM->sessid]['startingValues'] as $k => $value) {
if (isset($LEM->knownVars[$k])) {
$knownVar = $LEM->knownVars[$k];
} else {
if (isset($LEM->qcode2sgqa[$k])) {
$knownVar = $LEM->knownVars[$LEM->qcode2sgqa[$k]];
} else {
if (isset($LEM->tempVars[$k])) {
$knownVar = $LEM->tempVar[$k];
} else {
continue;
}
}
}
if (!isset($knownVar['jsName'])) {
continue;
}
switch ($knownVar['type']) {
case 'D':
//DATE
if (trim($value) == "") {
$value = NULL;
} else {
// We don't really validate date here, anyone can send anything : forced too
$dateformatdatat = getDateFormatData($LEM->surveyOptions['surveyls_dateformat']);
$datetimeobj = new Date_Time_Converter($value, $dateformatdatat['phpdate']);
$value = $datetimeobj->convert("Y-m-d H:i");
}
break;
case 'N':
//NUMERICAL QUESTION TYPE
//NUMERICAL QUESTION TYPE
case 'K':
//.........这里部分代码省略.........
示例11: substr
if (!isset($gtokenid)) {$gtokenid=returnglobal('gtid');}
if (!isset($gtokenids)) {$gtokenids=returnglobal('gtids');}
if (!isset($starttokenid)) {$starttokenid=sanitize_int(returnglobal('last_tid'));}
if(isset($tokenids)) {
$tokenidsarray=explode("|", substr($tokenids, 1)); //Make the tokenids string into an array, and exclude the first character
unset($tokenids);
foreach($tokenidsarray as $tokenitem) {
if($tokenitem != "") $tokenids[]=sanitize_int($tokenitem);
}
}
include_once("login_check.php");
include_once("database.php");
$js_admin_includes[]='scripts/tokens.js';
$dateformatdetails=getDateFormatData($_SESSION['dateformat']);
$thissurvey=getSurveyInfo($surveyid);
if ($subaction == "import" || $subaction == "upload" ) // THis array only needs to be defined for these two functions
{
$js_admin_includes[]='scripts/tokens.js';
$encodingsarray = array("armscii8"=>$clang->gT("ARMSCII-8 Armenian")
,"ascii"=>$clang->gT("US ASCII")
,"auto"=>$clang->gT("Automatic")
,"big5"=>$clang->gT("Big5 Traditional Chinese")
,"binary"=>$clang->gT("Binary pseudo charset")
,"cp1250"=>$clang->gT("Windows Central European")
,"cp1251"=>$clang->gT("Windows Cyrillic")
,"cp1256"=>$clang->gT("Windows Arabic")
,"cp1257"=>$clang->gT("Windows Baltic")
示例12: index
//.........这里部分代码省略.........
$sURL = html_entity_decode(Yii::app()->request->getPost('url_' . $langname), ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$short_title = Yii::app()->request->getPost('short_title_' . $langname);
$description = Yii::app()->request->getPost('description_' . $langname);
$welcome = Yii::app()->request->getPost('welcome_' . $langname);
$endtext = Yii::app()->request->getPost('endtext_' . $langname);
$short_title = $oFixCKeditor->fixCKeditor($short_title);
$description = $oFixCKeditor->fixCKeditor($description);
$welcome = $oFixCKeditor->fixCKeditor($welcome);
$endtext = $oFixCKeditor->fixCKeditor($endtext);
$data = array('surveyls_title' => $short_title, 'surveyls_description' => $description, 'surveyls_welcometext' => $welcome, 'surveyls_endtext' => $endtext, 'surveyls_url' => $sURL, 'surveyls_urldescription' => $sURLDescription, 'surveyls_dateformat' => Yii::app()->request->getPost('dateformat_' . $langname), 'surveyls_numberformat' => Yii::app()->request->getPost('numberformat_' . $langname));
$SurveyLanguageSetting = SurveyLanguageSetting::model()->findByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $langname));
$SurveyLanguageSetting->attributes = $data;
$SurveyLanguageSetting->save();
// save the change to database
}
}
//Yii::app()->session['flashmessage'] = gT("Survey text elements successfully saved.");
////////////////////////////////////////////////////////////////////////////////////
// General settings (copy / paste from surveyadmin::update)
// Preload survey
$oSurvey = Survey::model()->findByPk($iSurveyID);
// Save plugin settings.
$pluginSettings = App()->request->getPost('plugin', array());
foreach ($pluginSettings as $plugin => $settings) {
$settingsEvent = new PluginEvent('newSurveySettings');
$settingsEvent->set('settings', $settings);
$settingsEvent->set('survey', $iSurveyID);
App()->getPluginManager()->dispatchEvent($settingsEvent, $plugin);
}
/* Start to fix some param before save (TODO : use models directly ?) */
/* Date management */
Yii::app()->loadHelper('surveytranslator');
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
Yii::app()->loadLibrary('Date_Time_Converter');
$startdate = App()->request->getPost('startdate');
if (trim($startdate) == "") {
$startdate = null;
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'] . ' H:i');
//new Date_Time_Converter($startdate,$formatdata['phpdate'].' H:i');
$startdate = $datetimeobj->convert("Y-m-d H:i:s");
}
$expires = App()->request->getPost('expires');
if (trim($expires) == "") {
$expires = null;
} else {
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'] . ' H:i');
//new Date_Time_Converter($expires, $formatdata['phpdate'].' H:i');
$expires = $datetimeobj->convert("Y-m-d H:i:s");
}
// We have $oSurvey : update and save it
$oSurvey->owner_id = Yii::app()->request->getPost('owner_id');
$oSurvey->admin = Yii::app()->request->getPost('admin');
$oSurvey->expires = $expires;
$oSurvey->startdate = $startdate;
$oSurvey->faxto = App()->request->getPost('faxto');
$oSurvey->format = App()->request->getPost('format');
$oSurvey->template = Yii::app()->request->getPost('template');
$oSurvey->assessments = App()->request->getPost('assessments');
$oSurvey->additional_languages = Yii::app()->request->getPost('languageids');
if ($oSurvey->active != 'Y') {
$oSurvey->anonymized = App()->request->getPost('anonymized');
$oSurvey->savetimings = App()->request->getPost('savetimings');
$oSurvey->datestamp = App()->request->getPost('datestamp');
示例13: _getAdminHeader
/**
* Prints Admin Header
*
* @access protected
* @param bool $meta
* @param bool $return
* @return mixed
*/
public function _getAdminHeader($meta = false, $return = false)
{
if (empty(Yii::app()->session['adminlang'])) {
Yii::app()->session["adminlang"] = Yii::app()->getConfig("defaultlang");
}
$data = array();
$data['adminlang'] = Yii::app()->session['adminlang'];
//$data['admin'] = getLanguageRTL;
$data['test'] = "t";
$data['languageRTL'] = "";
$data['styleRTL'] = "";
Yii::app()->loadHelper("surveytranslator");
if (getLanguageRTL(Yii::app()->session["adminlang"])) {
$data['languageRTL'] = " dir=\"rtl\" ";
$data['bIsRTL'] = true;
} else {
$data['bIsRTL'] = false;
}
$data['meta'] = "";
if ($meta) {
$data['meta'] = $meta;
}
$data['baseurl'] = Yii::app()->baseUrl . '/';
$data['datepickerlang'] = "";
if (Yii::app()->session["adminlang"] != 'en') {
$data['datepickerlang'] = "<script type=\"text/javascript\" src=\"" . Yii::app()->getConfig('generalscripts') . "jquery/locale/jquery.ui.datepicker-" . Yii::app()->session["adminlang"] . ".js\"></script>\n";
}
$data['sitename'] = Yii::app()->getConfig("sitename");
$data['admintheme'] = Yii::app()->getConfig("admintheme");
$data['firebug'] = useFirebug();
if (!empty(Yii::app()->session['dateformat'])) {
$data['formatdata'] = getDateFormatData(Yii::app()->session['dateformat']);
}
// Prepare flashmessage
if (!empty(Yii::app()->session['flashmessage']) && Yii::app()->session['flashmessage'] != '') {
$data['flashmessage'] = Yii::app()->session['flashmessage'];
unset(Yii::app()->session['flashmessage']);
}
$data['css_admin_includes'] = $this->_css_admin_includes(array(), true);
return $this->renderPartial("/admin/super/header", $data, $return);
}
示例14: _surveysummary
/**
* Show survey summary
* @param int Survey id
* @param string Action to be performed
*/
function _surveysummary($aData)
{
$iSurveyID = $aData['surveyid'];
$aSurveyInfo = getSurveyInfo($iSurveyID);
$oSurvey = $aData['oSurvey'];
$baselang = $aSurveyInfo['language'];
$activated = $aSurveyInfo['active'];
$condition = array('sid' => $iSurveyID, 'parent_qid' => 0, 'language' => $baselang);
$sumresult3 = Question::model()->findAllByAttributes($condition);
//Checked
$sumcount3 = count($sumresult3);
$condition = array('sid' => $iSurveyID, 'language' => $baselang);
$sumresult2 = QuestionGroup::model()->findAllByAttributes($condition);
//Checked
$sumcount2 = count($sumresult2);
//SURVEY SUMMARY
$aAdditionalLanguages = $oSurvey->additionalLanguages;
$surveysummary2 = "";
if ($aSurveyInfo['anonymized'] != "N") {
$surveysummary2 .= gT("Responses to this survey are anonymized.") . "<br />";
} else {
$surveysummary2 .= gT("Responses to this survey are NOT anonymized.") . "<br />";
}
if ($aSurveyInfo['format'] == "S") {
$surveysummary2 .= gT("It is presented question by question.") . "<br />";
} elseif ($aSurveyInfo['format'] == "G") {
$surveysummary2 .= gT("It is presented group by group.") . "<br />";
} else {
$surveysummary2 .= gT("It is presented on one single page.") . "<br />";
}
if ($aSurveyInfo['questionindex'] > 0) {
if ($aSurveyInfo['format'] == 'A') {
$surveysummary2 .= gT("No question index will be shown with this format.") . "<br />";
} elseif ($aSurveyInfo['questionindex'] == 1) {
$surveysummary2 .= gT("A question index will be shown; participants will be able to jump between viewed questions.") . "<br />";
} elseif ($aSurveyInfo['questionindex'] == 2) {
$surveysummary2 .= gT("A full question index will be shown; participants will be able to jump between relevant questions.") . "<br />";
}
}
if ($aSurveyInfo['datestamp'] == "Y") {
$surveysummary2 .= gT("Responses will be date stamped.") . "<br />";
}
if ($aSurveyInfo['ipaddr'] == "Y") {
$surveysummary2 .= gT("IP Addresses will be logged") . "<br />";
}
if ($aSurveyInfo['refurl'] == "Y") {
$surveysummary2 .= gT("Referrer URL will be saved.") . "<br />";
}
if ($aSurveyInfo['usecookie'] == "Y") {
$surveysummary2 .= gT("It uses cookies for access control.") . "<br />";
}
if ($aSurveyInfo['allowregister'] == "Y") {
$surveysummary2 .= gT("If tokens are used, the public may register for this survey") . "<br />";
}
if ($aSurveyInfo['allowsave'] == "Y" && $aSurveyInfo['tokenanswerspersistence'] == 'N') {
$surveysummary2 .= gT("Participants can save partially finished surveys") . "<br />\n";
}
if ($aSurveyInfo['emailnotificationto'] != '') {
$surveysummary2 .= gT("Basic email notification is sent to:") . ' ' . htmlspecialchars($aSurveyInfo['emailnotificationto']) . "<br />\n";
}
if ($aSurveyInfo['emailresponseto'] != '') {
$surveysummary2 .= gT("Detailed email notification with response data is sent to:") . ' ' . htmlspecialchars($aSurveyInfo['emailresponseto']) . "<br />\n";
}
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
if (trim($aSurveyInfo['startdate']) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$datetimeobj = new Date_Time_Converter($aSurveyInfo['startdate'], 'Y-m-d H:i:s');
$aData['startdate'] = $datetimeobj->convert($dateformatdetails['phpdate'] . ' H:i');
} else {
$aData['startdate'] = "-";
}
if (trim($aSurveyInfo['expires']) != '') {
//$constructoritems = array($surveyinfo['expires'] , "Y-m-d H:i:s");
Yii::import('application.libraries.Date_Time_Converter');
$datetimeobj = new Date_Time_Converter($aSurveyInfo['expires'], 'Y-m-d H:i:s');
//$datetimeobj = new Date_Time_Converter($surveyinfo['expires'] , "Y-m-d H:i:s");
$aData['expdate'] = $datetimeobj->convert($dateformatdetails['phpdate'] . ' H:i');
} else {
$aData['expdate'] = "-";
}
if (!$aSurveyInfo['language']) {
$aData['language'] = getLanguageNameFromCode($currentadminlang, false);
} else {
$aData['language'] = getLanguageNameFromCode($aSurveyInfo['language'], false);
}
// get the rowspan of the Additionnal languages row
// is at least 1 even if no additionnal language is present
$additionnalLanguagesCount = count($aAdditionalLanguages);
$first = true;
if ($aSurveyInfo['surveyls_urldescription'] == "") {
$aSurveyInfo['surveyls_urldescription'] = htmlspecialchars($aSurveyInfo['surveyls_url']);
}
if ($aSurveyInfo['surveyls_url'] != "") {
$aData['endurl'] = " <a target='_blank' href=\"" . htmlspecialchars($aSurveyInfo['surveyls_url']) . "\" title=\"" . htmlspecialchars($aSurveyInfo['surveyls_url']) . "\">" . flattenText($aSurveyInfo['surveyls_urldescription']) . "</a>";
} else {
//.........这里部分代码省略.........
示例15: filterColumns
/**
* Loop through columns and add filter if any value is given for this column
* Used in responses grid
* @param CdbCriteria $criteria
* @return void
*/
protected function filterColumns(CDbCriteria $criteria)
{
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
// Filters for responses
foreach ($this->metaData->columns as $column) {
$isNotDefaultColumn = !in_array($column->name, $this->defaultColumns);
if ($isNotDefaultColumn) {
$c1 = (string) $column->name;
$columnHasValue = !empty($this->{$c1});
if ($columnHasValue) {
$isDatetime = strpos($column->dbType, 'timestamp') !== false || strpos($column->dbType, 'datetime') !== false;
if ($column->dbType == 'decimal') {
$this->{$c1} = (double) $this->{$c1};
$criteria->compare(Yii::app()->db->quoteColumnName($c1), $this->{$c1}, false);
} else {
if ($isDatetime) {
$s = DateTime::createFromFormat($dateformatdetails['phpdate'], $this->{$c1});
if ($s === false) {
// This happens when date is in wrong format
continue;
}
$s2 = $s->format('Y-m-d');
$criteria->addCondition('cast(' . Yii::app()->db->quoteColumnName($c1) . ' as date) = \'' . $s2 . '\'');
} else {
$criteria->compare(Yii::app()->db->quoteColumnName($c1), $this->{$c1}, true);
}
}
}
}
}
}