本文整理汇总了PHP中Docs::modelsWhichSupportEmailTemplates方法的典型用法代码示例。如果您正苦于以下问题:PHP Docs::modelsWhichSupportEmailTemplates方法的具体用法?PHP Docs::modelsWhichSupportEmailTemplates怎么用?PHP Docs::modelsWhichSupportEmailTemplates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Docs
的用法示例。
在下文中一共展示了Docs::modelsWhichSupportEmailTemplates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$quoteAttributes[$Quote . Yii::t('quotes', "Date printed/emailed")] = '{dateNow}';
$quoteAttributes[$Quote . Yii::t('quotes', '{quote} or Invoice', array('{quote}' => $modTitles['quote']))] = '{quoteOrInvoice}';
foreach (Quote::model()->getAttributeLabels() as $fieldName => $label) {
$index = $Quote . "{$label}";
$quoteAttributes[$index] = "{" . $fieldName . "}";
}
}
if ($model->type === 'email') {
$js = 'x2.insertableAttributes = ' . CJSON::encode(array(Yii::t('contacts', '{contact} Attributes', array('{contact}' => $modTitles['contact'])) => $attributes)) . ';';
} else {
$js = 'x2.insertableAttributes = ' . CJSON::encode(array(Yii::t('docs', '{contact} Attributes', array('{contact}' => $modTitles['contact'])) => $contactAttributes, Yii::t('docs', '{account} Attributes', array('{account}' => $modTitles['account'])) => $accountAttributes, Yii::t('docs', '{quote} Attributes', array('{quote}' => $modTitles['quote'])) => $quoteAttributes)) . ';';
}
}
if ($model->type === 'email') {
// allowable association types
$associationTypeOptions = Docs::modelsWhichSupportEmailTemplates();
// insertable attributes by model type
$insertableAttributes = array();
foreach ($associationTypeOptions as $modelName => $label) {
$insertableAttributes[$modelName] = array();
foreach (X2Model::model($modelName)->getAttributeLabels() as $fieldName => $label) {
$insertableAttributes[$modelName][$label] = '{' . $fieldName . '}';
}
}
Yii::app()->clientScript->registerScript('createEmailTemplateJS', "\n\n;(function () {\n\nvar insertableAttributes = " . CJSON::encode($insertableAttributes) . ";\n\n// reinitialize ckeditor instance with new set of insertable attributes whenever the record type\n// selector is changed\n\$('#email-association-type').change (function () {\n \n var data = window.docEditor.getData ();\n window.docEditor.destroy (true);\n \$('#input').val (data);\n var recordInsertableAttributes = {};\n recordInsertableAttributes[\$(this).val () + ' Attributes'] = \n insertableAttributes[\$(this).val ()];\n instantiateDocEditor (recordInsertableAttributes);\n});\n\n}) ();\n\n");
}
$js .= '
var typingTimer;
function autosave() {
window.docEditor.updateElement();
示例2: init
public function init()
{
$this->disableTemplates = $this->disableTemplates || in_array($this->associationType, array_keys(Docs::modelsWhichSupportEmailTemplates()));
// Prepare the model for initially displayed input:
$this->model = new InlineEmail();
if (isset($this->targetModel)) {
$this->model->targetModel = $this->targetModel;
}
if (!$this->associationType) {
$this->associationType = X2Model::getModelName(Yii::app()->controller->module->name);
}
// Bring in attributes set in the configuration:
$this->model->attributes = $this->attributes;
if (empty($this->template)) {
// check for a default template
$defaultTemplateId = Yii::app()->params->profile->getDefaultEmailTemplate(Yii::app()->controller->module->name);
// if there's a default set for this module
if ($defaultTemplateId !== null) {
$defaultTemplateDoc = Docs::model()->findByPk($defaultTemplateId);
// ensure that template is still a valid default
if ($defaultTemplateDoc && ($defaultTemplateDoc->associationType === $this->associationType || $defaultTemplateDoc->type === 'quote' && $this->model->targetModel instanceof Quote)) {
$this->template = $defaultTemplateId;
}
}
}
if (empty($this->template)) {
if (empty($this->model->message)) {
$this->model->message = InlineEmail::emptyBody();
}
$this->model->insertSignature();
} else {
// Fill in the body with a template:
$this->model->scenario = 'template';
if (!empty($this->template)) {
$this->model->template = $this->template;
}
$this->model->prepareBody();
}
// If insertable attributes aren't set, use the inline email model's
// getInsertableAttributes() method to generate them.
if ((bool) $this->model->targetModel && !isset($this->insertableAttributes)) {
$this->insertableAttributes = $this->model->insertableAttributes;
}
$this->registerJSClassInstantiation();
// Load resources:
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/ckeditor/ckeditor.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/ckeditor/adapters/jquery.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/emailEditor.js');
if (!empty($this->insertableAttributes)) {
Yii::app()->clientScript->registerScript('setInsertableAttributes', 'x2.insertableAttributes = ' . CJSON::encode($this->insertableAttributes) . ';', CClientScript::POS_HEAD);
}
Yii::app()->clientScript->registerScript('storeOriginalInlineEmailMessage', 'x2.inlineEmailOriginalBody = $("#email-message").val();', CClientScript::POS_READY);
//'.CJSON::encode($this->model->message).';',CClientScript::POS_READY);
Yii::app()->clientScript->registerScript('toggleEmailForm', $this->startHidden ? "window.hideInlineEmail = true;\n" : "window.hideInlineEmail = false;\n", CClientScript::POS_HEAD);
$this->registerPackages();
parent::init();
}