/** * Blind CC the editor decision email to reviewers. * @param $article object * @param $send boolean * @return boolean true iff ready for redirect */ function bccEditorDecisionCommentToReviewers($article, $send, $request) { import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_DECISION_REVIEWERS'); if ($send && !$email->hasErrors()) { HookRegistry::call('SectionEditorAction::bccEditorDecisionCommentToReviewers', array(&$article, &$reviewAssignments, &$email)); $email->send($request); return true; } else { if (!$request->getUserVar('continued')) { $userDao =& DAORegistry::getDAO('UserDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($article->getId(), $article->getCurrentRound()); $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $commentsText = ""; if ($article->getMostRecentEditorDecisionComment()) { $comment = $article->getMostRecentEditorDecisionComment(); $commentsText = String::html2text($comment->getComments()) . "\n\n"; } $user =& $request->getUser(); $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm($request->url(null, null, 'bccEditorDecisionCommentToReviewers', 'send'), array('articleId' => $article->getId())); return false; } }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($this->article, 'SUBMISSION_COMMENT'); $journal =& Request::getJournal(); if ($journal) { $email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); } foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $email->setSubject(strip_tags($this->article->getLocalizedTitle())); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => String::html2text($this->getData('comments'))); $email->assignParams($paramArray); $email->send(); $email->clearRecipients(); } }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { $article = $this->article; $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $journal =& Request::getJournal(); import('mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_COMMENT'); $email->setFrom($this->user->getEmail(), $this->user->getFullName()); $commentText = $this->getData('comments'); // Individually send an email to each of the recipients. foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => $commentText); $email->sendWithParams($paramArray); $email->clearRecipients(); } }
/** * Blind CC the reviews to reviewers. * @param $article object * @param $send boolean * @param $inhibitExistingEmail boolean * @return boolean true iff ready for redirect */ function blindCcReviewsToReviewers($article, $send = false, $inhibitExistingEmail = false) { $commentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $journal =& Request::getJournal(); $comments =& $commentDao->getArticleComments($article->getId(), COMMENT_TYPE_EDITOR_DECISION); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($article->getId(), $article->getCurrentRound()); $commentsText = ""; foreach ($comments as $comment) { $commentsText .= String::html2text($comment->getComments()) . "\n\n"; } $user =& Request::getUser(); import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_DECISION_REVIEWERS', null, null, null, true, true); if ($send && !$email->hasErrors() && !$inhibitExistingEmail) { HookRegistry::call('SectionEditorAction::blindCcReviewsToReviewers', array(&$article, &$reviewAssignments, &$email)); $email->send(); return true; } else { if ($inhibitExistingEmail || !Request::getUserVar('continued')) { $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm(Request::url(null, null, 'blindCcReviewsToReviewers'), array('articleId' => $article->getId())); return false; } }