本文整理汇总了PHP中Docs::getEmailTemplates方法的典型用法代码示例。如果您正苦于以下问题:PHP Docs::getEmailTemplates方法的具体用法?PHP Docs::getEmailTemplates怎么用?PHP Docs::getEmailTemplates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Docs
的用法示例。
在下文中一共展示了Docs::getEmailTemplates方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paramRules
public function paramRules()
{
$parentRules = parent::paramRules();
$parentRules['options'] = array_merge($parentRules['options'], array(array('name' => 'to', 'label' => Yii::t('studio', 'To:'), 'type' => 'email'), array('name' => 'template', 'label' => Yii::t('studio', 'Template'), 'type' => 'dropdown', 'defaultVal' => '', 'options' => array('' => Yii::t('studio', 'Custom')) + Docs::getEmailTemplates('email', 'Contacts')), array('name' => 'subject', 'label' => Yii::t('studio', 'Subject'), 'optional' => 1), array('name' => 'cc', 'label' => Yii::t('studio', 'CC:'), 'optional' => 1, 'type' => 'email'), array('name' => 'bcc', 'label' => Yii::t('studio', 'BCC:'), 'optional' => 1, 'type' => 'email'), array('name' => 'body', 'label' => Yii::t('studio', 'Message'), 'optional' => 1, 'type' => 'richtext')));
return $parentRules;
}
示例2: array
echo $form->textField($this->model, 'bcc', array('id' => 'email-bcc', 'tabindex' => '3'));
?>
</div>
</div>
<div class="row email-input-row">
<?php
//echo $form->label($this->model, 'subject', array('class' => 'x2-email-label'));
echo $form->textField($this->model, 'subject', array('tabindex' => '4', 'class' => 'x2-default-field', 'data-default-text' => CHtml::encode(Yii::t('app', 'Subject'))));
?>
</div>
<?php
if (!$this->disableTemplates) {
?>
<div class="row email-input-row">
<?php
$templateList = Docs::getEmailTemplates($type, $associationType);
$target = $this->model->targetModel;
echo $form->label($this->model, 'template', array('class' => 'x2-email-label'));
if (!isset($this->template) && $target instanceof Quote && isset($target->template) && !isset($this->model->template)) {
// When sending an InlineEmail targeting a Quote
list($templateName, $selectedTemplate) = Fields::nameAndId($target->template);
$this->model->template = $selectedTemplate;
}
echo $form->dropDownList($this->model, 'template', array('0' => Yii::t('docs', 'Custom Message')) + $templateList, array('id' => 'email-template'));
?>
</div>
<?php
}
?>
<div class="row" id="email-message-box">
<?php
示例3: paramRules
public function paramRules()
{
$parentRules = parent::paramRules();
$parentRules['options'] = array_merge($parentRules['options'], array(array('name' => 'to', 'label' => Yii::t('studio', 'To:'), 'type' => 'email'), array('name' => 'template', 'label' => Yii::t('studio', 'Template'), 'type' => 'dropdown', 'defaultVal' => '', 'options' => array('' => Yii::t('studio', 'Custom')) + Docs::getEmailTemplates('email', 'Contacts')), array('name' => 'subject', 'label' => Yii::t('studio', 'Subject'), 'optional' => 1), array('name' => 'cc', 'label' => Yii::t('studio', 'CC:'), 'optional' => 1, 'type' => 'email'), array('name' => 'bcc', 'label' => Yii::t('studio', 'BCC:'), 'optional' => 1, 'type' => 'email'), array('name' => 'logEmail', 'label' => Yii::t('studio', 'Log email?') . ' ' . X2Html::hint2(Yii::t('studio', 'Checking this box will cause the email to be attached ' . 'to the record associated with this flow, if it exists.')), 'optional' => 1, 'defaultVal' => 1, 'type' => 'boolean'), array('name' => 'body', 'label' => Yii::t('studio', 'Message'), 'optional' => 1, 'type' => 'richtext')));
return $parentRules;
}
示例4: run
public function run()
{
if (Yii::app()->user->isGuest) {
Yii::app()->controller->redirect(Yii::app()->controller->createUrl('/site/login'));
}
$this->attachBehaviors($this->behaviors);
// Safety net of handlers - they ensure that errors can be caught and seen easily:
$scenario = 'custom';
if (empty($this->model)) {
$model = new InlineEmail();
} else {
$model = $this->model;
}
if (isset($_POST['contactFlag'])) {
$model->contactFlag = $_POST['contactFlag'];
}
$makeEvent = isset($_GET['skipEvent']) ? !(bool) $_GET['skipEvent'] : 1;
// Check to see if the user is requesting a new template
if (isset($_GET['template'])) {
$scenario = 'template';
}
$model->setScenario($scenario);
$attachments = array();
if (isset($_POST['InlineEmail'])) {
// This could indicate either a template change or a form submission.
$model->attributes = $_POST['InlineEmail'];
// Prepare attachments that may have been uploaded on-the-fly (?)
$mediaLibraryUsed = false;
// is there an attachment from the media library?
if (isset($_POST['AttachmentFiles'], $_POST['AttachmentFiles']['id'], $_POST['AttachmentFiles']['types'])) {
$ids = $_POST['AttachmentFiles']['id'];
$types = $_POST['AttachmentFiles']['types'];
$attachments = array();
for ($i = 0; $i < count($ids); $i++) {
$type = $types[$i];
switch ($type) {
case 'temp':
// attachment is a temp file
$tempFile = TempFile::model()->findByPk($ids[$i]);
$attachments[] = array('filename' => $tempFile->name, 'folder' => $tempFile->folder, 'type' => $type, 'id' => $tempFile->id);
break;
case 'media':
// attachment is from media library
$mediaLibraryUsed = true;
$media = Media::model()->findByPk($ids[$i]);
$attachments[] = array('filename' => $media->fileName, 'folder' => $media->uploadedBy, 'type' => $type, 'id' => $media->id);
break;
default:
throw new CException('Invalid attachment type: ' . $type);
}
}
}
$model->attachments = $attachments;
// Validate/prepare the body, and send if no problems occur:
$sendStatus = array_fill_keys(array('code', 'message'), '');
$failed = false;
$message = '';
$postReplace = isset($_GET['postReplace']) ? $_GET['postReplace'] : 0;
if (isset($_GET['loadTemplate'])) {
// A special override for when it's not possible to include the template in $_POST
$model->template = $_GET['loadTemplate'];
}
if ($model->prepareBody($postReplace)) {
if ($scenario != 'template') {
// Sending the email, not merely requesting a template change
//
// First check that the user has permission to use the
// specified credentials:
if ($model->credId != Credentials::LEGACY_ID) {
if (!Yii::app()->user->checkAccess('CredentialsSelect', array('model' => $model->credentials))) {
$this->respond(Yii::t('app', 'Did not send email because you do not have ' . 'permission to use the specified credentials.'), 1);
}
}
$sendStatus = $model->send($makeEvent);
// $sendStatus = array('code'=>'200','message'=>'sent (testing)');
$failed = $sendStatus['code'] != '200';
$message = $sendStatus['message'];
} else {
if ($model->modelName == 'Quote' && empty($model->template)) {
// Fill in the gap with the default / "semi-legacy" quotes view
$model->message = $this->controller->renderPartial('application.modules.quotes.views.quotes.print', array('model' => $model->targetModel, 'email' => true), true);
// Add a linebreak at the beginning for user-entered notes in the email:
$model->insertInBody('<br />', 1);
}
}
}
// Populate response data:
$modelHasErrors = $model->hasErrors();
$failed = $failed || $modelHasErrors;
$response = array('scenario' => $scenario, 'sendStatus' => $sendStatus, 'attributes' => $model->attributes, 'modelErrors' => $model->errors, 'modelHasErrors' => $modelHasErrors, 'modelErrorHtml' => CHtml::errorSummary($model, Yii::t('app', "Please fix the following errors:"), null, array('style' => 'margin-bottom: 5px;')));
if ($scenario == 'template') {
// There's a chance the inline email form is switching gears into
// quote mode, in which case we need to include templates and
// insertable attributes for setting it all up properly:
$response['insertableAttributes'] = $model->insertableAttributes;
$templates = array(0 => Yii::t('docs', 'Custom Message')) + Docs::getEmailTemplates($model->modelName == 'Quote' ? 'quote' : 'email', $_POST['associationType']);
$response['templateList'] = array();
foreach ($templates as $id => $templateName) {
$response['templateList'][] = array('id' => $id, 'name' => $templateName);
}
//.........这里部分代码省略.........
示例5: array
break;
}
});
$("#Campaign_type").each(function(){
if($(this).val() != "Email")
$("#Campaign_sendAs").parents(".formItem").hide();
});
$("#Campaign_type").change ();
}) ();
', CClientScript::POS_READY);
$this->renderPartial('application.components.views._form', array('model' => $model, 'users' => User::getNames(), 'form' => $form, 'modelName' => 'Campaign', 'specialFields' => array('template' => CHtml::activeDropDownList($model, 'template', array('0' => Yii::t('docs', 'Custom Message')) + Docs::getEmailTemplates('email', 'Contacts'), array('title' => $model->getAttributeLabel('template'), 'id' => 'Campaign_templateDropdown')))));
?>
<div id="attachments-container">
<h2><?php
echo Yii::t('app', 'Attachments');
?>
</h2>
<div id="campaign-attachments-wrapper" class="x2-layout form-view x2-hint"
title="<?php
echo addslashes(Yii::t('app', 'Drag files from the Files Widget here.'));
?>
">