本文整理汇总了PHP中templateDefaultTexts函数的典型用法代码示例。如果您正苦于以下问题:PHP templateDefaultTexts函数的具体用法?PHP templateDefaultTexts怎么用?PHP templateDefaultTexts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了templateDefaultTexts函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Load edit email template screen.
* @param mixed $iSurveyId
* @return
*/
function index($iSurveyId)
{
$clang = $this->getController()->lang;
$iSurveyId = sanitize_int($iSurveyId);
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminstyleurl') . "superfish.css");
Yii::app()->loadHelper('admin.htmleditor');
Yii::app()->loadHelper('surveytranslator');
Yii::app()->session['FileManagerContext'] = "edit:assessments:{$iSurveyId}";
if (isset($iSurveyId) && getEmailFormat($iSurveyId) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
$grplangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$baselang = Survey::model()->findByPk($iSurveyId)->language;
array_unshift($grplangs, $baselang);
$sEditScript = PrepareEditorScript(false, $this->getController());
$aData['attrib'] = array();
$aData['bplangs'] = array();
$aData['defaulttexts'] = array();
if ($ishtml) {
$sEscapeMode = 'html';
} else {
$sEscapeMode = 'unescaped';
}
foreach ($grplangs as $key => $grouplang) {
$aData['bplangs'][$key] = new limesurvey_lang($grouplang);
$aData['attrib'][$key] = Surveys_languagesettings::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :ls', array(':ssid' => $iSurveyId, ':ls' => $grouplang));
$aData['defaulttexts'][$key] = templateDefaultTexts($aData['bplangs'][$key], $sEscapeMode);
}
$aData['surveyid'] = $iSurveyId;
$aData['ishtml'] = $ishtml;
$aData['grplangs'] = $grplangs;
$this->_renderWrappedTemplate('emailtemplates', array('output' => $sEditScript, 'emailtemplates_view'), $aData);
}
示例2: lsdefault
/**
* Defines the customs validation rule lsdefault
*
* @param mixed $attribute
* @param mixed $params
*/
public function lsdefault($attribute, $params)
{
$oLanguageTranslator = new Limesurvey_lang($this->surveyls_language);
$aDefaultTexts = templateDefaultTexts($oLanguageTranslator, 'unescaped');
$aDefaultTextData = array('surveyls_email_invite_subj' => $aDefaultTexts['invitation_subject'], 'surveyls_email_invite' => $aDefaultTexts['invitation'], 'surveyls_email_remind_subj' => $aDefaultTexts['reminder_subject'], 'surveyls_email_remind' => $aDefaultTexts['reminder'], 'surveyls_email_confirm_subj' => $aDefaultTexts['confirmation_subject'], 'surveyls_email_confirm' => $aDefaultTexts['confirmation'], 'surveyls_email_register_subj' => $aDefaultTexts['registration_subject'], 'surveyls_email_register' => $aDefaultTexts['registration'], 'email_admin_notification_subj' => $aDefaultTexts['admin_notification_subject'], 'email_admin_notification' => $aDefaultTexts['admin_notification'], 'email_admin_responses_subj' => $aDefaultTexts['admin_detailed_notification_subject'], 'email_admin_responses' => $aDefaultTexts['admin_detailed_notification']);
if (getEmailFormat($this->surveyls_survey_id) == "html") {
$aDefaultTextData['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . $aDefaultTexts['admin_detailed_notification'];
}
if (empty($this->{$attribute})) {
$this->{$attribute} = $aDefaultTextData[$attribute];
}
}
示例3: lsdefault
/**
* Defines the customs validation rule lsdefault
*
* @param mixed $attribute
* @param mixed $params
*/
public function lsdefault($attribute, $params)
{
$oSurvey = Survey::model()->findByPk($this->surveyls_survey_id);
$sEmailFormat = $oSurvey->htmlemail == 'Y' ? 'html' : '';
$aDefaultTexts = templateDefaultTexts($this->surveyls_language, 'unescaped', $sEmailFormat);
$aDefaultTextData = array('surveyls_email_invite_subj' => $aDefaultTexts['invitation_subject'], 'surveyls_email_invite' => $aDefaultTexts['invitation'], 'surveyls_email_remind_subj' => $aDefaultTexts['reminder_subject'], 'surveyls_email_remind' => $aDefaultTexts['reminder'], 'surveyls_email_confirm_subj' => $aDefaultTexts['confirmation_subject'], 'surveyls_email_confirm' => $aDefaultTexts['confirmation'], 'surveyls_email_register_subj' => $aDefaultTexts['registration_subject'], 'surveyls_email_register' => $aDefaultTexts['registration'], 'email_admin_notification_subj' => $aDefaultTexts['admin_notification_subject'], 'email_admin_notification' => $aDefaultTexts['admin_notification'], 'email_admin_responses_subj' => $aDefaultTexts['admin_detailed_notification_subject'], 'email_admin_responses' => $aDefaultTexts['admin_detailed_notification']);
if ($sEmailFormat == "html") {
$aDefaultTextData['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . $aDefaultTexts['admin_detailed_notification'];
}
if (empty($this->{$attribute})) {
$this->{$attribute} = $aDefaultTextData[$attribute];
}
}
示例4: index
/**
* Load edit email template screen.
* @param mixed $iSurveyId
* @return
*/
function index($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Yii::app()->loadHelper('admin.htmleditor');
Yii::app()->loadHelper('surveytranslator');
Yii::app()->session['FileManagerContext'] = "edit:emailsettings:{$iSurveyId}";
initKcfinder();
if (isset($iSurveyId) && getEmailFormat($iSurveyId) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
$grplangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$baselang = Survey::model()->findByPk($iSurveyId)->language;
array_unshift($grplangs, $baselang);
$sEditScript = PrepareEditorScript(false, $this->getController());
$aData['attrib'] = array();
$aData['bplangs'] = array();
$aData['defaulttexts'] = array();
if ($ishtml) {
$sEscapeMode = 'html';
} else {
$sEscapeMode = 'unescaped';
}
foreach ($grplangs as $key => $grouplang) {
$aData['bplangs'][$key] = $grouplang;
$aData['attrib'][$key] = SurveyLanguageSetting::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :ls', array(':ssid' => $iSurveyId, ':ls' => $grouplang));
$aData['attrib'][$key]['attachments'] = unserialize($aData['attrib'][$key]['attachments']);
$aData['defaulttexts'][$key] = templateDefaultTexts($aData['bplangs'][$key], $sEscapeMode);
}
$aData['sidemenu']['state'] = false;
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
$aData['surveybar']['saveandclosebutton']['form'] = 'frmeditgroup';
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'surveycontent', 'update')) {
unset($aData['surveybar']['savebutton']);
unset($aData['surveybar']['saveandclosebutton']);
}
$aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyId;
// Close button
$aData['surveyid'] = $iSurveyId;
$aData['ishtml'] = $ishtml;
$aData['grplangs'] = $grplangs;
$this->_renderWrappedTemplate('emailtemplates', array('output' => $sEditScript, 'emailtemplates_view'), $aData);
}
示例5: index
/**
* Load edit email template screen.
* @param mixed $iSurveyId
* @return
*/
function index($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
App()->getClientScript()->registerPackage('jquery-superfish');
Yii::app()->loadHelper('admin.htmleditor');
Yii::app()->loadHelper('surveytranslator');
Yii::app()->session['FileManagerContext'] = "edit:emailsettings:{$iSurveyId}";
initKcfinder();
if (isset($iSurveyId) && getEmailFormat($iSurveyId) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
$grplangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$baselang = Survey::model()->findByPk($iSurveyId)->language;
array_unshift($grplangs, $baselang);
$sEditScript = PrepareEditorScript(false, $this->getController());
$aData['attrib'] = array();
$aData['bplangs'] = array();
$aData['defaulttexts'] = array();
if ($ishtml) {
$sEscapeMode = 'html';
} else {
$sEscapeMode = 'unescaped';
}
foreach ($grplangs as $key => $grouplang) {
$aData['bplangs'][$key] = $grouplang;
$aData['attrib'][$key] = SurveyLanguageSetting::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :ls', array(':ssid' => $iSurveyId, ':ls' => $grouplang));
$aData['attrib'][$key]['attachments'] = unserialize($aData['attrib'][$key]['attachments']);
$aData['defaulttexts'][$key] = templateDefaultTexts($aData['bplangs'][$key], $sEscapeMode);
}
$aData['surveyid'] = $iSurveyId;
$aData['ishtml'] = $ishtml;
$aData['grplangs'] = $grplangs;
$this->_renderWrappedTemplate('emailtemplates', array('output' => $sEditScript, 'emailtemplates_view'), $aData);
}
示例6: add_survey
/**
* RPC Routine to add an empty survey with minimum details.
* Used as a placeholder for importing groups and/or questions.
*
* @access public
* @param string $sSessionKey Auth credentials
* @param int $iSurveyID The wish id of the Survey to add
* @param string $sSurveyTitle Title of the new Survey
* @param string $sSurveyLanguage Default language of the Survey
* @param string $sformat Question appearance format
* @return array|string|int
*/
public function add_survey($sSessionKey, $iSurveyID, $sSurveyTitle, $sSurveyLanguage, $sformat = 'G')
{
Yii::app()->loadHelper("surveytranslator");
if ($this->_checkSessionKey($sSessionKey)) {
if (Permission::model()->hasGlobalPermission('surveys', 'create')) {
if ($sSurveyTitle == '' || $sSurveyLanguage == '' || !array_key_exists($sSurveyLanguage, getLanguageDataRestricted()) || !in_array($sformat, array('A', 'G', 'S'))) {
return array('status' => 'Faulty parameters');
}
$aInsertData = array('template' => 'default', 'owner_id' => Yii::app()->session['loginID'], 'active' => 'N', 'language' => $sSurveyLanguage, 'format' => $sformat);
if (!is_null($iSurveyID)) {
$aInsertData['wishSID'] = $iSurveyID;
}
try {
$iNewSurveyid = Survey::model()->insertNewSurvey($aInsertData);
if (!$iNewSurveyid) {
return array('status' => 'Creation Failed');
}
$sTitle = html_entity_decode($sSurveyTitle, ENT_QUOTES, "UTF-8");
// Load default email templates for the chosen language
$oLanguage = new Limesurvey_lang($sSurveyLanguage);
$aDefaultTexts = templateDefaultTexts($oLanguage, 'unescaped');
unset($oLanguage);
$bIsHTMLEmail = false;
$aInsertData = array('surveyls_survey_id' => $iNewSurveyid, 'surveyls_title' => $sTitle, 'surveyls_language' => $sSurveyLanguage);
$langsettings = new SurveyLanguageSetting();
$langsettings->insertNewSurvey($aInsertData);
Permission::model()->giveAllSurveyPermissions(Yii::app()->session['loginID'], $iNewSurveyid);
return (int) $iNewSurveyid;
} catch (Exception $e) {
return array('status' => $e->getmessage());
}
} else {
return array('status' => 'No permission');
}
} else {
return array('status' => 'Invalid session key');
}
}
示例7: upgradeSurveys145
function upgradeSurveys145()
{
global $modifyoutputt;
$sSurveyQuery = "SELECT * FROM {{surveys}} where notification<>'0'";
$oSurveyResult = dbExecuteAssoc($sSurveyQuery);
foreach ($oSurveyResult->readAll() as $aSurveyRow) {
if ($aSurveyRow['notification'] == '1' && trim($aSurveyRow['adminemail']) != '') {
$aEmailAddresses = explode(';', $aSurveyRow['adminemail']);
$sAdminEmailAddress = $aEmailAddresses[0];
$sEmailnNotificationAddresses = implode(';', $aEmailAddresses);
$sSurveyUpdateQuery = "update {{surveys}} set adminemail='{$sAdminEmailAddress}', emailnotificationto='{$sEmailnNotificationAddresses}' where sid=" . $aSurveyRow['sid'];
Yii::app()->getDb()->createCommand($sSurveyUpdateQuery)->execute();
} else {
$aEmailAddresses = explode(';', $aSurveyRow['adminemail']);
$sAdminEmailAddress = $aEmailAddresses[0];
$sEmailDetailedNotificationAddresses = implode(';', $aEmailAddresses);
if (trim($aSurveyRow['emailresponseto']) != '') {
$sEmailDetailedNotificationAddresses = $sEmailDetailedNotificationAddresses . ';' . trim($aSurveyRow['emailresponseto']);
}
$sSurveyUpdateQuery = "update {{surveys}} set adminemail='{$sAdminEmailAddress}', emailnotificationto='{$sEmailDetailedNotificationAddresses}' where sid=" . $aSurveyRow['sid'];
Yii::app()->getDb()->createCommand($sSurveyUpdateQuery)->execute();
}
}
$sSurveyQuery = "SELECT * FROM {{surveys_languagesettings}}";
$oSurveyResult = Yii::app()->getDb()->createCommand($sSurveyQuery)->queryAll();
foreach ($oSurveyResult as $aSurveyRow) {
$sLanguage = App()->language;
$aDefaultTexts = templateDefaultTexts($sLanguage, 'unescaped');
unset($sLanguage);
$aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification'] . $aDefaultTexts['admin_detailed_notification_css'];
$sSurveyUpdateQuery = "update {{surveys_languagesettings}} set\n email_admin_responses_subj=" . $aDefaultTexts['admin_detailed_notification_subject'] . ",\n email_admin_responses=" . $aDefaultTexts['admin_detailed_notification'] . ",\n email_admin_notification_subj=" . $aDefaultTexts['admin_notification_subject'] . ",\n email_admin_notification=" . $aDefaultTexts['admin_notification'] . "\n where surveyls_survey_id=" . $aSurveyRow['surveyls_survey_id'];
Yii::app()->getDb()->createCommand()->update('{{surveys_languagesettings}}', array('email_admin_responses_subj' => $aDefaultTexts['admin_detailed_notification_subject'], 'email_admin_responses' => $aDefaultTexts['admin_detailed_notification'], 'email_admin_notification_subj' => $aDefaultTexts['admin_notification_subject'], 'email_admin_notification' => $aDefaultTexts['admin_notification']), "surveyls_survey_id={$aSurveyRow['surveyls_survey_id']}");
}
}
示例8: array
?>
</ul>
<?php echo CHtml::form(array("admin/tokens/sa/email/surveyid/{$surveyid}"), 'post', array('id'=>'sendinvitation', 'name'=>'sendinvitation', 'class'=>'form30')); ?>
<?php
foreach ($surveylangs as $language)
{
//GET SURVEY DETAILS
$bplang = new limesurvey_lang($language);
if ($ishtml === true)
{
$aDefaultTexts = templateDefaultTexts($bplang);
}
else
{
$aDefaultTexts = templateDefaultTexts($bplang, 'unescaped');
}
if (!$thissurvey[$language]['email_invite'])
{
if ($ishtml === true)
{
$thissurvey[$language]['email_invite'] = HTMLEscape($aDefaultTexts['invitation']);
}
else
{
$thissurvey[$language]['email_invite'] = $aDefaultTexts['invitation'];
}
}
if (!$thissurvey[$language]['email_invite_subj'])
{
$thissurvey[$language]['email_invite_subj'] = $aDefaultTexts['invitation_subject'];
示例9: email
/**
* Handle email action
*/
public function email($iSurveyId, $tokenids = null)
{
$iSurveyId = sanitize_int($iSurveyId);
$aData = array();
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
if (!$bTokenExists) {
self::_newtokentable($iSurveyId);
}
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData['sidemenu']['state'] = false;
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
$aData['sidemenu']["token_menu"] = TRUE;
$aData['token_bar']['closebutton']['url'] = 'admin/tokens/sa/index/surveyid/' . $iSurveyId;
// Close button
if (Yii::app()->request->getParam('action') == "remind") {
$aData['token_bar']['sendreminderbutton'] = true;
} else {
$aData['token_bar']['sendinvitationbutton'] = true;
// Invitation button
}
$aTokenIds = $tokenids;
if (empty($tokenids)) {
$aTokenIds = Yii::app()->request->getPost('tokenids', false);
}
if (!empty($aTokenIds)) {
$aTokenIds = explode('|', $aTokenIds);
$aTokenIds = array_filter($aTokenIds);
$aTokenIds = array_map('sanitize_int', $aTokenIds);
}
$aTokenIds = array_unique(array_filter((array) $aTokenIds));
$sSubAction = Yii::app()->request->getParam('action', 'invite');
$sSubAction = !in_array($sSubAction, array('invite', 'remind')) ? 'invite' : $sSubAction;
$bEmail = $sSubAction == 'invite';
Yii::app()->loadHelper('surveytranslator');
Yii::app()->loadHelper('/admin/htmleditor');
Yii::app()->loadHelper('replacements');
$token = Token::model($iSurveyId)->find();
$aExampleRow = isset($token) ? $token->attributes : array();
$aSurveyLangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyId)->language;
array_unshift($aSurveyLangs, $sBaseLanguage);
$aTokenFields = getTokenFieldsAndNames($iSurveyId, true);
$iAttributes = 0;
$bHtml = getEmailFormat($iSurveyId) == 'html';
$timeadjust = Yii::app()->getConfig("timeadjust");
$aData['thissurvey'] = getSurveyInfo($iSurveyId);
foreach ($aSurveyLangs as $sSurveyLanguage) {
$aData['thissurvey'][$sSurveyLanguage] = getSurveyInfo($iSurveyId, $sSurveyLanguage);
}
$aData['surveyid'] = $iSurveyId;
$aData['sSubAction'] = $sSubAction;
$aData['bEmail'] = $bEmail;
$aData['aSurveyLangs'] = $aData['surveylangs'] = $aSurveyLangs;
$aData['baselang'] = $sBaseLanguage;
$aData['tokenfields'] = array_keys($aTokenFields);
$aData['nrofattributes'] = $iAttributes;
$aData['examplerow'] = $aExampleRow;
$aData['tokenids'] = $aTokenIds;
$aData['ishtml'] = $bHtml;
$iMaxEmails = Yii::app()->getConfig('maxemails');
if (Yii::app()->request->getPost('bypassbademails') == '1') {
$SQLemailstatuscondition = "emailstatus = 'OK'";
} else {
$SQLemailstatuscondition = "emailstatus <> 'OptOut'";
}
if (!Yii::app()->request->getPost('ok')) {
// Fill empty email template by default text
foreach ($aSurveyLangs as $sSurveyLanguage) {
$aData['thissurvey'][$sSurveyLanguage] = getSurveyInfo($iSurveyId, $sSurveyLanguage);
$bDefaultIsNeeded = empty($aData['surveylangs'][$sSurveyLanguage]["email_{$sSubAction}"]) || empty($aData['surveylangs'][$sSurveyLanguage]["email_{$sSubAction}_subj"]);
if ($bDefaultIsNeeded) {
$sNewlines = $bHtml ? 'html' : 'text';
// This broke included style for admin_detailed_notification
$aDefaultTexts = templateDefaultTexts($sSurveyLanguage, 'unescaped', $sNewlines);
if (empty($aData['thissurvey'][$sSurveyLanguage]["email_{$sSubAction}"])) {
if ($sSubAction == 'invite') {
$aData['thissurvey'][$sSurveyLanguage]["email_{$sSubAction}"] = $aDefaultTexts["invitation"];
} elseif ($sSubAction == 'remind') {
$aData['thissurvey'][$sSurveyLanguage]["email_{$sSubAction}"] = $aDefaultTexts["reminder"];
}
}
}
}
if (empty($aData['tokenids'])) {
$aTokens = TokenDynamic::model($iSurveyId)->findUninvitedIDs($aTokenIds, 0, $bEmail, $SQLemailstatuscondition);
foreach ($aTokens as $aToken) {
$aData['tokenids'][] = $aToken;
}
}
$this->_renderWrappedTemplate('token', array($sSubAction), $aData);
} else {
//.........这里部分代码省略.........