本文整理汇总了PHP中ArticleMailTemplate::setBody方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleMailTemplate::setBody方法的具体用法?PHP ArticleMailTemplate::setBody怎么用?PHP ArticleMailTemplate::setBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleMailTemplate
的用法示例。
在下文中一共展示了ArticleMailTemplate::setBody方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendReminder
function sendReminder($reviewAssignment, $article, $journal)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getId();
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('mail.ArticleMailTemplate');
$reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
$email = new ArticleMailTemplate($article, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', null, false, $journal);
$email->setJournal($journal);
$email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setAssoc(ARTICLE_EMAIL_REVIEW_REMIND, ARTICLE_EMAIL_TYPE_REVIEW, $reviewId);
$email->setSubject($email->getSubject($journal->getPrimaryLocale()));
$email->setBody($email->getBody($journal->getPrimaryLocale()));
$urlParams = array();
if ($reviewerAccessKeysEnabled) {
import('security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
}
$submissionReviewUrl = Request::url($journal->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'journalUrl' => $journal->getUrl(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'weekLaterDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week')), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedTitle(), 'passwordResetUrl' => Request::url($journal->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionReviewUrl);
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
}
示例2: sendReminder
function sendReminder($reviewAssignment, $submission, $context)
{
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao = DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getId();
$reviewer = $userDao->getById($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('classes.mail.ArticleMailTemplate');
$reviewerAccessKeysEnabled = $context->getSetting('reviewerAccessKeysEnabled');
$email = new ArticleMailTemplate($submission, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', $context->getPrimaryLocale(), $context, false);
$email->setContext($context);
$email->setReplyTo(null);
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setSubject($email->getSubject($context->getPrimaryLocale()));
$email->setBody($email->getBody($context->getPrimaryLocale()));
$urlParams = array();
if ($reviewerAccessKeysEnabled) {
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($context->getSetting('numWeeksPerReview') + 4) * 7;
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
}
$submissionReviewUrl = Request::url($context->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate === -1 || $reviewDueDate === false) {
// Default to something human-readable if no date specified
$reviewDueDate = '_____';
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'contextUrl' => Request::url($context->getPath()), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'weekLaterDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week')), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'passwordResetUrl' => Request::url($context->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionReviewUrl);
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateObject($reviewAssignment);
}
示例3: emailEditorDecisionComment
//.........这里部分代码省略.........
$email->send($request);
if ($decisionConst == SUBMISSION_EDITOR_DECISION_DECLINE) {
// If the most recent decision was a decline,
// sending this email archives the submission.
$sectionEditorSubmission->setStatus(STATUS_ARCHIVED);
$sectionEditorSubmission->stampStatusModified();
$sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
}
$articleComment = new ArticleComment();
$articleComment->setCommentType(COMMENT_TYPE_EDITOR_DECISION);
$articleComment->setRoleId(Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR);
$articleComment->setArticleId($sectionEditorSubmission->getId());
$articleComment->setAuthorId($sectionEditorSubmission->getUserId());
$articleComment->setCommentTitle($email->getSubject());
$articleComment->setComments($email->getBody());
$articleComment->setDatePosted(Core::getCurrentDate());
$articleComment->setViewable(true);
$articleComment->setAssocId($sectionEditorSubmission->getId());
$articleCommentDao->insertArticleComment($articleComment);
return true;
} else {
if (!$request->getUserVar('continued')) {
$authorUser =& $userDao->getUser($sectionEditorSubmission->getUserId());
$authorEmail = $authorUser->getEmail();
$email->assignParams(array('editorialContactSignature' => $user->getContactSignature(), 'authorName' => $authorUser->getFullName(), 'journalTitle' => $journal->getLocalizedTitle()));
$email->addRecipient($authorEmail, $authorUser->getFullName());
if ($journal->getSetting('notifyAllAuthorsOnDecision')) {
foreach ($sectionEditorSubmission->getAuthors() as $author) {
if ($author->getEmail() != $authorEmail) {
$email->addCc($author->getEmail(), $author->getFullName());
}
}
}
} elseif ($request->getUserVar('importPeerReviews')) {
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($sectionEditorSubmission->getId(), $sectionEditorSubmission->getCurrentRound());
$reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($sectionEditorSubmission->getId(), $sectionEditorSubmission->getCurrentRound());
$body = '';
foreach ($reviewAssignments as $reviewAssignment) {
// If the reviewer has completed the assignment, then import the review.
if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) {
// Get the comments associated with this review assignment
$articleComments =& $articleCommentDao->getArticleComments($sectionEditorSubmission->getId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId());
if ($articleComments) {
$body .= "------------------------------------------------------\n";
$body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getReviewId()]))) . "\n";
if (is_array($articleComments)) {
foreach ($articleComments as $comment) {
// If the comment is viewable by the author, then add the comment.
if ($comment->getViewable()) {
$body .= String::html2text($comment->getComments()) . "\n\n";
}
}
}
$body .= "------------------------------------------------------\n\n";
}
if ($reviewFormId = $reviewAssignment->getReviewFormId()) {
$reviewId = $reviewAssignment->getId();
$reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
if (!$articleComments) {
$body .= "------------------------------------------------------\n";
$body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getReviewId()]))) . "\n\n";
}
foreach ($reviewFormElements as $reviewFormElement) {
if ($reviewFormElement->getIncluded()) {
$body .= String::html2text($reviewFormElement->getLocalizedQuestion()) . ": \n";
$reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId());
if ($reviewFormResponse) {
$possibleResponses = $reviewFormElement->getLocalizedPossibleResponses();
if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) {
if ($reviewFormElement->getElementType() == REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) {
foreach ($reviewFormResponse->getValue() as $value) {
$body .= "\t" . String::html2text($possibleResponses[$value - 1]['content']) . "\n";
}
} else {
$body .= "\t" . String::html2text($possibleResponses[$reviewFormResponse->getValue() - 1]['content']) . "\n";
}
$body .= "\n";
} else {
$body .= "\t" . $reviewFormResponse->getValue() . "\n\n";
}
}
}
}
$body .= "------------------------------------------------------\n\n";
}
}
}
$oldBody = $email->getBody();
if (!empty($oldBody)) {
$oldBody .= "\n";
}
$email->setBody($oldBody . $body);
}
$email->displayEditForm($request->url(null, null, 'emailEditorDecisionComment', 'send'), array('articleId' => $sectionEditorSubmission->getId()), 'submission/comment/editorDecisionEmail.tpl', array('isAnEditor' => true));
return false;
}
}
示例4: emailEditorDecisionComment
//.........这里部分代码省略.........
$articleComment->setCommentType(COMMENT_TYPE_SECTION_DECISION);
$articleComment->setRoleId(Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR);
$articleComment->setArticleId($sectionEditorSubmission->getArticleId());
$articleComment->setAuthorId($user->getUserId());
$articleComment->setCommentTitle($email->getSubject());
$articleComment->setComments($email->getBody());
$articleComment->setDatePosted(Core::getCurrentDate());
$articleComment->setViewable(true);
$articleComment->setAssocId($sectionEditorSubmission->getArticleId());
$articleCommentDao->insertArticleComment($articleComment);
return true;
} else {
if (!Request::getUserVar('continued')) {
$authorUser =& $userDao->getUser($sectionEditorSubmission->getUserId());
$authorEmail = $authorUser->getEmail();
$email->assignParams(array('editorialContactSignature' => $user->getContactSignature(), 'authorName' => $authorUser->getFullName(), 'urlOngoing' => Request::url(null, 'author', 'index', 'ongoingResearches'), 'urlDrafts' => Request::url(null, 'author', 'index', 'proposalsToSubmit'), 'url' => Request::url(null, 'author', 'submissionReview', $sectionEditorSubmission->getArticleId()), 'reviewType' => Locale::translate($decision->getReviewTypeKey()), 'journalTitle' => $journal->getLocalizedTitle()));
$email->addRecipient($authorEmail, $authorUser->getFullName());
if ($journal->getSetting('notifyAllAuthorsOnDecision')) {
foreach ($sectionEditorSubmission->getAuthors() as $author) {
if ($author->getEmail() != $authorEmail) {
$email->addCc($author->getEmail(), $author->getFullName());
}
}
}
import('classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
$decisionFiles =& $decision->getDecisionFiles();
foreach ($decisionFiles as $file) {
if ($file) {
$temporaryFile = $temporaryFileManager->articleToTemporaryFile($file, $user->getId());
$email->addPersistAttachment($temporaryFile);
}
}
} elseif (Request::getUserVar('importPeerReviews')) {
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignments =& $reviewAssignmentDao->getByDecisionId($sectionEditorSubmission->getLastSectionDecisionId());
$reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForDecision($sectionEditorSubmission->getLastSectionDecisionId());
$body = '';
foreach ($reviewAssignments as $reviewAssignment) {
// If the reviewer has completed the assignment, then import the review.
if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) {
// Get the comments associated with this review assignment
$articleComments =& $articleCommentDao->getArticleComments($sectionEditorSubmission->getArticleId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId());
if ($articleComments) {
$body .= "------------------------------------------------------\n";
$body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => chr(ord('A') + $reviewIndexes[$reviewAssignment->getId()]))) . "\n";
if (is_array($articleComments)) {
foreach ($articleComments as $comment) {
// If the comment is viewable by the author, then add the comment.
if ($comment->getViewable()) {
$body .= String::html2text($comment->getComments()) . "\n\n";
}
}
}
$body .= "------------------------------------------------------\n\n";
}
if ($reviewFormId = $reviewAssignment->getReviewFormId()) {
$reviewId = $reviewAssignment->getId();
$reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
if (!$articleComments) {
$body .= "------------------------------------------------------\n";
$body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => chr(ord('A') + $reviewIndexes[$reviewAssignment->getId()]))) . "\n\n";
}
foreach ($reviewFormElements as $reviewFormElement) {
if ($reviewFormElement->getIncluded()) {
$body .= String::html2text($reviewFormElement->getLocalizedQuestion()) . ": \n";
$reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId());
if ($reviewFormResponse) {
$possibleResponses = $reviewFormElement->getLocalizedPossibleResponses();
if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) {
if ($reviewFormElement->getElementType() == REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) {
foreach ($reviewFormResponse->getValue() as $value) {
$body .= "\t" . String::html2text($possibleResponses[$value - 1]['content']) . "\n";
}
} else {
$body .= "\t" . String::html2text($possibleResponses[$reviewFormResponse->getValue() - 1]['content']) . "\n";
}
$body .= "\n";
} else {
$body .= "\t" . String::html2text($reviewFormResponse->getValue()) . "\n\n";
}
}
}
}
$body .= "------------------------------------------------------\n\n";
}
}
}
$oldBody = $email->getBody();
if (!empty($oldBody)) {
$oldBody .= "\n";
}
$email->setBody($oldBody . $body);
}
$email->displayEditForm(Request::url(null, null, 'emailEditorDecisionComment', 'send'), array('articleId' => $sectionEditorSubmission->getArticleId()), 'submission/comment/editorDecisionEmail.tpl', array('isAnEditor' => true));
return false;
}
}