当前位置: 首页>>代码示例>>PHP>>正文


PHP MailTemplate类代码示例

本文整理汇总了PHP中MailTemplate的典型用法代码示例。如果您正苦于以下问题:PHP MailTemplate类的具体用法?PHP MailTemplate怎么用?PHP MailTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MailTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的MailTemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。