本文整理汇总了PHP中MailTemplate::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP MailTemplate::getBody方法的具体用法?PHP MailTemplate::getBody怎么用?PHP MailTemplate::getBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailTemplate
的用法示例。
在下文中一共展示了MailTemplate::getBody方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendNotification
function sendNotification($users, $journal, $issue)
{
if ($users->getCount() != 0) {
import('lib.pkp.classes.mail.MailTemplate');
$email = new MailTemplate('OPEN_ACCESS_NOTIFY', $journal->getPrimaryLocale());
$email->setSubject($email->getSubject($journal->getPrimaryLocale()));
$email->setReplyTo(null);
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$paramArray = array('journalName' => $journal->getLocalizedName(), 'journalUrl' => Request::url($journal->getPath()), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedName());
$email->assignParams($paramArray);
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticles = $publishedArticleDao->getPublishedArticlesInSections($issue->getId());
$mimeBoundary = '==boundary_' . md5(microtime());
$templateMgr = TemplateManager::getManager();
$templateMgr->assign('body', $email->getBody($journal->getPrimaryLocale()));
$templateMgr->assign('templateSignature', $journal->getSetting('emailSignature'));
$templateMgr->assign('mimeBoundary', $mimeBoundary);
$templateMgr->assign('issue', $issue);
$templateMgr->assign('publishedArticles', $publishedArticles);
$email->addHeader('MIME-Version', '1.0');
$email->setContentType('multipart/alternative; boundary="' . $mimeBoundary . '"');
$email->setBody($templateMgr->fetch('subscription/openAccessNotifyEmail.tpl'));
while ($user = $users->next()) {
$email->addBcc($user->getEmail(), $user->getFullName());
}
$email->send();
}
}
示例2: 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();
}
示例3: 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();
}
示例4: addTemplate
public function addTemplate(MailTemplate $templateToAdd)
{
$database = Database::getInstance();
if (!$database->isConnected()) {
return false;
}
$name = $database->escapeString($templateToAdd->getName());
$subject = $database->escapeString($templateToAdd->getSubject());
$body = $database->escapeString($templateToAdd->getBody());
$senderName = $database->escapeString($templateToAdd->getSenderName());
$senderEmail = $database->escapeString($templateToAdd->getSenderEmail());
$modifier = $database->escapeString($templateToAdd->getModifier());
if (!$database->insertData('mailTemplate', 'name, subject, body, senderName, senderEmail, modifier', "'{$name}', '{$subject}', '{$body}', '{$senderName}', '{$senderEmail}', {$modifier}")) {
return false;
}
return true;
}
示例5: sendReminder
/**
* Send email to object for review author
* @param $ofrAssignment ObjectForReviewAssignment
* @param $journal Journal
* @param $emailKey string
*/
function sendReminder($ofrAssignment, $journal, $emailKey)
{
$journalId = $journal->getId();
$author =& $ofrAssignment->getUser();
$objectForReview =& $ofrAssignment->getObjectForReview();
$editor =& $objectForReview->getEditor();
$paramArray = array('authorName' => strip_tags($author->getFullName()), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'objectForReviewDueDate' => date('l, F j, Y', strtotime($ofrAssignment->getDateDue())), 'submissionUrl' => Request::url($journal->getPath(), 'author', 'submit'), 'editorialContactSignature' => strip_tags($editor->getContactSignature()));
import('classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey);
$mail->setReplyTo($editor->getEmail(), $editor->getFullName());
$mail->addRecipient($author->getEmail(), $author->getFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
$ofrAssignment->setDateReminded(Core::getCurrentDate());
$ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
$ofrAssignmentDao->updateObject($ofrAssignment);
}
示例6: sendReminder
function sendReminder($registration, $conference, $schedConf, $emailKey)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
$schedConfName = $schedConf->getSchedConfTitle();
$schedConfId = $schedConf->getId();
$user =& $userDao->getUser($registration->getUserId());
if (!isset($user)) {
return false;
}
$registrationType =& $registrationTypeDao->getRegistrationType($registration->getTypeId());
$registrationName = $schedConf->getSetting('registrationName');
$registrationEmail = $schedConf->getSetting('registrationEmail');
$registrationPhone = $schedConf->getSetting('registrationPhone');
$registrationFax = $schedConf->getSetting('registrationFax');
$registrationMailingAddress = $schedConf->getSetting('registrationMailingAddress');
$registrationContactSignature = $registrationName;
if ($registrationMailingAddress != '') {
$registrationContactSignature .= "\n" . $registrationMailingAddress;
}
if ($registrationPhone != '') {
$registrationContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $registrationPhone;
}
if ($registrationFax != '') {
$registrationContactSignature .= "\n" . AppLocale::Translate('user.fax') . ': ' . $registrationFax;
}
$registrationContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $registrationEmail;
$paramArray = array('registrantName' => $user->getFullName(), 'conferenceName' => $conferenceName, 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'expiryDate' => $registration->getDateEnd(), 'username' => $user->getUsername(), 'registrationContactSignature' => $registrationContactSignature);
import('mail.MailTemplate');
$mail = new MailTemplate($emailKey, $conference->getPrimaryLocale());
$mail->setFrom($registrationEmail, $registrationName);
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->setSubject($mail->getSubject($conference->getPrimaryLocale()));
$mail->setBody($mail->getBody($conference->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
示例7: array
/**
* Internal function to prepare notification email
*/
function &_prepareNotificationEmail($mailTemplateKey)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
$journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
$journal =& Request::getJournal();
$journalName = $journal->getLocalizedTitle();
$journalId = $journal->getId();
$user =& $userDao->getUser($this->subscription->getUserId());
$subscriptionType =& $subscriptionTypeDao->getSubscriptionType($this->subscription->getTypeId());
$subscriptionName = $journalSettingsDao->getSetting($journalId, 'subscriptionName');
$subscriptionEmail = $journalSettingsDao->getSetting($journalId, 'subscriptionEmail');
$subscriptionPhone = $journalSettingsDao->getSetting($journalId, 'subscriptionPhone');
$subscriptionFax = $journalSettingsDao->getSetting($journalId, 'subscriptionFax');
$subscriptionMailingAddress = $journalSettingsDao->getSetting($journalId, 'subscriptionMailingAddress');
$subscriptionContactSignature = $subscriptionName;
if ($subscriptionMailingAddress != '') {
$subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
}
if ($subscriptionPhone != '') {
$subscriptionContactSignature .= "\n" . Locale::translate('user.phone') . ': ' . $subscriptionPhone;
}
if ($subscriptionFax != '') {
$subscriptionContactSignature .= "\n" . Locale::translate('user.fax') . ': ' . $subscriptionFax;
}
$subscriptionContactSignature .= "\n" . Locale::translate('user.email') . ': ' . $subscriptionEmail;
$paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
import('classes.mail.MailTemplate');
$mail = new MailTemplate($mailTemplateKey);
$mail->setFrom($subscriptionEmail, $subscriptionName);
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
return $mail;
}
示例8: fetch
//.........这里部分代码省略.........
if ($allowedType == METADATA_PROPERTY_TYPE_VOCABULARY) {
assert(count($allowedTypeParams) == 1);
$vocabName = $allowedTypeParams[0];
$vocabNameParts = explode(':', $vocabName);
$vocabNamePartsCount = count($vocabNameParts);
assert($vocabNamePartsCount == 1 || $vocabNamePartsCount == 3);
if ($vocabNamePartsCount == 1) {
// assume a site-wide vocabulary
$symbolic = $vocabName;
$assocType = $assocId = 0;
} else {
// assume a context-specific vocabulary
list($symbolic, $assocType, $assocId) = $vocabNameParts;
}
// Enumerate the identified vocabulary.
if (is_null($controlledVocabDao)) {
$controlledVocabDao =& DAORegistry::getDAO('ControlledVocabDAO');
}
$availableFields[$fieldName]['options'] = $controlledVocabDao->enumerateBySymbolic($symbolic, $assocType, $assocId);
}
}
}
// Sort available fields alphabetically.
$availableFields = $this->_orderByDisplayName($availableFields);
$templateMgr->assign_by_ref('availableFields', $availableFields);
//
// 2) Citation Services Query
//
// Nothing to do: Lookup filters have already been assigned for
// raw citation editing (see above).
//
// 3) Google Scholar
//
// Nothing to do.
//
// 4) Author Query
//
// Add the author query text to the template.
$author =& $assocObject->getUser();
$user =& $request->getUser();
$emailParams = array('authorFirstName' => strip_tags($author->getFirstName()), 'authorLastName' => strip_tags($author->getLastName()), 'userFirstName' => strip_tags($user->getFirstName()), 'userLastName' => strip_tags($user->getLastName()), 'articleTitle' => strip_tags($assocObject->getLocalizedTitle()), 'rawCitation' => strip_tags($citation->getRawCitation()));
import('classes.mail.MailTemplate');
$mail = new MailTemplate('CITATION_EDITOR_AUTHOR_QUERY', null, false, null, true, true);
$mail->assignParams($emailParams);
$templateMgr->assign('authorQuerySubject', $mail->getSubject());
$templateMgr->assign('authorQueryBody', $mail->getBody());
/////////////////////////////////////////////////////
// Expert Citation Services Results
// (full template only):
//
// Citation source tabs
$citationSourceTabs = array();
$locale = AppLocale::getLocale();
// Run through all source descriptions and extract statements.
$sourceDescriptions =& $citation->getSourceDescriptions();
assert(is_array($sourceDescriptions));
foreach ($sourceDescriptions as $sourceDescription) {
$sourceDescriptionId = $sourceDescription->getId();
$metadataSchema =& $sourceDescription->getMetadataSchema();
// Use the display name of the description for the tab.
// We can safely use the 'displayName' key here as
// the keys representing statements will be namespaced.
$citationSourceTabs[$sourceDescriptionId]['displayName'] = $sourceDescription->getDisplayName();
// Prepare the description's statements as a sub-array.
$thisDescription = array();
foreach ($sourceDescription->getStatements() as $propertyName => $value) {
$property =& $metadataSchema->getProperty($propertyName);
// Handle translation
if ($property->getTranslated()) {
assert(isset($value[$locale]));
$value = $value[$locale];
}
$sourcePropertyId = $sourceDescriptionId . '-' . $metadataSchema->getNamespacedPropertyId($propertyName);
$sourcePropertyValue = $this->_getStringValueFromMetadataStatement($property, $value);
$thisDescription[$sourcePropertyId] = array('displayName' => $property->getDisplayName(), 'value' => $sourcePropertyValue);
}
// Order description properties in the sub-array by display name.
$thisDescription = $this->_orderByDisplayName($thisDescription);
// Add the description sub-array to the descriptons list.
$citationSourceTabs[$sourceDescriptionId]['statements'] = $thisDescription;
unset($thisDescription);
// Remove source descriptions that don't have data.
if (!isset($citationSourceTabs[$sourceDescriptionId]['statements'])) {
unset($citationSourceTabs[$sourceDescriptionId]);
}
}
$templateMgr->assign_by_ref('citationSourceTabs', $citationSourceTabs);
/////////////////////////////////////////////////////
// Form level actions
// (full template only):
//
// Set the approval state.
$citationApproved = $citation->getCitationState() == CITATION_APPROVED ? true : false;
$templateMgr->assign('citationApproved', $citationApproved);
// Auto-add client-side validation
// FIXME: Move to JS framework's AjaxFormHandler, also see #6442
$templateMgr->assign('validateId', 'citationForm');
}
return parent::fetch($request, $template);
}
示例9: sendOnlinePaymentNotificationEmail
/**
* Send notification email to Subscription Manager when online payment is completed.
*/
function sendOnlinePaymentNotificationEmail(&$subscription, $mailTemplateKey)
{
$validKeys = array('SUBSCRIPTION_PURCHASE_INDL', 'SUBSCRIPTION_PURCHASE_INSTL', 'SUBSCRIPTION_RENEW_INDL', 'SUBSCRIPTION_RENEW_INSTL');
if (!in_array($mailTemplateKey, $validKeys)) {
return false;
}
$journal =& Request::getJournal();
$subscriptionContactName = $journal->getSetting('subscriptionName');
$subscriptionContactEmail = $journal->getSetting('subscriptionEmail');
if (empty($subscriptionContactEmail)) {
$subscriptionContactEmail = $journal->getSetting('contactEmail');
$subscriptionContactName = $journal->getSetting('contactName');
}
if (empty($subscriptionContactEmail)) {
return false;
}
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& $userDao->getUser($subscription->getUserId());
$subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
$subscriptionType =& $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
$roleDao =& DAORegistry::getDAO('RoleDAO');
if ($roleDao->getJournalUsersRoleCount($journal->getId(), ROLE_ID_SUBSCRIPTION_MANAGER) > 0) {
$rolePath = $roleDao->getRolePath(ROLE_ID_SUBSCRIPTION_MANAGER);
} else {
$rolePath = $roleDao->getRolePath(ROLE_ID_JOURNAL_MANAGER);
}
$paramArray = array('subscriptionType' => $subscriptionType->getSummaryString(), 'userDetails' => $user->getContactSignature(), 'membership' => $subscription->getMembership());
switch ($mailTemplateKey) {
case 'SUBSCRIPTION_PURCHASE_INDL':
case 'SUBSCRIPTION_RENEW_INDL':
$paramArray['subscriptionUrl'] = Request::url($journal->getPath(), $rolePath, 'editSubscription', 'individual', array($subscription->getId()));
break;
case 'SUBSCRIPTION_PURCHASE_INSTL':
case 'SUBSCRIPTION_RENEW_INSTL':
$paramArray['subscriptionUrl'] = Request::url($journal->getPath(), $rolePath, 'editSubscription', 'institutional', array($subscription->getId()));
$paramArray['institutionName'] = $subscription->getInstitutionName();
$paramArray['institutionMailingAddress'] = $subscription->getInstitutionMailingAddress();
$paramArray['domain'] = $subscription->getDomain();
$paramArray['ipRanges'] = $subscription->getIPRangesString();
break;
}
import('classes.mail.MailTemplate');
$mail = new MailTemplate($mailTemplateKey);
$mail->setFrom($subscriptionContactEmail, $subscriptionContactName);
$mail->addRecipient($subscriptionContactEmail, $subscriptionContactName);
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}