本文整理匯總了PHP中ArticleMailTemplate::addCc方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleMailTemplate::addCc方法的具體用法?PHP ArticleMailTemplate::addCc怎麽用?PHP ArticleMailTemplate::addCc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArticleMailTemplate
的用法示例。
在下文中一共展示了ArticleMailTemplate::addCc方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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";
}
//.........這裏部分代碼省略.........
示例2: 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) {
//.........這裏部分代碼省略.........
示例3: completeAuthorCopyedit
/**
* Author completes editor / author review.
* @param $authorSubmission object
* @param $send boolean
* @param $request object
*/
function completeAuthorCopyedit($authorSubmission, $send, $request)
{
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& $request->getJournal();
$authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
if ($authorSignoff->getDateCompleted() != null) {
return true;
}
$user =& $request->getUser();
import('classes.mail.ArticleMailTemplate');
$email = new ArticleMailTemplate($authorSubmission, 'COPYEDIT_AUTHOR_COMPLETE');
$editAssignments = $authorSubmission->getEditAssignments();
$copyeditor = $authorSubmission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL');
if (!$email->isEnabled() || $send && !$email->hasErrors()) {
HookRegistry::call('AuthorAction::completeAuthorCopyedit', array(&$authorSubmission, &$email));
if ($email->isEnabled()) {
$email->send($request);
}
$authorSignoff->setDateCompleted(Core::getCurrentDate());
$finalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
if ($copyeditor) {
$finalSignoff->setUserId($copyeditor->getId());
}
$finalSignoff->setDateNotified(Core::getCurrentDate());
$signoffDao->updateObject($authorSignoff);
$signoffDao->updateObject($finalSignoff);
// Add log entry
import('classes.article.log.ArticleLog');
ArticleLog::logEvent($request, $authorSubmission, ARTICLE_LOG_COPYEDIT_REVISION, 'log.copyedit.authorFile');
return true;
} else {
if (!$request->getUserVar('continued')) {
if (isset($copyeditor)) {
$email->addRecipient($copyeditor->getEmail(), $copyeditor->getFullName());
$assignedSectionEditors = $email->ccAssignedEditingSectionEditors($authorSubmission->getId());
$assignedEditors = $email->ccAssignedEditors($authorSubmission->getId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addCc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorName = $journal->getSetting('contactName');
} else {
$editor = array_shift($assignedSectionEditors);
if (!$editor) {
$editor = array_shift($assignedEditors);
}
$editorName = $editor->getEditorFullName();
}
} else {
$assignedSectionEditors = $email->toAssignedEditingSectionEditors($authorSubmission->getId());
$assignedEditors = $email->ccAssignedEditors($authorSubmission->getId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorName = $journal->getSetting('contactName');
} else {
$editor = array_shift($assignedSectionEditors);
if (!$editor) {
$editor = array_shift($assignedEditors);
}
$editorName = $editor->getEditorFullName();
}
}
$paramArray = array('editorialContactName' => isset($copyeditor) ? $copyeditor->getFullName() : $editorName, 'authorName' => $user->getFullName());
$email->assignParams($paramArray);
}
$email->displayEditForm($request->url(null, 'author', 'completeAuthorCopyedit', 'send'), array('articleId' => $authorSubmission->getId()));
return false;
}
}
示例4: proofreadEmail
//.........這裏部分代碼省略.........
if (!isset($receiver)) {
return true;
}
$receiverName = $receiver->getFullName();
$receiverAddress = $receiver->getEmail();
$email->ccAssignedEditingSectionEditors($sectionEditorSubmission->getId());
$addParamArray = array('layoutEditorName' => $receiverName, 'layoutEditorUsername' => $receiver->getUsername(), 'layoutEditorPassword' => $receiver->getPassword(), 'editorialContactSignature' => $user->getContactSignature(), 'submissionUrl' => Request::url(null, 'proofreader', 'submission', $articleId));
if (!$actionPath) {
// Reset underway/complete/thank dates
$signoffReset = $signoffDao->build($signoffType, ASSOC_TYPE_ARTICLE, $articleId);
$signoffReset->setDateUnderway(null);
$signoffReset->setDateCompleted(null);
$signoffReset->setDateAcknowledged(null);
}
break;
case 'PROOFREAD_LAYOUT_ACK':
$eventType = ARTICLE_EMAIL_PROOFREAD_THANK_LAYOUTEDITOR;
$signoffType = 'SIGNOFF_PROOFREADING_LAYOUT';
$setDateField = 'setDateAcknowledged';
$receiver = $sectionEditorSubmission->getUserBySignoffType($signoffType);
if (!isset($receiver)) {
return true;
}
$receiverName = $receiver->getFullName();
$receiverAddress = $receiver->getEmail();
$email->ccAssignedEditingSectionEditors($sectionEditorSubmission->getId());
$addParamArray = array('layoutEditorName' => $receiverName, 'editorialContactSignature' => $user->getContactSignature());
break;
case 'PROOFREAD_LAYOUT_COMPLETE':
$eventType = ARTICLE_EMAIL_PROOFREAD_NOTIFY_LAYOUTEDITOR_COMPLETE;
$signoffType = 'SIGNOFF_PROOFREADING_LAYOUT';
$setDateField = 'setDateCompleted';
$getDateField = 'getDateCompleted';
$editAssignments =& $sectionEditorSubmission->getEditAssignments();
$assignmentIndex = 0;
$editorAdded = false;
foreach ($editAssignments as $editAssignment) {
if ($editAssignment->getIsEditor() || $editAssignment->getCanEdit()) {
if ($assignmentIndex++ == 0) {
$receiverName = $editAssignment->getEditorFullName();
$receiverAddress = $editAssignment->getEditorEmail();
} else {
$ccs[$editAssignment->getEditorEmail()] = $editAssignment->getEditorFullName();
}
$editorAdded = true;
}
}
if (!$editorAdded) {
$receiverAddress = $journal->getSetting('contactEmail');
$receiverName = $journal->getSetting('contactName');
}
$addParamArray = array('editorialContactName' => $receiverName, 'layoutEditorName' => $user->getFullName());
break;
default:
return true;
}
$signoff = $signoffDao->build($signoffType, ASSOC_TYPE_ARTICLE, $articleId);
if (isset($getDateField)) {
$date = $signoff->{$getDateField}();
if (isset($date)) {
Request::redirect(null, null, 'submission', $articleId);
}
}
if ($email->isEnabled() && ($actionPath || $email->hasErrors())) {
if (!Request::getUserVar('continued')) {
$email->addRecipient($receiverAddress, $receiverName);
if (isset($ccs)) {
foreach ($ccs as $address => $name) {
$email->addCc($address, $name);
}
}
$paramArray = array();
if (isset($addParamArray)) {
$paramArray += $addParamArray;
}
$email->assignParams($paramArray);
}
$email->displayEditForm($actionPath, array('articleId' => $articleId));
return false;
} else {
HookRegistry::call('ProofreaderAction::proofreadEmail', array(&$email, $mailType));
if ($email->isEnabled()) {
$email->send($request);
}
$signoff->{$setDateField}(Core::getCurrentDate());
if (isset($setNextDateField)) {
$nextSignoff->{$setNextDateField}(Core::getCurrentDate());
}
if (isset($nullifyDateFields)) {
foreach ($nullifyDateFields as $fieldSetter) {
$signoff->{$fieldSetter}(null);
}
}
$signoffDao->updateObject($signoff);
if (isset($nextSignoff)) {
$signoffDao->updateObject($nextSignoff);
}
return true;
}
}