本文整理汇总了PHP中convertDateTimeFormat函数的典型用法代码示例。如果您正苦于以下问题:PHP convertDateTimeFormat函数的具体用法?PHP convertDateTimeFormat怎么用?PHP convertDateTimeFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertDateTimeFormat函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emailTokens
/**
* Sends email to tokens - invitation and reminders
*
* @param mixed $iSurveyID
* @param array $aResultTokens
* @param string $sType type of notification invite|register|remind
* @return array of results
*/
function emailTokens($iSurveyID, $aResultTokens, $sType)
{
Yii::app()->loadHelper('common');
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (getEmailFormat($iSurveyID) == 'html') {
$bHtml = true;
} else {
$bHtml = false;
}
$attributes = array_keys(getTokenFieldsAndNames($iSurveyID));
$oSurveyLocale = SurveyLanguageSetting::model()->findAllByAttributes(array('surveyls_survey_id' => $iSurveyID));
$oTokens = Token::model($iSurveyID);
$aSurveyLangs = $oSurvey->additionalLanguages;
array_unshift($aSurveyLangs, $oSurvey->language);
//Convert result to associative array to minimize SurveyLocale access attempts
foreach ($oSurveyLocale as $rows) {
$oTempObject = array();
foreach ($rows as $k => $v) {
$oTempObject[$k] = $v;
}
$aSurveyLocaleData[$rows['surveyls_language']] = $oTempObject;
}
foreach ($aResultTokens as $aTokenRow) {
//Select language
$aTokenRow['language'] = trim($aTokenRow['language']);
$found = array_search($aTokenRow['language'], $aSurveyLangs);
if ($aTokenRow['language'] == '' || $found == false) {
$aTokenRow['language'] = $oSurvey['language'];
}
$sTokenLanguage = $aTokenRow['language'];
//Build recipient
$to = array();
$aEmailaddresses = explode(';', $aTokenRow['email']);
foreach ($aEmailaddresses as $sEmailaddress) {
$to[] = $aTokenRow['firstname'] . " " . $aTokenRow['lastname'] . " <{$sEmailaddress}>";
}
//Populate attributes
$fieldsarray["{SURVEYNAME}"] = $aSurveyLocaleData[$sTokenLanguage]['surveyls_title'];
if ($fieldsarray["{SURVEYNAME}"] == '') {
$fieldsarray["{SURVEYNAME}"] = $aSurveyLocaleData[$oSurvey['language']]['surveyls_title'];
}
$fieldsarray["{SURVEYDESCRIPTION}"] = $aSurveyLocaleData[$sTokenLanguage]['surveyls_description'];
if ($fieldsarray["{SURVEYDESCRIPTION}"] == '') {
$fieldsarray["{SURVEYDESCRIPTION}"] = $aSurveyLocaleData[$oSurvey['language']]['surveyls_description'];
}
$fieldsarray["{ADMINNAME}"] = $oSurvey['admin'];
$fieldsarray["{ADMINEMAIL}"] = $oSurvey['adminemail'];
$from = $fieldsarray["{ADMINNAME}"] . ' <' . $fieldsarray["{ADMINEMAIL}"] . '>';
if ($from == '') {
$from = Yii::app()->getConfig('siteadminemail');
}
foreach ($attributes as $attributefield) {
$fieldsarray['{' . strtoupper($attributefield) . '}'] = $aTokenRow[$attributefield];
$fieldsarray['{TOKEN:' . strtoupper($attributefield) . '}'] = $aTokenRow[$attributefield];
}
//create urls
$fieldsarray["{OPTOUTURL}"] = Yii::app()->getController()->createAbsoluteUrl("/optout/tokens/langcode/" . trim($aTokenRow['language']) . "/surveyid/{$iSurveyID}/token/{$aTokenRow['token']}");
$fieldsarray["{OPTINURL}"] = Yii::app()->getController()->createAbsoluteUrl("/optin/tokens/langcode/" . trim($aTokenRow['language']) . "/surveyid/{$iSurveyID}/token/{$aTokenRow['token']}");
$fieldsarray["{SURVEYURL}"] = Yii::app()->getController()->createAbsoluteUrl("/survey/index/sid/{$iSurveyID}/token/{$aTokenRow['token']}/lang/" . trim($aTokenRow['language']) . "/");
if ($bHtml) {
foreach (array('OPTOUT', 'OPTIN', 'SURVEY') as $key) {
$url = $fieldsarray["{{$key}URL}"];
$fieldsarray["{{$key}URL}"] = "<a href='{$url}'>" . htmlspecialchars($url) . '</a>';
if ($key == 'SURVEY') {
$barebone_link = $url;
}
}
}
//mail headers
$customheaders = array('1' => "X-surveyid: " . $iSurveyID, '2' => "X-tokenid: " . $fieldsarray["{TOKEN}"]);
global $maildebug;
//choose appriopriate email message
if ($sType == 'invite') {
$sSubject = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_invite_subj'];
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_invite'];
} else {
if ($sType == 'register') {
$sSubject = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_register_subj'];
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_register'];
} else {
$sSubject = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_remind_subj'];
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_remind'];
}
}
$modsubject = Replacefields($sSubject, $fieldsarray);
$modmessage = Replacefields($sMessage, $fieldsarray);
if (isset($barebone_link)) {
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
}
if (isset($aTokenRow['validfrom']) && trim($aTokenRow['validfrom']) != '' && convertDateTimeFormat($aTokenRow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1) {
$aResult[$aTokenRow['tid']] = array('name' => $fieldsarray["{FIRSTNAME}"] . " " . $fieldsarray["{LASTNAME}"], 'email' => $fieldsarray["{EMAIL}"], 'status' => 'fail', 'error' => 'Token not valid yet');
//.........这里部分代码省略.........
示例2: email
//.........这里部分代码省略.........
$fieldsarray["{LASTNAME}"] = $emrow['lastname'];
$fieldsarray["{TOKEN}"] = $emrow['token'];
$fieldsarray["{LANGUAGE}"] = $emrow['language'];
foreach ($attributes as $attributefield) {
$fieldsarray['{' . strtoupper($attributefield) . '}'] = $emrow[$attributefield];
$fieldsarray['{TOKEN:' . strtoupper($attributefield) . '}'] = $emrow[$attributefield];
}
$emrow['language'] = trim($emrow['language']);
$found = array_search($emrow['language'], $aSurveyLangs);
if ($emrow['language'] == '' || $found == false) {
$emrow['language'] = $sBaseLanguage;
}
$from = Yii::app()->request->getPost('from_' . $emrow['language']);
$fieldsarray["{OPTOUTURL}"] = $this->getController()->createAbsoluteUrl("/optout/tokens/langcode/" . trim($emrow['language']) . "/surveyid/{$iSurveyId}/token/{$emrow['token']}");
$fieldsarray["{OPTINURL}"] = $this->getController()->createAbsoluteUrl("/optin/tokens/langcode/" . trim($emrow['language']) . "/surveyid/{$iSurveyId}/token/{$emrow['token']}");
$fieldsarray["{SURVEYURL}"] = $this->getController()->createAbsoluteUrl("/survey/index/sid/{$iSurveyId}/token/{$emrow['token']}/lang/" . trim($emrow['language']) . "/");
foreach (array('OPTOUT', 'OPTIN', 'SURVEY') as $key) {
$url = $fieldsarray["{{$key}URL}"];
if ($bHtml) {
$fieldsarray["{{$key}URL}"] = "<a href='{$url}'>" . htmlspecialchars($url) . '</a>';
}
if ($key == 'SURVEY') {
$barebone_link = $url;
}
}
$customheaders = array('1' => "X-surveyid: " . $iSurveyId, '2' => "X-tokenid: " . $fieldsarray["{TOKEN}"]);
global $maildebug;
$modsubject = Replacefields($sSubject[$emrow['language']], $fieldsarray);
$modmessage = Replacefields($sMessage[$emrow['language']], $fieldsarray);
if (isset($barebone_link)) {
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
}
if (trim($emrow['validfrom']) != '' && convertDateTimeFormat($emrow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1) {
$tokenoutput .= $emrow['tid'] . " " . ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.") . "<br />", $fieldsarray);
} elseif (trim($emrow['validuntil']) != '' && convertDateTimeFormat($emrow['validuntil'], 'Y-m-d H:i:s', 'U') * 1 < date('U') * 1) {
$tokenoutput .= $emrow['tid'] . " " . ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.") . "<br />", $fieldsarray);
} else {
/*
* Get attachments.
*/
if ($sSubAction == 'email') {
$sTemplate = 'invitation';
} elseif ($sSubAction == 'remind') {
$sTemplate = 'reminder';
}
$aRelevantAttachments = array();
if (isset($aData['thissurvey'][$emrow['language']]['attachments'])) {
$aAttachments = unserialize($aData['thissurvey'][$emrow['language']]['attachments']);
if (!empty($aAttachments)) {
if (isset($aAttachments[$sTemplate])) {
LimeExpressionManager::singleton()->loadTokenInformation($aData['thissurvey']['sid'], $emrow['token']);
foreach ($aAttachments[$sTemplate] as $aAttachment) {
if (LimeExpressionManager::singleton()->ProcessRelevance($aAttachment['relevance'])) {
$aRelevantAttachments[] = $aAttachment['url'];
}
}
}
}
}
/**
* Event for email handling.
* Parameter type description:
* subject rw Body of the email
* to rw Recipient(s)
* from rw Sender(s)
示例3: getExtendedAnswer
/**
* @param integer $iSurveyID The Survey ID
* @param string $sFieldCode Field code of the particular field
* @param string $sValue The stored response value
* @param string $sLanguage Initialized limesurvey_lang object for the resulting response data
* @return string
*/
function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $sLanguage)
{
if ($sValue == null || $sValue == '') {
return '';
}
//Fieldcode used to determine question, $sValue used to match against answer code
//Returns NULL if question type does not suit
if (strpos($sFieldCode, "{$iSurveyID}X") === 0) {
$fieldmap = createFieldMap($iSurveyID, 'short', false, false, $sLanguage);
if (isset($fieldmap[$sFieldCode])) {
$fields = $fieldmap[$sFieldCode];
} else {
return false;
}
// If it is a comment field there is nothing to convert here
if ($fields['aid'] == 'comment') {
return $sValue;
}
//Find out the question type
$this_type = $fields['type'];
switch ($this_type) {
case 'D':
if (trim($sValue) != '') {
$qidattributes = getQuestionAttributeValues($fields['qid']);
$dateformatdetails = getDateFormatDataForQID($qidattributes, $iSurveyID);
$sValue = convertDateTimeFormat($sValue, "Y-m-d H:i:s", $dateformatdetails['phpdate']);
}
break;
case 'N':
if (trim($sValue) != '') {
if (strpos($sValue, ".") !== false) {
$sValue = rtrim(rtrim($sValue, "0"), ".");
}
$qidattributes = getQuestionAttributeValues($fields['qid']);
if ($qidattributes['num_value_int_only']) {
$sValue = number_format($sValue, 0, '', '');
}
}
break;
case "L":
case "!":
case "O":
case "^":
case "I":
case "R":
$result = Answer::model()->getAnswerFromCode($fields['qid'], $sValue, $sLanguage);
foreach ($result as $row) {
$this_answer = $row['answer'];
}
// while
if ($sValue == "-oth-") {
$this_answer = gT("Other", null, $sLanguage);
}
break;
case "M":
case "J":
case "P":
switch ($sValue) {
case "Y":
$this_answer = gT("Yes", null, $sLanguage);
break;
}
break;
case "Y":
switch ($sValue) {
case "Y":
$this_answer = gT("Yes", null, $sLanguage);
break;
case "N":
$this_answer = gT("No", null, $sLanguage);
break;
default:
$this_answer = gT("No answer", null, $sLanguage);
}
break;
case "G":
switch ($sValue) {
case "M":
$this_answer = gT("Male", null, $sLanguage);
break;
case "F":
$this_answer = gT("Female", null, $sLanguage);
break;
default:
$this_answer = gT("No answer", null, $sLanguage);
}
break;
case "C":
switch ($sValue) {
case "Y":
$this_answer = gT("Yes", null, $sLanguage);
break;
case "N":
//.........这里部分代码省略.........
示例4: getDateFormatData
?>
</option>
</select></li>
<?php
$dateformatdata = getDateFormatData(Yii::app()->session['dateformat']);
?>
<li><label for='timeadjust'><?php
$clang->eT("Time difference (in hours):");
?>
</label>
<span><input type='text' size='10' id='timeadjust' name='timeadjust' value="<?php
echo htmlspecialchars(str_replace(array('+', ' hours'), array('', ''), getGlobalSetting('timeadjust')));
?>
" />
<?php
echo $clang->gT("Server time:") . ' ' . convertDateTimeFormat(date('Y-m-d H:i:s'), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i') . " - " . $clang->gT("Corrected time :") . ' ' . convertDateTimeFormat(dateShift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i');
?>
</span></li>
<li><label for='iSessionExpirationTime'><?php
$clang->eT("Session lifetime (seconds):");
?>
</label>
<input type='text' size='10' id='iSessionExpirationTime' name='iSessionExpirationTime' value="<?php
echo htmlspecialchars(getGlobalSetting('iSessionExpirationTime'));
?>
" /></li>
<li><label for='ipInfoDbAPIKey'><?php
$clang->eT("IP Info DB API Key:");
?>
</label>
示例5: html_entity_decode
$fieldsarray["{SURVEYURL}"]="<a href='$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}'>".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}")."</a>";
$fieldsarray["@@SURVEYURL@@"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}";
$_POST['message_'.$emrow['language']] = html_entity_decode($_POST['message_'.$emrow['language']], ENT_QUOTES, $emailcharset);
}
}
$msgsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray);
$sendmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray);
$customheaders = array( '1' => "X-surveyid: ".$surveyid,
'2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]);
if (trim($emrow['validfrom'])!='' && convertDateTimeFormat($emrow['validfrom'],'Y-m-d H:i:s','U')*1>date('U')*1)
{
$tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.")."<br />", $fieldsarray);
}
elseif (trim($emrow['validuntil'])!='' && convertDateTimeFormat($emrow['validuntil'],'Y-m-d H:i:s','U')*1<date('U')*1)
{
$tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.")."<br />", $fieldsarray);
}
elseif (SendEmailMessage($sendmessage, $msgsubject, $to, $from, $sitename,$ishtml,getBounceEmail($surveyid),null,$customheaders))
{
// Put date into remindersent
$today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust);
$udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n"
."SET remindersent='$today',remindercount = remindercount+1 WHERE tid={$emrow['tid']}";
//
$uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens<br />$udequery<br />".$connect->ErrorMsg());
//orig: $tokenoutput .= "({$emrow['tid']})[".$clang->gT("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']}]<br />\n";
$tokenoutput .= "({$emrow['tid']}) [".$clang->gT("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)]<br />\n";
}
示例6: submittokens
/**
* Marks a tokens as completed and sends a confirmation email to the participiant.
* If $quotaexit is set to true then the user exited the survey due to a quota
* restriction and the according token is only marked as 'Q'
*
* @param mixed $quotaexit
*/
function submittokens($quotaexit = false)
{
global $thissurvey;
global $surveyid;
global $clienttoken;
$clang = Yii::app()->lang;
$sitename = Yii::app()->getConfig("sitename");
$emailcharset = Yii::app()->getConfig("emailcharset");
// Shift the date due to global timeadjust setting
$today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
// check how many uses the token has left
$usesquery = "SELECT usesleft, participant_id, tid FROM {{tokens_{$surveyid}}} WHERE token='" . $clienttoken . "'";
$usesresult = dbExecuteAssoc($usesquery);
$usesrow = $usesresult->read();
if (isset($usesrow)) {
$usesleft = $usesrow['usesleft'];
$participant_id = $usesrow['participant_id'];
$token_id = $usesrow['tid'];
}
$utquery = "UPDATE {{tokens_{$surveyid}}}\n";
if ($quotaexit == true) {
$utquery .= "SET completed='Q', usesleft=usesleft-1\n";
} elseif (isTokenCompletedDatestamped($thissurvey)) {
if (isset($usesleft) && $usesleft <= 1) {
$utquery .= "SET usesleft=usesleft-1, completed='{$today}'\n";
if (!empty($participant_id)) {
//Update the survey_links table if necessary
$slquery = Survey_links::model()->find('participant_id = "' . $participant_id . '" AND survey_id = ' . $surveyid . ' AND token_id = ' . $token_id);
$slquery->date_completed = $today;
$slquery->save();
}
} else {
$utquery .= "SET usesleft=usesleft-1\n";
}
} else {
if (isset($usesleft) && $usesleft <= 1) {
$utquery .= "SET usesleft=usesleft-1, completed='Y'\n";
if (!empty($participant_id)) {
//Update the survey_links table if necessary, to protect anonymity, use the date_created field date
$slquery = Survey_links::model()->find('participant_id = "' . $participant_id . '" AND survey_id = ' . $surveyid . ' AND token_id = ' . $token_id);
$slquery->date_completed = $slquery->date_created;
$slquery->save();
}
} else {
$utquery .= "SET usesleft=usesleft-1\n";
}
}
$utquery .= "WHERE token='" . $clienttoken . "'";
$utresult = dbExecuteAssoc($utquery) or safeDie("Couldn't update tokens table!<br />\n{$utquery}<br />\n");
//Checked
if ($quotaexit == false) {
// TLR change to put date into sent and completed
$cnfquery = "SELECT * FROM {{tokens_{$surveyid}}} WHERE token='" . $clienttoken . "' AND completed!='N' AND completed!=''";
$cnfresult = dbExecuteAssoc($cnfquery);
//Checked
$cnfrow = $cnfresult->read();
if (isset($cnfrow)) {
$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
$to = $cnfrow['email'];
$subject = $thissurvey['email_confirm_subj'];
$fieldsarray["{ADMINNAME}"] = $thissurvey['adminname'];
$fieldsarray["{ADMINEMAIL}"] = $thissurvey['adminemail'];
$fieldsarray["{SURVEYNAME}"] = $thissurvey['name'];
$fieldsarray["{SURVEYDESCRIPTION}"] = $thissurvey['description'];
$fieldsarray["{FIRSTNAME}"] = $cnfrow['firstname'];
$fieldsarray["{LASTNAME}"] = $cnfrow['lastname'];
$fieldsarray["{TOKEN}"] = $clienttoken;
$attrfieldnames = getAttributeFieldNames($surveyid);
foreach ($attrfieldnames as $attr_name) {
$fieldsarray["{" . strtoupper($attr_name) . "}"] = $cnfrow[$attr_name];
}
$dateformatdatat = getDateFormatData($thissurvey['surveyls_dateformat']);
$numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
$fieldsarray["{EXPIRY}"] = convertDateTimeFormat($thissurvey["expiry"], 'Y-m-d H:i:s', $dateformatdatat['phpdate']);
$subject = ReplaceFields($subject, $fieldsarray, true);
$subject = html_entity_decode($subject, ENT_QUOTES, $emailcharset);
if (getEmailFormat($surveyid) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
if (trim(strip_tags($thissurvey['email_confirm'])) != "" && $thissurvey['sendconfirmation'] == "Y") {
$message = $thissurvey['email_confirm'];
$message = ReplaceFields($message, $fieldsarray, true);
if (!$ishtml) {
$message = strip_tags(breakToNewline(html_entity_decode($message, ENT_QUOTES, $emailcharset)));
} else {
$message = html_entity_decode($message, ENT_QUOTES, $emailcharset);
}
//Only send confirmation email if there is a valid email address
if (validateEmailAddress($cnfrow['email'])) {
SendEmailMessage($message, $subject, $to, $from, $sitename, $ishtml);
}
//.........这里部分代码省略.........
示例7: getExtendedAnswer
/**
*
* @param type $iSurveyID The Survey ID
* @param type $sFieldCode Field code of the particular field
* @param type $sValue The stored response value
* @param object $oLanguage Initialized limesurvey_lang object for the resulting response data
* @return string
*/
function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $oLanguage)
{
if (is_null($sValue) || $sValue == '') {
return '';
}
$sLanguage = $oLanguage->langcode;
//Fieldcode used to determine question, $sValue used to match against answer code
//Returns NULL if question type does not suit
if (strpos($sFieldCode, "{$iSurveyID}X") === 0) {
$fieldmap = createFieldMap($iSurveyID, 'short', false, false, $sLanguage);
if (isset($fieldmap[$sFieldCode])) {
$fields = $fieldmap[$sFieldCode];
} else {
return false;
}
//Find out the question type
$this_type = $fields['type'];
switch ($this_type) {
case 'D':
if (trim($sValue) != '') {
$qidattributes = getQuestionAttributeValues($fields['qid']);
$dateformatdetails = getDateFormatDataForQID($qidattributes, $iSurveyID);
$sValue = convertDateTimeFormat($sValue, "Y-m-d H:i:s", $dateformatdetails['phpdate']);
}
break;
case "L":
case "!":
case "O":
case "^":
case "I":
case "R":
$result = Answers::model()->getAnswerFromCode($fields['qid'], $sValue, $sLanguage) or die("Couldn't get answer type L - getAnswerCode()");
//Checked
foreach ($result as $row) {
$this_answer = $row['answer'];
}
// while
if ($sValue == "-oth-") {
$this_answer = $oLanguage->gT("Other");
}
break;
case "M":
case "J":
case "P":
switch ($sValue) {
case "Y":
$this_answer = $oLanguage->gT("Yes");
break;
}
break;
case "Y":
switch ($sValue) {
case "Y":
$this_answer = $oLanguage->gT("Yes");
break;
case "N":
$this_answer = $oLanguage->gT("No");
break;
default:
$this_answer = $oLanguage->gT("No answer");
}
break;
case "G":
switch ($sValue) {
case "M":
$this_answer = $oLanguage->gT("Male");
break;
case "F":
$this_answer = $oLanguage->gT("Female");
break;
default:
$this_answer = $oLanguage->gT("No answer");
}
break;
case "C":
switch ($sValue) {
case "Y":
$this_answer = $oLanguage->gT("Yes");
break;
case "N":
$this_answer = $oLanguage->gT("No");
break;
case "U":
$this_answer = $oLanguage->gT("Uncertain");
break;
}
break;
case "E":
switch ($sValue) {
case "I":
$this_answer = $oLanguage->gT("Increase");
break;
//.........这里部分代码省略.........
示例8: globalsettingsdisplay
//.........这里部分代码省略.........
$editsurvey .= ""
. "\t<li><label for='defaulttemplate'>".$clang->gT("Default template:")."</label>\n"
. "\t\t\t<select name='defaulttemplate' id='defaulttemplate'>\n";
foreach ($templatenames as $templatename)
{
$editsurvey.= "\t\t\t\t<option value='$templatename'";
if ($thisdefaulttemplate==$templatename) {$editsurvey .= " selected='selected'";}
$editsurvey .=">$templatename</option>\n";
}
$editsurvey .="\t\t\t</select></li>\n";
$thisdefaulthtmleditormode=getGlobalSetting('defaulthtmleditormode');
$editsurvey .= ""
. "\t<li><label for='defaulthtmleditormode'>".$clang->gT("Default HTML editor mode:").(($demoModeOnly==true)?'*':'')."</label>\n"
. "\t\t\t<select name='defaulthtmleditormode' id='defaulthtmleditormode'>\n"
. "\t\t\t\t<option value='default'";
if ($thisdefaulthtmleditormode=='default') {$editsurvey .= " selected='selected'";}
$editsurvey .=">".$clang->gT("Default HTML editor mode")."</option>\n"
. "\t\t\t\t<option value='none'";
if ($thisdefaulthtmleditormode=='none') {$editsurvey .= " selected='selected'";}
$editsurvey .=">".$clang->gT("No HTML editor")."</option>\n"
. "<option value='inline'";
if ($thisdefaulthtmleditormode=='inline') {$editsurvey .= " selected='selected'";}
$editsurvey .=">".$clang->gT("Inline HTML editor")."</option>\n"
. "<option value='popup'";
if ($thisdefaulthtmleditormode=='popup') {$editsurvey .= " selected='selected'";}
$editsurvey .=">".$clang->gT("Popup HTML editor")."</option>\n"
. "</select></li>\n";
$dateformatdata=getDateFormatData($_SESSION['dateformat']);
$editsurvey.= "\t<li><label for='timeadjust'>".$clang->gT("Time difference (in hours):")."</label>\n"
. "\t\t<span><input type='text' size='10' id='timeadjust' name='timeadjust' value=\"".htmlspecialchars(str_replace(array('+',' hours'),array('',''),getGlobalSetting('timeadjust')))."\" /> "
. $clang->gT("Server time:").' '.convertDateTimeFormat(date('Y-m-d H:i:s'),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i')." - ".$clang->gT("Corrected time :").' '.convertDateTimeFormat(date_shift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i')."
</span></li>\n";
$thisusepdfexport=getGlobalSetting('usepdfexport');
$editsurvey .= "\t<li><label for='usepdfexport'>".$clang->gT("PDF export available:")."</label>\n"
. "<select name='usepdfexport' id='usepdfexport'>\n"
. "<option value='1'";
if ( $thisusepdfexport == true) {$editsurvey .= " selected='selected'";}
$editsurvey .= ">".$clang->gT("On")."</option>\n"
. "<option value='0'";
if ( $thisusepdfexport == false) {$editsurvey .= " selected='selected'";}
$editsurvey .= ">".$clang->gT("Off")."</option>\n"
. "\t\t</select>\n\t</li>\n";
$thisaddTitleToLinks=getGlobalSetting('addTitleToLinks');
$editsurvey .= "\t<li><label for='addTitleToLinks'>".$clang->gT("Screen reader compatibility mode:")."</label>\n"
. "<select name='addTitleToLinks' id='addTitleToLinks'>\n"
. "<option value='1'";
if ( $thisaddTitleToLinks == true) {$editsurvey .= " selected='selected'";}
$editsurvey .= ">".$clang->gT("On")."</option>\n"
. "<option value='0'";
if ( $thisaddTitleToLinks == false) {$editsurvey .= " selected='selected'";}
$editsurvey .= ">".$clang->gT("Off")."</option>\n"
. "</select>\n</li>\n"
. "<li><label for='sessionlifetime'>".$clang->gT("Session lifetime (seconds):")."</label>\n"
. "<input type='text' size='10' id='sessionlifetime' name='sessionlifetime' value=\"".htmlspecialchars(getGlobalSetting('sessionlifetime'))."\" /></li>"
. "<li><label for='ipInfoDbAPIKey'>".$clang->gT("IP Info DB API Key:")."</label>\n"
. "<input type='text' size='35' id='ipInfoDbAPIKey' name='ipInfoDbAPIKey' value=\"".htmlspecialchars(getGlobalSetting('ipInfoDbAPIKey'))."\" /></li>"
. "<li><label for='googleMapsAPIKey'>".$clang->gT("Google Maps API key:")."</label>\n"
. "<input type='text' size='35' id='googleMapsAPIKey' name='googleMapsAPIKey' value=\"".htmlspecialchars(getGlobalSetting('googleMapsAPIKey'))."\" /></li>"
;
示例9: getCreationDate
public function getCreationDate()
{
$dateformatdata = getDateFormatData(Yii::app()->session['dateformat']);
return convertDateTimeFormat($this->datecreated, 'Y-m-d', $dateformatdata['phpdate']);
}
示例10: email
//.........这里部分代码省略.........
$_POST['message_' . $language] = html_entity_decode(Yii::app()->request->getPost('message_' . $language), ENT_QUOTES, Yii::app()->getConfig("emailcharset"));
}
}
$attributes = getTokenFieldsAndNames($iSurveyId);
$tokenoutput = "";
if ($emcount > 0) {
foreach ($emresult as $emrow) {
$to = array();
$aEmailaddresses = explode(';', $emrow['email']);
foreach ($aEmailaddresses as $sEmailaddress) {
$to[] = $emrow['firstname'] . " " . $emrow['lastname'] . " <{$sEmailaddress}>";
}
$fieldsarray["{EMAIL}"] = $emrow['email'];
$fieldsarray["{FIRSTNAME}"] = $emrow['firstname'];
$fieldsarray["{LASTNAME}"] = $emrow['lastname'];
$fieldsarray["{TOKEN}"] = $emrow['token'];
$fieldsarray["{LANGUAGE}"] = $emrow['language'];
foreach ($attributes as $attributefield => $attributedescription) {
$fieldsarray['{' . strtoupper($attributefield) . '}'] = $emrow[$attributefield];
$fieldsarray['{TOKEN:' . strtoupper($attributefield) . '}'] = $emrow[$attributefield];
}
$emrow['language'] = trim($emrow['language']);
$found = array_search($emrow['language'], $aSurveyLangs);
if ($emrow['language'] == '' || $found == false) {
$emrow['language'] = $sBaseLanguage;
}
$from = Yii::app()->request->getPost('from_' . $emrow['language']);
$fieldsarray["{OPTOUTURL}"] = $this->getController()->createAbsoluteUrl("/optout/tokens/langcode/" . trim($emrow['language']) . "/surveyid/{$iSurveyId}/token/{$emrow['token']}");
$fieldsarray["{OPTINURL}"] = $this->getController()->createAbsoluteUrl("/optin/tokens/langcode/" . trim($emrow['language']) . "/surveyid/{$iSurveyId}/token/{$emrow['token']}");
$fieldsarray["{SURVEYURL}"] = $this->getController()->createAbsoluteUrl("/survey/index/sid/{$iSurveyId}/token/{$emrow['token']}/langcode/" . trim($emrow['language']) . "/");
foreach (array('OPTOUT', 'OPTIN', 'SURVEY') as $key) {
$url = $fieldsarray["{{$key}URL}"];
if ($bHtml) {
$fieldsarray["{{$key}URL}"] = "<a href='{$url}'>" . htmlspecialchars($url) . '</a>';
}
if ($key == 'SURVEY') {
$barebone_link = $url;
}
}
$customheaders = array('1' => "X-surveyid: " . $iSurveyId, '2' => "X-tokenid: " . $fieldsarray["{TOKEN}"]);
global $maildebug;
$modsubject = Replacefields(Yii::app()->request->getPost('subject_' . $emrow['language']), $fieldsarray);
$modmessage = Replacefields(Yii::app()->request->getPost('message_' . $emrow['language']), $fieldsarray);
if (isset($barebone_link)) {
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
}
if (trim($emrow['validfrom']) != '' && convertDateTimeFormat($emrow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1) {
$tokenoutput .= $emrow['tid'] . " " . ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.") . "<br />", $fieldsarray);
} elseif (trim($emrow['validuntil']) != '' && convertDateTimeFormat($emrow['validuntil'], 'Y-m-d H:i:s', 'U') * 1 < date('U') * 1) {
$tokenoutput .= $emrow['tid'] . " " . ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.") . "<br />", $fieldsarray);
} else {
if (SendEmailMessage($modmessage, $modsubject, $to, $from, Yii::app()->getConfig("sitename"), $bHtml, getBounceEmail($iSurveyId), null, $customheaders)) {
// Put date into sent
$udequery = Tokens_dynamic::model($iSurveyId)->findByPk($emrow['tid']);
if ($bEmail) {
$tokenoutput .= $clang->gT("Invitation sent to:");
$udequery->sent = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
} else {
$tokenoutput .= $clang->gT("Reminder sent to:");
$udequery->remindersent = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
$udequery->remindercount = $udequery->remindercount + 1;
}
$udequery->save();
//Update central participant survey_links
if (!empty($emrow['participant_id'])) {
$slquery = Survey_links::model()->find('participant_id = "' . $emrow['participant_id'] . '" AND survey_id = ' . $iSurveyId . ' AND token_id = ' . $emrow['tid']);
$slquery->date_invited = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
$slquery->save();
}
$tokenoutput .= "{$emrow['tid']}: {$emrow['firstname']} {$emrow['lastname']} ({$emrow['email']})<br />\n";
if (Yii::app()->getConfig("emailsmtpdebug") == 2) {
$tokenoutput .= $maildebug;
}
} else {
$tokenoutput .= ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:") . " " . $maildebug . "<br />", $fieldsarray);
}
}
unset($fieldsarray);
}
$aViewUrls = array('tokenbar', 'emailpost');
$aData['tokenoutput'] = $tokenoutput;
if ($ctcount > $emcount) {
$i = 0;
if (isset($aTokenIds)) {
while ($i < $iMaxEmails) {
array_shift($aTokenIds);
$i++;
}
$aData['tids'] = implode('|', $aTokenIds);
}
$aData['lefttosend'] = $ctcount - $iMaxEmails;
$aViewUrls[] = 'emailwarning';
}
$this->_renderWrappedTemplate('token', $aViewUrls, $aData);
} else {
$this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => $clang->gT("Warning"), 'message' => $clang->gT("There were no eligible emails to send. This will be because none satisfied the criteria of:") . "<br/> <ul><li>" . $clang->gT("having a valid email address") . "</li>" . "<li>" . $clang->gT("not having been sent an invitation already") . "</li>" . "<li>" . $clang->gT("having already completed the survey") . "</li>" . "<li>" . $clang->gT("having a token") . "</li></ul>")), $aData);
}
}
}
示例11: array
$aSettingsUpdate['updateavailable'] = array('type' => 'info', 'label' => sprintf(gT('There was an error on update check (%s)'), $updateinfo['errorcode']), 'content' => CHtml::tag('pre', array(), strip_tags($updateinfo['errorhtml'])));
} elseif ($updatable) {
$aSettingsUpdate['updateavailable'] = array('type' => 'info', 'content' => gT('There is currently no newer LimeSurvey version available.'));
} else {
$aSettingsUpdate['updateavailable'] = array('type' => 'info', 'content' => sprintf(gT('This is an unstable version and cannot be updated using ComfortUpdate. Please check %s regularly for a newer version.'), CHtml::link(gT("our website"), "http://www.limesurvey.org")));
}
$this->widget('ext.SettingsWidget.SettingsWidget', array('title' => gt("Updates"), 'form' => false, 'formHtmlOptions' => array('class' => 'form-core'), 'inlist' => true, 'settings' => $aSettingsUpdate));
?>
</div>
<?php
// General seetings in one part
// Preparing array
$aTemplateNames = array_keys(getTemplateList());
$aAdminThemes = array_keys(getAdminThemeList());
$dateformatdata = getDateFormatData(Yii::app()->session['dateformat']);
$aGeneralSettings = array('info_general' => array(), 'sitename' => array('type' => 'string', 'label' => gT("Site name") . $sStringDemoMode, 'labelOptions' => array('class' => $sClassDemoMode), 'current' => getGlobalSetting('sitename'), 'htmlOptions' => array('readonly' => $bDemoMode)), 'defaulttemplate' => array('type' => 'select', 'label' => gT('Default template') . $sStringDemoMode, 'labelOptions' => array('class' => $sClassDemoMode), 'htmlOptions' => array('readonly' => $bDemoMode), 'options' => array_combine($aTemplateNames, $aTemplateNames), 'current' => Template::templateNameFilter(getGlobalSetting('defaulttemplate'))), 'admintheme' => array('type' => 'select', 'label' => gT('Administration template') . $sStringDemoMode, 'labelOptions' => array('class' => $sClassDemoMode), 'htmlOptions' => array('readonly' => $bDemoMode), 'options' => array_combine($aAdminThemes, $aAdminThemes), 'current' => getGlobalSetting('admintheme')), 'defaulthtmleditormode' => array('type' => 'select', 'label' => gT('Default HTML editor mode') . $sStringDemoMode, 'labelOptions' => array('class' => $sClassDemoMode), 'htmlOptions' => array('readonly' => $bDemoMode), 'options' => array('none' => gT("No HTML editor", 'unescaped'), 'inline' => gT("Inline HTML editor (default)", 'unescaped'), 'popup' => gT("Popup HTML editor", 'unescaped')), 'current' => getGlobalSetting('defaulthtmleditormode')), 'defaultquestionselectormode' => array('type' => 'select', 'label' => gT('Question type selector') . $sStringDemoMode, 'labelOptions' => array('class' => $sClassDemoMode), 'htmlOptions' => array('readonly' => $bDemoMode), 'options' => array('default' => gT("Full selector (default)", 'unescaped'), 'none' => gT("Simple selector", 'unescaped')), 'current' => getGlobalSetting('defaultquestionselectormode')), 'defaulttemplateeditormode' => array('type' => 'select', 'label' => gT('Template editor') . $sStringDemoMode, 'labelOptions' => array('class' => $sClassDemoMode), 'htmlOptions' => array('readonly' => $bDemoMode), 'options' => array('default' => gT("Full template editor (default)", 'unescaped'), 'none' => gT("Simple template editor", 'unescaped')), 'current' => getGlobalSetting('defaulttemplateeditormode')), 'timeadjust' => array('type' => 'float', 'label' => gt("Time difference (in hours)"), 'current' => str_replace(array('+', ' hours', ' minutes'), array('', '', ''), getGlobalSetting('timeadjust')) / 60, 'help' => sprintf(gT("Server time: %s - Corrected time: %s"), convertDateTimeFormat(date('Y-m-d H:i:s'), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i'), convertDateTimeFormat(dateShift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i'))), 'iSessionExpirationTime' => array(), 'GeoNamesUsername' => array('type' => 'string', 'label' => 'GeoNames username for API', 'current' => getGlobalSetting('GeoNamesUsername'), 'htmlOptions' => array('size' => '35')), 'googleMapsAPIKey' => array('type' => 'string', 'label' => 'Google Maps API key', 'current' => getGlobalSetting('googleMapsAPIKey'), 'htmlOptions' => array('size' => '35')), 'ipInfoDbAPIKey' => array('type' => 'string', 'label' => 'IP Info DB API Key', 'current' => getGlobalSetting('ipInfoDbAPIKey'), 'htmlOptions' => array('size' => '35')), 'googleanalyticsapikey' => array('type' => 'string', 'label' => 'Google Analytics API key', 'current' => getGlobalSetting('googleanalyticsapikey'), 'htmlOptions' => array('size' => '35')), 'googletranslateapikey' => array('type' => 'string', 'label' => 'Google Translate API key', 'current' => getGlobalSetting('googletranslateapikey'), 'htmlOptions' => array('size' => '35')));
if (isset(Yii::app()->session->connectionID)) {
$aGeneralSettings["iSessionExpirationTime"] = array('type' => 'int', 'label' => 'Session lifetime for surveys (seconds)', 'current' => getGlobalSetting('iSessionExpirationTime'), 'htmlOptions' => array('style' => 'width:10em', 'min' => 1));
}
if ($bDemoMode) {
$aGeneralSettings['info_general'] = array('type' => 'info', 'class' => 'alert', 'label' => gt("Note"), 'content' => gt("Demo mode is activated. Some settings can't be changed."));
}
$this->widget('ext.SettingsWidget.SettingsWidget', array('id' => 'general', 'form' => false, 'formHtmlOptions' => array('class' => 'form-core'), 'inlist' => true, 'settings' => $aGeneralSettings));
?>
<div id='email'>
<?php
// Email in 2 part : User and SMTP
$this->widget('ext.SettingsWidget.SettingsWidget', array('form' => false, 'formHtmlOptions' => array('class' => 'form-core'), 'inlist' => true, 'settings' => array('siteadminemail' => array('type' => 'email', 'label' => gt("Default site admin email"), 'current' => getGlobalSetting('siteadminemail'), 'htmlOptions' => array('size' => '50')), 'siteadminname' => array('type' => 'string', 'label' => gt("Administrator name"), 'current' => getGlobalSetting('siteadminname'), 'htmlOptions' => array('size' => '50')))));
$this->widget('ext.SettingsWidget.SettingsWidget', array('title' => gt("SMTP configuration"), 'form' => false, 'formHtmlOptions' => array('class' => 'form-core'), 'inlist' => true, 'settings' => array('emailmethod' => array('type' => 'select', 'label' => gt("Email method"), 'options' => array('mail' => gT("PHP (default)", 'unescaped'), 'smtp' => gT("SMTP", 'unescaped'), 'sendmail' => gT("Sendmail", 'unescaped'), 'qmail' => gT("Qmail", 'unescaped')), 'current' => getGlobalSetting('emailmethod')), 'emailsmtphost' => array('type' => 'string', 'class' => array('smtp-on'), 'label' => gt("SMTP host"), 'current' => getGlobalSetting('emailsmtphost'), 'htmlOptions' => array('size' => '50'), 'help' => gT("Enter your hostname and port, e.g.: my.smtp.com:25")), 'emailsmtpuser' => array('type' => 'string', 'class' => array('smtp-on'), 'label' => gt("SMTP username"), 'current' => getGlobalSetting('emailsmtpuser'), 'htmlOptions' => array('size' => '50')), 'emailsmtppassword' => array('type' => 'password', 'class' => array('smtp-on'), 'label' => gt("SMTP password"), 'current' => getGlobalSetting('emailsmtppassword'), 'htmlOptions' => array('size' => '50')), 'emailsmtpssl' => array('type' => 'select', 'class' => array('smtp-on'), 'label' => gt("SMTP SSL/TLS"), 'options' => array('' => gT("Off", 'unescaped'), 'ssl' => gT("SSL", 'unescaped'), 'tls' => gT("TLS", 'unescaped')), 'current' => getGlobalSetting('emailsmtpssl'), 'htmlOptions' => array('size' => '50')), 'emailsmtpdebug' => array('type' => 'select', 'label' => gt("SMTP debug mode"), 'options' => array('0' => gT("Off", 'unescaped'), '1' => gT("On errors", 'unescaped'), '2' => gT("Always", 'unescaped')), 'current' => getGlobalSetting('emailsmtpdebug'), 'htmlOptions' => array('size' => '50')), 'maxemails' => array('type' => 'int', 'label' => gt("Email batch size"), 'current' => getGlobalSetting('maxemails'), 'htmlOptions' => array('min' => '1', 'style' => 'width:5em')))));
?>
示例12: editor
'class'=>$sClassDemoMode,
),
'htmlOptions'=>array(
'readonly'=>$bDemoMode,
),
'options'=>array(
'default'=>gT("Full template editor (default)",'unescaped'),
'none'=>gT("Simple template editor",'unescaped'),
),
'current'=>getGlobalSetting('defaulttemplateeditormode'),
),
'timeadjust'=>array(
'type'=>'float',
'label'=>gt("Time difference (in hours)"),
'current'=>str_replace(array('+',' hours',' minutes'),array('','',''),getGlobalSetting('timeadjust'))/60,
'help'=>sprintf(gT("Server time: %s - Corrected time: %s"),convertDateTimeFormat(date('Y-m-d H:i:s'),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i'),convertDateTimeFormat(dateShift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i'))
),
'iSessionExpirationTime'=>array(
// A place to put iSessionExpirationTime if needed
),
'GeoNamesUsername'=>array(
'type'=>'string',
'label'=>'GeoNames username for API',
'current'=>getGlobalSetting('GeoNamesUsername'),
'htmlOptions'=>array(
'size'=>'35',
)
),
'googleMapsAPIKey'=>array(
'type'=>'string',
'label'=>'Google Maps API key',