本文整理汇总了PHP中MailTemplate类的典型用法代码示例。如果您正苦于以下问题:PHP MailTemplate类的具体用法?PHP MailTemplate怎么用?PHP MailTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MailTemplate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: order
public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $adminNotifyTplID = 'admin_purchase_notify', $customerNotifyTplID = 'user_purchase_notify')
{
global $db;
$user = \cf\User::getLoggedIn();
$productList = '';
$products = \cf\api\cart\getList();
if (!array_key_exists('contents', $products) || !count($products['contents'])) {
return false;
}
$tpl = new MailTemplate('order');
execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :contents)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'contents' => $tpl->parseBody(array('cart' => $products))));
$orderId = $db->lastInsertId();
$msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => $products['total'], 'products' => $products['contents']);
\cf\api\cart\clear();
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
if ($adminNotifyTplID) {
$tpl = new MailTemplate($adminNotifyTplID);
$mail->Subject = $tpl->parseSubject($msgParams);
$mail->MsgHTML($tpl->parseBody($msgParams));
foreach ($tpl->recipients() as $address) {
$mail->addAddress($address);
}
$mail->Send();
}
$mail->clearAddresses();
if ($customerNotifyTplID && $email) {
$tpl = new MailTemplate($customerNotifyTplID);
$mail->Subject = $tpl->parseSubject($msgParams);
$mail->MsgHTML($tpl->parseBody($msgParams));
$mail->addAddress($email);
$mail->Send();
}
return $orderId;
}
开发者ID:sd-studio,项目名称:sh,代码行数:35,代码来源:cart.php
示例2: display
/**
* Display the form
* @param $request Request
* @param $dispatcher Dispatcher
*/
function display($request, $dispatcher)
{
$templateMgr =& TemplateManager::getManager($request);
// Add extra style sheets required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
$templateMgr->addStyleSheet($request->getBaseUrl() . '/styles/ojs.css');
// Add extra java script required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
$templateMgr->addJavaScript('lib/pkp/js/grid-clickhandler.js');
$templateMgr->addJavaScript('lib/pkp/js/modal.js');
$templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/validate/jquery.validate.min.js');
$templateMgr->addJavaScript('lib/pkp/js/jqueryValidatorI18n.js');
import('classes.mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr->assign('submissionAckEnabled', true);
}
// Citation editor filter configuration
//
// 1) Check whether PHP5 is available.
if (!checkPhpVersion('5.0.0')) {
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION));
$citationEditorError = 'submission.citations.editor.php5Required';
} else {
$citationEditorError = null;
}
$templateMgr->assign('citationEditorError', $citationEditorError);
if (!$citationEditorError) {
// 2) Add the filter grid URLs
$parserFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.ParserFilterGridHandler', 'fetchGrid');
$templateMgr->assign('parserFilterGridUrl', $parserFilterGridUrl);
$lookupFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.LookupFilterGridHandler', 'fetchGrid');
$templateMgr->assign('lookupFilterGridUrl', $lookupFilterGridUrl);
// 3) Create a list of all available citation output filters.
$router =& $request->getRouter();
$journal =& $router->getContext($request);
import('lib.pkp.classes.metadata.MetadataDescription');
$inputSample = new MetadataDescription('lib.pkp.classes.metadata.nlm.NlmCitationSchema', ASSOC_TYPE_CITATION);
$outputSample = 'any string';
$filterDao =& DAORegistry::getDAO('FilterDAO');
$metaCitationOutputFilterObjects =& $filterDao->getCompatibleObjects($inputSample, $outputSample, $journal->getId());
foreach ($metaCitationOutputFilterObjects as $metaCitationOutputFilterObject) {
$metaCitationOutputFilters[$metaCitationOutputFilterObject->getId()] = $metaCitationOutputFilterObject->getDisplayName();
}
$templateMgr->assign_by_ref('metaCitationOutputFilters', $metaCitationOutputFilters);
}
$currencyDao =& DAORegistry::getDAO('CurrencyDAO');
$currencies =& $currencyDao->getCurrencies();
$currenciesArray = array();
foreach ($currencies as $currency) {
$currenciesArray[$currency->getCodeAlpha()] = $currency->getName() . ' (' . $currency->getCodeAlpha() . ')';
}
$templateMgr->assign('currencies', $currenciesArray);
$originalSourceCurrencyAlpha = $journal->getSetting('sourceCurrency');
$originalSourceCurrency = $currencyDao->getCurrencyByAlphaCode($originalSourceCurrencyAlpha);
$templateMgr->assign('originalSourceCurrency', $originalSourceCurrency->getName() . ' (' . $originalSourceCurrencyAlpha . ')');
$proposalSourceDao =& DAORegistry::getDAO('ProposalSourceDAO');
$templateMgr->assign('countSources', $proposalSourceDao->countSources());
parent::display($request, $dispatcher);
}
开发者ID:JovanyJeff,项目名称:hrp,代码行数:65,代码来源:JournalSetupStep3Form.inc.php
示例3: requestBookForReview
/**
* Author requests a book for review.
*/
function requestBookForReview($args = array(), $request)
{
$this->setupTemplate($request);
if (empty($args)) {
$request->redirect(null, 'user');
}
$bfrPlugin = PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
$journal = $request->getJournal();
$journalId = $journal->getId();
$bookId = (int) $args[0];
$bfrDao = DAORegistry::getDAO('BookForReviewDAO');
// Ensure book for review is for this journal
if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
import('lib.pkp.classes.mail.MailTemplate');
$email = new MailTemplate('BFR_BOOK_REQUESTED');
$send = $request->getUserVar('send');
// Author has filled out mail form or decided to skip email
if ($send && !$email->hasErrors()) {
// Update book for review as requested
$book = $bfrDao->getBookForReview($bookId);
$status = $book->getStatus();
$bfrPlugin->import('classes.BookForReview');
// Ensure book for review is avaliable
if ($status == BFR_STATUS_AVAILABLE) {
$user = $request->getUser();
$userId = $user->getId();
$book->setStatus(BFR_STATUS_REQUESTED);
$book->setUserId($userId);
$book->setDateRequested(date('Y-m-d H:i:s', time()));
$bfrDao->updateObject($book);
$email->send();
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationManager->createTrivialNotification($userId, NOTIFICATION_TYPE_BOOK_REQUESTED);
}
$request->redirect(null, 'author', 'booksForReview');
// Display mail form for author
} else {
if (!$request->getUserVar('continued')) {
$book = $bfrDao->getBookForReview($bookId);
$status = $book->getStatus();
$bfrPlugin->import('classes.BookForReview');
// Ensure book for review is avaliable
if ($status == BFR_STATUS_AVAILABLE) {
$user = $request->getUser();
$userId = $user->getId();
$editorFullName = $book->getEditorFullName();
$editorEmail = $book->getEditorEmail();
$paramArray = array('editorName' => strip_tags($editorFullName), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'authorContactSignature' => String::html2text($user->getContactSignature()));
$email->addRecipient($editorEmail, $editorFullName);
$email->assignParams($paramArray);
}
$returnUrl = $request->url(null, 'author', 'requestBookForReview', $bookId);
$email->displayEditForm($returnUrl);
}
}
}
$request->redirect(null, 'booksForReview');
}
开发者ID:utlib,项目名称:ojs,代码行数:62,代码来源:BooksForReviewAuthorHandler.inc.php
示例4: fetch
/**
* @copydoc Form::fetch()
*/
function fetch($request, $params = null)
{
$templateMgr = TemplateManager::getManager($request);
import('lib.pkp.classes.mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
$templateMgr->assign('submissionAckDisabled', !$mail->isEnabled());
return parent::fetch($request, $params);
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:11,代码来源:SubmissionStageForm.inc.php
示例5: display
/**
* Display the form
*/
function display()
{
import('mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('submissionAckEnabled', true);
}
parent::display();
}
开发者ID:philschatz,项目名称:ojs,代码行数:13,代码来源:JournalSetupStep3Form.inc.php
示例6: _getBody
function _getBody($name_template, $params)
{
// Cargar Template y setear parametros
$template = new MailTemplate($name_template, $path);
// Cargar los parametros y obtener el cuerpo del mensaje
$template->setParams($params);
$body = $template->getTemplate();
// Devolver string con el c�digo HTML con los par�metros seteados
return $body;
}
开发者ID:Nilphy,项目名称:moteguardian,代码行数:10,代码来源:clase.MailHelper.php
示例7: sendReminder
function sendReminder($subscription, $journal, $emailKey)
{
$userDao = DAORegistry::getDAO('UserDAO');
$subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
$journalName = $journal->getLocalizedName();
$user = $userDao->getById($subscription->getUserId());
if (!isset($user)) {
return false;
}
$subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
$subscriptionName = $journal->getSetting('subscriptionName');
$subscriptionEmail = $journal->getSetting('subscriptionEmail');
$subscriptionPhone = $journal->getSetting('subscriptionPhone');
$subscriptionMailingAddress = $journal->getSetting('subscriptionMailingAddress');
$subscriptionContactSignature = $subscriptionName;
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_COMMON);
if ($subscriptionMailingAddress != '') {
$subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
}
if ($subscriptionPhone != '') {
$subscriptionContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $subscriptionPhone;
}
$subscriptionContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $subscriptionEmail;
$paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'expiryDate' => $subscription->getDateEnd(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
import('lib.pkp.classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey, $journal->getPrimaryLocale(), $journal, false);
$mail->setReplyTo($subscriptionEmail, $subscriptionName);
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
开发者ID:mariojp,项目名称:ojs,代码行数:33,代码来源:SubscriptionExpiryReminder.inc.php
示例8:
/**
* Helper Function - set mail from address
* @param MailTemplate $mail
*/
function _setMailFrom(&$mail)
{
$site =& Request::getSite();
$journal =& Request::getJournal();
// Set the sender based on the current context
if ($journal && $journal->getSetting('supportEmail')) {
$mail->setFrom($journal->getSetting('supportEmail'), $journal->getSetting('supportName'));
} else {
$mail->setFrom($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
}
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:15,代码来源:LoginHandler.inc.php
示例9:
/**
* Helper Function - set mail from address
* @param $request PKPRequest
* @param MailTemplate $mail
*/
function _setMailFrom($request, &$mail)
{
$site = $request->getSite();
$press = $request->getPress();
// Set the sender based on the current context
if ($press && $press->getSetting('supportEmail')) {
$mail->setReplyTo($press->getSetting('supportEmail'), $press->getSetting('supportName'));
} else {
$mail->setReplyTo($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
}
}
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:16,代码来源:LoginHandler.inc.php
示例10: elseif
/**
* Helper Function - set mail from address
* @param MailTemplate $mail
*/
function _setMailFrom(&$mail)
{
$site =& Request::getSite();
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
// Set the sender to one of three different settings, based on context
if ($schedConf && $schedConf->getSetting('supportEmail')) {
$mail->setFrom($schedConf->getSetting('supportEmail'), $schedConf->getSetting('supportName'));
} elseif ($conference && $conference->getSetting('contactEmail')) {
$mail->setFrom($conference->getSetting('contactEmail'), $conference->getSetting('contactName'));
} else {
$mail->setFrom($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
}
}
开发者ID:jalperin,项目名称:ocs,代码行数:18,代码来源:LoginHandler.inc.php
示例11: display
/**
* Display the form
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
import('mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr->assign('submissionAckEnabled', true);
}
if ($this->_data['reviewDeadlineType'] == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
$templateMgr->assign('absoluteReviewDate', $this->_data['numWeeksPerReviewAbsolute']);
}
if (Config::getVar('general', 'scheduled_tasks')) {
$templateMgr->assign('scheduledTasksEnabled', true);
}
parent::display();
}
开发者ID:jalperin,项目名称:ocs,代码行数:19,代码来源:SchedConfSetupStep3Form.inc.php
示例12: loadModel
/**
* Возвращает модель по указанному идентификатору
* Если модель не будет найдена - возникнет HTTP-исключение.
*
* @param integer $id - идентификатор нужной модели
*
* @return class $model
*
* @throws CHttpException
*/
public function loadModel($id)
{
if (($model = MailTemplate::model()->findByPk($id)) === null) {
throw new CHttpException(404, Yii::t('MailModule.mail', 'Requested page was not found'));
}
return $model;
}
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:17,代码来源:TemplateBackendController.php
示例13: raise
public function raise($alias, $recipients, $params = array(), $subject = '')
{
if (!is_array($recipients)) {
$recipients = array($recipients);
}
Toolkit::i()->mail->ClearAddresses();
Toolkit::i()->mail->From = $this->fromEmail;
Toolkit::i()->mail->FromName = $this->fromName;
foreach ($recipients as $email) {
Toolkit::i()->mail->AddAddress($email);
}
Toolkit::i()->mail->Subject = $subject;
$emailTemplate = new MailTemplate($params);
Toolkit::i()->mail->SetHtmlBody($emailTemplate->fetch($alias));
return Toolkit::i()->mail->Send();
}
开发者ID:ruxon,项目名称:framework,代码行数:16,代码来源:EmailEvent.class.php
示例14: sendReminder
/**
* Send email to a book for review author
*/
function sendReminder($book, $journal, $emailKey)
{
$journalId = $journal->getId();
$paramArray = array('authorName' => strip_tags($book->getUserFullName()), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'bookForReviewDueDate' => date('l, F j, Y', strtotime($book->getDateDue())), 'submissionUrl' => Request::url(null, 'author', 'submit'), 'editorialContactSignature' => strip_tags($book->getEditorContactSignature()));
import('classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey);
$mail->setReplyTo($book->getEditorEmail(), $book->getEditorFullName());
$mail->addRecipient($book->getUserEmail(), $book->getUserFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:16,代码来源:BooksForReviewReminder.inc.php
示例15: display
/**
* Display the form
* @param $request Request
* @param $dispatcher Dispatcher
*/
function display($request, $dispatcher)
{
$templateMgr =& TemplateManager::getManager($request);
// Add extra style sheets required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
$templateMgr->addStyleSheet($request->getBaseUrl() . '/styles/ojs.css');
// Add extra java script required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
$templateMgr->addJavaScript('lib/pkp/js/functions/grid-clickhandler.js');
$templateMgr->addJavaScript('lib/pkp/js/functions/modal.js');
$templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/validate/jquery.validate.min.js');
$templateMgr->addJavaScript('lib/pkp/js/functions/jqueryValidatorI18n.js');
import('classes.mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr->assign('submissionAckEnabled', true);
}
// Citation editor filter configuration
//
// 1) Check whether PHP5 is available.
if (!checkPhpVersion('5.0.0')) {
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION));
$citationEditorError = 'submission.citations.editor.php5Required';
} else {
$citationEditorError = null;
}
$templateMgr->assign('citationEditorError', $citationEditorError);
if (!$citationEditorError) {
// 2) Add the filter grid URLs
$parserFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.ParserFilterGridHandler', 'fetchGrid');
$templateMgr->assign('parserFilterGridUrl', $parserFilterGridUrl);
$lookupFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.LookupFilterGridHandler', 'fetchGrid');
$templateMgr->assign('lookupFilterGridUrl', $lookupFilterGridUrl);
// 3) Create a list of all available citation output filters.
$router =& $request->getRouter();
$journal =& $router->getContext($request);
$filterDao =& DAORegistry::getDAO('FilterDAO');
/* @var $filterDao FilterDAO */
$metaCitationOutputFilterObjects =& $filterDao->getObjectsByGroup('nlm30-element-citation=>plaintext', $journal->getId());
foreach ($metaCitationOutputFilterObjects as $metaCitationOutputFilterObject) {
$metaCitationOutputFilters[$metaCitationOutputFilterObject->getId()] = $metaCitationOutputFilterObject->getDisplayName();
}
$templateMgr->assign_by_ref('metaCitationOutputFilters', $metaCitationOutputFilters);
}
parent::display($request, $dispatcher);
}
开发者ID:ramonsodoma,项目名称:ojs,代码行数:51,代码来源:JournalSetupStep3Form.inc.php
示例16: actionPerform
function actionPerform(&$skin, $moduleID)
{
$usernameError = '';
if (isset($_POST["event"]) && $_POST["event"] == 'forgetPassword') {
//Check username
//Inorder to avoid sql injection attacks both
//should contains characters form a to z and/or numbers only
if (isset($_POST["username"]) && (!$skin->main->checkString('[^a-zA-Z0-9]', $_POST["username"]) || $_POST["username"] == "")) {
$usernameError = "Username must contains numbers and/or character from a to z only";
} else {
$query = "SELECT * FROM {$skin->main->databaseTablePrefix}users WHERE username=" . $skin->main->databaseConnection->qstr($_POST["username"]);
$recordSet = $skin->main->databaseConnection->Execute($query);
$password = $this->randomNumber();
$record = array('password' => md5($password));
//Start Update Transaction
$skin->main->databaseConnection->StartTrans();
$updateSQL = $skin->main->databaseConnection->GetUpdateSQL($recordSet, $record);
$skin->main->databaseConnection->Execute($updateSQL);
$recordSet2 = $skin->main->databaseConnection->Execute("SELECT * FROM {$skin->main->databaseTablePrefix}templates \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype='mail'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = 'forgetPasswordSubject'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = 'forgetPasswordBody'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)");
$templates = array('forgetPasswordSubject' => '', 'forgetPasswordBody' => '');
while (!$recordSet2->EOF) {
$templates[$recordSet2->fields["name"]] = $recordSet2->fields["content"];
$recordSet2->MoveNext();
}
$mailer = new Mailer($skin->main);
$mailTemplate = new MailTemplate($skin->main);
$mailTemplate->assign('username', $_POST["username"]);
$mailTemplate->assign('password', $password);
$mailer->addUserAddress($_POST["username"]);
$mailer->Subject = $mailTemplate->fetch('mail/forgetPasswordSubject');
$mailer->Body = $mailTemplate->fetch('mail/forgetPasswordBody');
$mailer->Send();
if ($mailer->ErrorInfo) {
//Transaction failed
$skin->main->databaseConnection->FailTrans();
trigger_error("Unable to send password remind mail. Reason is : " . $mailer->ErrorInfo);
}
//Complete update transaction
$skin->main->databaseConnection->CompleteTrans();
}
}
//Assign codeBehind variables
$skin->main->controlVariables["forgetPassword"] = array('usernameError' => $usernameError);
}
开发者ID:BackupTheBerlios,项目名称:alumni-online-svn,代码行数:44,代码来源:forgetPassword.php
示例17: order
public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $notifyGroup = 'admin', $notifyCustomer = true)
{
global $db;
$user = \cf\User::getLoggedIn();
$productList = '';
$products = \cf\api\cart\getList();
if (count($products) < 2) {
return false;
}
for ($i = 1; $i < count($products); ++$i) {
$productList .= "{$products[$i]['id']} {$products[$i]['name']} [{$products[$i]['price']}] - {$products[$i]['amount']} <br>";
}
$productList .= "<br><strong>Итого</strong>: {$products[0]['total_price']}";
execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :products)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'products' => $productList));
$orderId = $db->lastInsertId();
\cf\api\cart\clear();
$msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => array_shift($products), 'products' => $products);
if ($notifyGroup) {
$emails = query2vector("SELECT email FROM cf_users INNER JOIN cf_user_roles ON cf_users.id=cf_user_roles.user_id WHERE cf_user_roles.role_id=:id", array('id' => $notifyGroup));
if (!empty($emails)) {
$tpl = new MailTemplate('admin_purchase_notify');
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->Subject = $tpl->parseSubject($msgParams);
$mail->MsgHTML($tpl->parseBody($msgParams));
foreach ($emails as $a) {
$mail->AddAddress($a);
}
$mail->Send();
}
}
if ($notifyCustomer && $email) {
$tpl = new MailTemplate('user_purchase_notify');
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->Subject = $tpl->parseSubject($msgParams);
$mail->MsgHTML($tpl->parseBody($msgParams));
$mail->AddAddress($email);
@$mail->Send();
}
return $orderId;
}
开发者ID:sd-studio,项目名称:or,代码行数:42,代码来源:cart.php
示例18: email
/**
* Send an email to a user or group of users.
*/
function email($args)
{
$this->validate();
$this->setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'journal.users.emailUsers');
$userDao =& DAORegistry::getDAO('UserDAO');
$site =& Request::getSite();
$journal =& Request::getJournal();
$user =& Request::getUser();
import('classes.mail.MailTemplate');
$email = new MailTemplate(Request::getUserVar('template'), Request::getUserVar('locale'));
if (Request::getUserVar('send') && !$email->hasErrors()) {
$email->send();
Request::redirect(null, Request::getRequestedPage());
} else {
$email->assignParams();
// FIXME Forces default parameters to be assigned (should do this automatically in MailTemplate?)
if (!Request::getUserVar('continued')) {
if (($groupId = Request::getUserVar('toGroup')) != '') {
// Special case for emailing entire groups:
// Check for a group ID and add recipients.
$groupDao =& DAORegistry::getDAO('GroupDAO');
$group =& $groupDao->getById($groupId);
if ($group && $group->getAssocId() == $journal->getId() && $group->getAssocType() == ASSOC_TYPE_JOURNAL) {
$groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
$memberships =& $groupMembershipDao->getMemberships($group->getId());
$memberships =& $memberships->toArray();
foreach ($memberships as $membership) {
$user =& $membership->getUser();
$email->addRecipient($user->getEmail(), $user->getFullName());
}
}
}
if (count($email->getRecipients()) == 0) {
$email->addRecipient($user->getEmail(), $user->getFullName());
}
}
$email->displayEditForm(Request::url(null, null, 'email'), array(), 'manager/people/email.tpl');
}
}
开发者ID:yuricampos,项目名称:ojs,代码行数:44,代码来源:ManagerHandler.inc.php
示例19: raise
public function raise($alias, $recipients, $params = array())
{
Loader::import('Modules.Main');
if (!is_array($recipients)) {
$recipients = array($recipients);
}
$event = Manager::getInstance()->getMapper('EmailObjectMapper')->findFirst(array('Criteria' => array('IsActive' => true, 'Alias' => $alias)));
if ($event->getId()) {
Toolkit::getInstance()->mail->ClearAddresses();
Toolkit::getInstance()->mail->From = Manager::getInstance()->getModule('Main')->config('FromEmail');
Toolkit::getInstance()->mail->FromName = Manager::getInstance()->getModule('Main')->config('FromName');
foreach ($recipients as $email) {
Toolkit::getInstance()->mail->AddAddress($email);
}
Toolkit::getInstance()->mail->Subject = $event->getSubject();
$emailTemplate = new MailTemplate($params);
Toolkit::getInstance()->mail->SetHtmlBody($emailTemplate->fetch($event->getAlias()));
return Toolkit::getInstance()->mail->Send();
}
return false;
}
开发者ID:ruxon,项目名称:framework,代码行数:21,代码来源:CmsEmailEvent.class.php
示例20: display
/**
* Display the form
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
import('mail.MailTemplate');
$mail = new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr->assign('submissionAckEnabled', true);
}
if ($this->_data['reviewDeadlineType'] == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
$templateMgr->assign('absoluteReviewDate', $this->_data['numWeeksPerReviewAbsolute']);
}
if (Config::getVar('general', 'scheduled_tasks')) {
$templateMgr->assign('scheduledTasksEnabled', true);
}
import('manager.form.TimelineForm');
$schedConf =& Request::getSchedConf();
list($earliestDate, $latestDate) = TimelineForm::getOutsideDates($schedConf);
$templateMgr->assign('firstYear', strftime('%Y', $earliestDate));
$templateMgr->assign('lastYear', strftime('%Y', $latestDate));
parent::display();
}
开发者ID:sedici,项目名称:ocs,代码行数:24,代码来源:SchedConfSetupStep3Form.inc.php
注:本文中的MailTemplate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论