本文整理汇总了PHP中ArticleMailTemplate::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleMailTemplate::getBody方法的具体用法?PHP ArticleMailTemplate::getBody怎么用?PHP ArticleMailTemplate::getBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleMailTemplate
的用法示例。
在下文中一共展示了ArticleMailTemplate::getBody方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 editor decision comment.
* @param $sectionEditorSubmission object
* @param $send boolean
* @param $request object
*/
function emailEditorDecisionComment($sectionEditorSubmission, $send, $request)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$journal =& $request->getJournal();
$user =& $request->getUser();
import('classes.mail.ArticleMailTemplate');
$decisionTemplateMap = array(SUBMISSION_EDITOR_DECISION_ACCEPT => 'EDITOR_DECISION_ACCEPT', SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS => 'EDITOR_DECISION_REVISIONS', SUBMISSION_EDITOR_DECISION_RESUBMIT => 'EDITOR_DECISION_RESUBMIT', SUBMISSION_EDITOR_DECISION_DECLINE => 'EDITOR_DECISION_DECLINE');
$decisions = $sectionEditorSubmission->getDecisions();
$decisions = array_pop($decisions);
// Rounds
$decision = array_pop($decisions);
$decisionConst = $decision ? $decision['decision'] : null;
$email = new ArticleMailTemplate($sectionEditorSubmission, isset($decisionTemplateMap[$decisionConst]) ? $decisionTemplateMap[$decisionConst] : null);
$copyeditor = $sectionEditorSubmission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL');
if ($send && !$email->hasErrors()) {
HookRegistry::call('SectionEditorAction::emailEditorDecisionComment', array(&$sectionEditorSubmission, &$send, &$request));
$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";
}
//.........这里部分代码省略.........
示例4: emailEditorDecisionComment
/**
* Email editor decision comment.
* @param $authorSubmission object
* @param $send boolean
* @param $request object
*/
function emailEditorDecisionComment($authorSubmission, $send, $request)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& $request->getJournal();
$user =& $request->getUser();
import('classes.mail.ArticleMailTemplate');
$email = new ArticleMailTemplate($authorSubmission);
$editAssignments = $authorSubmission->getEditAssignments();
$editors = array();
foreach ($editAssignments as $editAssignment) {
array_push($editors, $userDao->getUser($editAssignment->getEditorId()));
}
if ($send && !$email->hasErrors()) {
HookRegistry::call('AuthorAction::emailEditorDecisionComment', array(&$authorSubmission, &$email));
$email->send($request);
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$articleComment = new ArticleComment();
$articleComment->setCommentType(COMMENT_TYPE_EDITOR_DECISION);
$articleComment->setRoleId(ROLE_ID_AUTHOR);
$articleComment->setArticleId($authorSubmission->getId());
$articleComment->setAuthorId($authorSubmission->getUserId());
$articleComment->setCommentTitle($email->getSubject());
$articleComment->setComments($email->getBody());
$articleComment->setDatePosted(Core::getCurrentDate());
$articleComment->setViewable(true);
$articleComment->setAssocId($authorSubmission->getId());
$articleCommentDao->insertArticleComment($articleComment);
return true;
} else {
if (!$request->getUserVar('continued')) {
$email->setSubject($authorSubmission->getLocalizedTitle());
if (!empty($editors)) {
foreach ($editors as $editor) {
$email->addRecipient($editor->getEmail(), $editor->getFullName());
}
} else {
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
}
}
$email->displayEditForm(Request::url(null, null, 'emailEditorDecisionComment', 'send'), array('articleId' => $authorSubmission->getId()), 'submission/comment/editorDecisionEmail.tpl');
return false;
}
}
示例5: emailEditorDecisionComment
/**
* Email editor decision comment
* @param $sectionEditorSubmission object
* @param $send boolean
*/
function emailEditorDecisionComment($sectionEditorSubmission, $send)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$journal =& Request::getJournal();
$user =& Request::getUser();
import('classes.mail.ArticleMailTemplate');
$decisionTemplateMap = array(SUBMISSION_SECTION_DECISION_APPROVED => 'SECTION_DECISION_APPROVED', SUBMISSION_SECTION_DECISION_RESUBMIT => 'SECTION_DECISION_RESUBMIT', SUBMISSION_SECTION_DECISION_INCOMPLETE => 'SECTION_DECISION_INCOMPLETE', SUBMISSION_SECTION_DECISION_DECLINED => 'SECTION_DECISION_DECLINE', SUBMISSION_SECTION_DECISION_EXEMPTED => 'SECTION_DECISION_EXEMPT');
$decision = $sectionEditorSubmission->getLastSectionDecision();
if ($decision->getDecision() == SUBMISSION_SECTION_DECISION_APPROVED && $decision->getReviewType() == REVIEW_TYPE_FR) {
$email = new ArticleMailTemplate($sectionEditorSubmission, null, 'SECTION_DECISION_FR_APPROVED');
} elseif ($decision->getDecision() == SUBMISSION_SECTION_DECISION_EXEMPTED && $decision->getComments() == null) {
return true;
} else {
$email = new ArticleMailTemplate($sectionEditorSubmission, null, isset($decisionTemplateMap[$decision->getDecision()]) ? $decisionTemplateMap[$decision->getDecision()] : null);
}
$copyeditor = $sectionEditorSubmission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL');
if ($send && !$email->hasErrors()) {
HookRegistry::call('SectionEditorAction::emailEditorDecisionComment', array(&$sectionEditorSubmission, &$send));
$email->send();
$articleComment = new ArticleComment();
$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) {
//.........这里部分代码省略.........