当前位置: 首页>>代码示例>>PHP>>正文


PHP String::enumerateAlphabetically方法代码示例

本文整理汇总了PHP中String::enumerateAlphabetically方法的典型用法代码示例。如果您正苦于以下问题:PHP String::enumerateAlphabetically方法的具体用法?PHP String::enumerateAlphabetically怎么用?PHP String::enumerateAlphabetically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String的用法示例。


在下文中一共展示了String::enumerateAlphabetically方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPeerReviews

 /**
  * Get the text of all peer reviews for a submission
  * @param $seriesEditorSubmission SeriesEditorSubmission
  * @return string
  */
 function getPeerReviews($seriesEditorSubmission)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $monographCommentDao =& DAORegistry::getDAO('MonographCommentDAO');
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
     $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentRound());
     $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentRound());
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION));
     $body = '';
     $textSeparator = "------------------------------------------------------";
     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
             $monographComments =& $monographCommentDao->getMonographComments($seriesEditorSubmission->getId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId());
             if ($monographComments) {
                 $body .= "\n\n{$textSeparator}\n";
                 $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n";
                 if (is_array($monographComments)) {
                     foreach ($monographComments 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 .= "{$textSeparator}\n\n";
             }
             if ($reviewFormId = $reviewAssignment->getReviewFormId()) {
                 $reviewId = $reviewAssignment->getId();
                 $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
                 if (!$monographComments) {
                     $body .= "{$textSeparator}\n";
                     $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n\n";
                 }
                 foreach ($reviewFormElements as $reviewFormElement) {
                     $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::htmltext($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 .= "{$textSeparator}\n\n";
             }
         }
     }
     return $body;
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:66,代码来源:SeriesEditorAction.inc.php

示例2: _sendReviewMailToAuthor

 /**
  * Sends an email with a personal message and the selected
  * review attachements to the author. Also marks review attachments
  * selected by the editor as "viewable" for the author.
  * @param $submission Submission
  * @param $emailKey string An email template.
  * @param $request PKPRequest
  */
 function _sendReviewMailToAuthor($submission, $emailKey, $request)
 {
     // Send personal message to author.
     import('lib.pkp.classes.mail.SubmissionMailTemplate');
     $email = new SubmissionMailTemplate($submission, $emailKey, null, null, null, false);
     $email->setBody($this->getData('personalMessage'));
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR);
     while ($submitterAssignment = $submitterAssignments->next()) {
         $submitterUser = $userDao->getById($submitterAssignment->getUserId());
         $email->addRecipient($submitterUser->getEmail(), $submitterUser->getFullName());
     }
     DAORegistry::getDAO('SubmissionEmailLogDAO');
     // Load constants
     $email->setEventType(SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR);
     // Get review round.
     $reviewRound = $this->getReviewRound();
     if (is_a($reviewRound, 'ReviewRound')) {
         // Retrieve review indexes.
         $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
         /* @var $reviewAssignmentDao ReviewAssignmentDAO */
         $reviewIndexes = $reviewAssignmentDao->getReviewIndexesForRound($submission->getId(), $reviewRound->getId());
         assert(is_array($reviewIndexes));
         // Add a review index for review attachments not associated with
         // a review assignment (i.e. attachments uploaded by the editor).
         $lastIndex = end($reviewIndexes);
         $reviewIndexes[-1] = $lastIndex + 1;
         // Attach the selected reviewer attachments to the email.
         $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
         /* @var $submissionFileDao SubmissionFileDAO */
         $selectedAttachments = $this->getData('selectedAttachments');
         if (is_array($selectedAttachments)) {
             foreach ($selectedAttachments as $fileId) {
                 // Retrieve the submission file.
                 $submissionFile = $submissionFileDao->getLatestRevision($fileId);
                 assert(is_a($submissionFile, 'SubmissionFile'));
                 // Check the association information.
                 if ($submissionFile->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT) {
                     // The review attachment has been uploaded by a reviewer.
                     $reviewAssignmentId = $submissionFile->getAssocId();
                     assert(is_numeric($reviewAssignmentId));
                 } else {
                     // The review attachment has been uploaded by the editor.
                     $reviewAssignmentId = -1;
                 }
                 // Identify the corresponding review index.
                 assert(isset($reviewIndexes[$reviewAssignmentId]));
                 $reviewIndex = $reviewIndexes[$reviewAssignmentId];
                 assert(!is_null($reviewIndex));
                 // Add the attachment to the email.
                 $email->addAttachment($submissionFile->getFilePath(), String::enumerateAlphabetically($reviewIndex) . '-' . $submissionFile->getOriginalFileName());
                 // Update submission file to set viewable as true, so author
                 // can view the file on their submission summary page.
                 $submissionFile->setViewable(true);
                 $submissionFileDao->updateObject($submissionFile);
             }
         }
     }
     // Send the email.
     if (!$this->getData('skipEmail')) {
         $router = $request->getRouter();
         $dispatcher = $router->getDispatcher();
         $context = $request->getContext();
         $email->assignParams(array('submissionUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'authorDashboard', 'submission', $submission->getId()), 'contextName' => $context->getLocalizedName()));
         $email->send($request);
     }
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:76,代码来源:EditorDecisionWithEmailForm.inc.php

示例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";
                                             }
//.........这里部分代码省略.........
开发者ID:yuricampos,项目名称:ojs,代码行数:101,代码来源:SectionEditorAction.inc.php

示例4: emailDirectorDecisionComment

 /**
  * Email director decision comment.
  * @param $trackDirectorSubmission object
  * @param $send boolean
  */
 function emailDirectorDecisionComment($trackDirectorSubmission, $send)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $paperCommentDao = DAORegistry::getDAO('PaperCommentDAO');
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $templateName = null;
     $reviewMode = $trackDirectorSubmission->getReviewMode();
     $rounds = $trackDirectorSubmission->getDecisions();
     if (is_array($rounds)) {
         $isAbstract = array_pop(array_keys($rounds)) == REVIEW_ROUND_ABSTRACT;
     }
     if (isset($rounds) && is_array($rounds)) {
         $decisions = array_pop($rounds);
         // If this round has no decision, revert to prior round
         if (empty($decisions)) {
             $decisions = array_pop($rounds);
         }
     }
     if (isset($decisions) && is_array($decisions)) {
         $lastDecision = array_pop($decisions);
     }
     if (isset($lastDecision) && is_array($lastDecision)) {
         switch ($lastDecision['decision']) {
             case SUBMISSION_DIRECTOR_DECISION_INVITE:
                 $templateName = $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_PAPER_INVITE' : 'SUBMISSION_ABSTRACT_ACCEPT';
                 break;
             case SUBMISSION_DIRECTOR_DECISION_ACCEPT:
                 $templateName = 'SUBMISSION_PAPER_ACCEPT';
                 break;
             case SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS:
                 $templateName = $isAbstract ? 'SUBMISSION_ABSTRACT_REVISE' : 'SUBMISSION_PAPER_REVISE';
                 break;
             case SUBMISSION_DIRECTOR_DECISION_DECLINE:
                 $templateName = $isAbstract ? 'SUBMISSION_ABSTRACT_DECLINE' : 'SUBMISSION_PAPER_DECLINE';
                 break;
         }
     }
     $user =& Request::getUser();
     import('classes.mail.PaperMailTemplate');
     $email = new PaperMailTemplate($trackDirectorSubmission, $templateName);
     if ($send && !$email->hasErrors()) {
         HookRegistry::call('TrackDirectorAction::emailDirectorDecisionComment', array(&$trackDirectorSubmission, &$send));
         $email->send();
         $paperComment = new PaperComment();
         $paperComment->setCommentType(COMMENT_TYPE_DIRECTOR_DECISION);
         $paperComment->setRoleId(Validation::isDirector() ? ROLE_ID_DIRECTOR : ROLE_ID_TRACK_DIRECTOR);
         $paperComment->setPaperId($trackDirectorSubmission->getId());
         $paperComment->setAuthorId($trackDirectorSubmission->getUserId());
         $paperComment->setCommentTitle($email->getSubject());
         $paperComment->setComments($email->getBody());
         $paperComment->setDatePosted(Core::getCurrentDate());
         $paperComment->setViewable(true);
         $paperComment->setAssocId($trackDirectorSubmission->getId());
         $paperCommentDao->insertPaperComment($paperComment);
         return true;
     } else {
         if (!Request::getUserVar('continued')) {
             $authorUser =& $userDao->getById($trackDirectorSubmission->getUserId());
             $authorEmail = $authorUser->getEmail();
             $email->addRecipient($authorEmail, $authorUser->getFullName());
             if ($schedConf->getSetting('notifyAllAuthorsOnDecision')) {
                 foreach ($trackDirectorSubmission->getAuthors() as $author) {
                     if ($author->getEmail() != $authorEmail) {
                         $email->addCc($author->getEmail(), $author->getFullName());
                     }
                 }
             }
             $email->assignParams(array('conferenceDate' => strftime(Config::getVar('general', 'date_format_short'), $schedConf->getSetting('startDate')), 'authorName' => $authorUser->getFullName(), 'conferenceTitle' => $conference->getLocalizedName(), 'editorialContactSignature' => $user->getContactSignature(), 'locationCity' => $schedConf->getSetting('locationCity'), 'paperTitle' => $trackDirectorSubmission->getLocalizedTitle()));
         } elseif (Request::getUserVar('importPeerReviews')) {
             $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
             $hasBody = false;
             for ($round = $trackDirectorSubmission->getCurrentRound(); $round == REVIEW_ROUND_ABSTRACT || $round == REVIEW_ROUND_PRESENTATION; $round--) {
                 $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($trackDirectorSubmission->getId(), $round);
                 $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($trackDirectorSubmission->getId(), $round);
                 $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
                         $paperComments =& $paperCommentDao->getPaperComments($trackDirectorSubmission->getId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId());
                         if ($paperComments) {
                             $body .= "------------------------------------------------------\n";
                             $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n";
                             if (is_array($paperComments)) {
                                 foreach ($paperComments as $comment) {
                                     // If the comment is viewable by the author, then add the comment.
                                     if ($comment->getViewable()) {
                                         $body .= String::html2text($comment->getComments()) . "\n\n";
                                         $hasBody = true;
                                     }
                                 }
                             }
                             $body .= "------------------------------------------------------\n\n";
                         }
//.........这里部分代码省略.........
开发者ID:artkuo,项目名称:ocs,代码行数:101,代码来源:TrackDirectorAction.inc.php

示例5: _sendReviewMailToAuthor

 /**
  * Sends an email with a personal message and the selected
  * review attachements to the author. Also updates the status
  * of the current review round and marks review attachments
  * selected by the editor as "viewable" for the author.
  * @param $seriesEditorSubmission SeriesEditorSubmission
  * @param $status integer One of the REVIEW_ROUND_STATUS_* constants.
  * @param $emailKey string An email template.
  */
 function _sendReviewMailToAuthor(&$seriesEditorSubmission, $status, $emailKey)
 {
     // Retrieve the current review round and update it with the new status.
     $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
     /* @var $reviewRoundDao ReviewRoundDAO */
     $currentReviewRound =& $reviewRoundDao->build($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentReviewType(), $seriesEditorSubmission->getCurrentRound());
     $currentReviewRound->setStatus($status);
     $reviewRoundDao->updateObject($currentReviewRound);
     // Send personal message to author.
     $submitter =& $seriesEditorSubmission->getUser();
     import('classes.mail.MonographMailTemplate');
     $email = new MonographMailTemplate($seriesEditorSubmission, $emailKey);
     $email->setBody($this->getData('personalMessage'));
     $email->addRecipient($submitter->getEmail(), $submitter->getFullName());
     $email->setEventType(MONOGRAPH_EMAIL_EDITOR_NOTIFY_AUTHOR);
     // Retrieve review indexes.
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     /* @var $reviewAssignmentDao ReviewAssignmentDAO */
     $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentRound());
     assert(is_array($reviewIndexes));
     // Add a review index for review attachments not associated with
     // a review assignment (i.e. attachments uploaded by the editor).
     $lastIndex = end($reviewIndexes);
     $reviewIndexes[-1] = $lastIndex + 1;
     // Attach the selected reviewer attachments to the email.
     $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     $selectedAttachments = $this->getData('selectedAttachments');
     if (is_array($selectedAttachments)) {
         foreach ($selectedAttachments as $attachmentId) {
             // Split the attachment into file id and file revision.
             $attachment = explode('-', $attachmentId);
             assert(count($attachment) == 2);
             // Retrieve the monograph file.
             $monographFile =& $submissionFileDao->getRevision($attachment[0], $attachment[1]);
             assert(is_a($monographFile, 'MonographFile'));
             // Check the association information.
             if ($monographFile->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT) {
                 // The review attachment has been uploaded by a reviewer.
                 $reviewAssignmentId = $monographFile->getAssocId();
                 assert(is_numeric($reviewAssignmentId));
             } else {
                 // The review attachment has been uploaded by the editor.
                 $reviewAssignmentId = -1;
             }
             // Identify the corresponding review index.
             assert(isset($reviewIndexes[$reviewAssignmentId]));
             $reviewIndex = $reviewIndexes[$reviewAssignmentId];
             assert(!is_null($reviewIndex));
             // Add the attachment to the email.
             $email->addAttachment($monographFile->getFilePath(), String::enumerateAlphabetically($reviewIndex) . '-' . $monographFile->getOriginalFileName());
             // Update monograph file to set viewable as true, so author
             // can view the file on their submission summary page.
             $monographFile->setViewable(true);
             $submissionFileDao->updateObject($monographFile);
         }
     }
     // Send the email.
     $email->send($request);
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:69,代码来源:EditorDecisionWithEmailForm.inc.php

示例6: execute

 /**
  * Save review assignment
  * @param $args array
  * @param $request PKPRequest
  * @see Form::execute()
  */
 function execute($args, &$request)
 {
     $decision = $this->getDecision();
     $monograph =& $this->getMonograph();
     $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO');
     $seriesEditorSubmission =& $seriesEditorSubmissionDao->getSeriesEditorSubmission($monograph->getId());
     import('classes.submission.seriesEditor.SeriesEditorAction');
     $seriesEditorAction =& new SeriesEditorAction();
     switch ($decision) {
         case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
             // 1. Record the decision
             $seriesEditorAction->recordDecision($seriesEditorSubmission, SUBMISSION_EDITOR_DECISION_DECLINE);
             // 2. select email key
             $emailKey = 'SUBMISSION_UNSUITABLE';
             // 3. Set status of round
             $status = REVIEW_ROUND_STATUS_REVISIONS_REQUESTED;
             break;
         case SUBMISSION_EDITOR_DECISION_RESUBMIT:
             // 1. Record the decision
             $seriesEditorAction->recordDecision($seriesEditorSubmission, SUBMISSION_EDITOR_DECISION_RESUBMIT);
             // 2.  Set status of round
             $status = REVIEW_ROUND_STATUS_RESUBMITTED;
             // 3.  Select email key
             $emailKey = 'EDITOR_DECISION_RESUBMIT';
             break;
         case SUBMISSION_EDITOR_DECISION_DECLINE:
             // 1. Record the decision
             $seriesEditorAction->recordDecision($seriesEditorSubmission, SUBMISSION_EDITOR_DECISION_DECLINE);
             // 2. select email key
             $emailKey = 'SUBMISSION_UNSUITABLE';
             // 3. Set status of round
             $status = REVIEW_ROUND_STATUS_DECLINED;
             break;
         default:
             // only support the three decisions above
             assert(false);
     }
     $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
     $currentReviewRound =& $reviewRoundDao->build($monograph->getId(), $seriesEditorSubmission->getCurrentReviewType(), $seriesEditorSubmission->getCurrentRound());
     $currentReviewRound->setStatus($status);
     $reviewRoundDao->updateObject($currentReviewRound);
     // n. Send Personal message to author
     $submitter = $seriesEditorSubmission->getUser();
     import('classes.mail.MonographMailTemplate');
     $email = new MonographMailTemplate($seriesEditorSubmission, $emailKey);
     $email->setBody($this->getData('personalMessage'));
     $email->addRecipient($submitter->getEmail(), $submitter->getFullName());
     $email->setAssoc(MONOGRAPH_EMAIL_EDITOR_NOTIFY_AUTHOR, MONOGRAPH_EMAIL_TYPE_EDITOR, $currentReviewRound->getRound());
     // Attach the selected reviewer attachments
     $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     $selectedAttachments = $this->getData('selectedAttachments') ? $this->getData('selectedAttachments') : array();
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentRound());
     assert(is_array($reviewIndexes));
     if (is_array($selectedAttachments)) {
         foreach ($selectedAttachments as $attachmentId) {
             $monographFile =& $submissionFileDao->getLatestRevision($attachmentId);
             assert(is_a($monographFile, 'MonographFile'));
             $fileName = $monographFile->getOriginalFileName();
             $reviewAssignmentId = $monographFile->getAssocId();
             assert($monographFile->getAssocType == ASSOC_TYPE_REVIEW_ASSIGNMENT);
             assert(is_numeric($reviewAssignmentId));
             $reviewIndex = $reviewIndexes[$reviewAssignmentId];
             assert(!is_null($reviewIndex));
             $email->addAttachment($monographFile->getFilePath(), String::enumerateAlphabetically($reviewIndex) . '-' . $monographFile->getOriginalFileName());
             // Update monograph to set viewable as true, so author can view the file on their submission summary page
             $monographFile->setViewable(true);
             $submissionFileDao->updateObject($monographFile);
         }
     }
     $email->send();
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:79,代码来源:SendReviewsForm.inc.php

示例7: execute

 /**
  * Save editor decision
  * @param $args array
  * @param $request PKPRequest
  * @see Form::execute()
  */
 function execute($args, &$request)
 {
     import('classes.submission.seriesEditor.SeriesEditorAction');
     $monographDao =& DAORegistry::getDAO('MonographDAO');
     $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
     $monograph =& $this->getMonograph();
     $decision = $this->getDecision();
     switch ($decision) {
         case SUBMISSION_EDITOR_DECISION_ACCEPT:
             // 1. Record the decision
             SeriesEditorAction::recordDecision($monograph, SUBMISSION_EDITOR_DECISION_ACCEPT);
             // 2. select email key
             $emailKey = 'EDITOR_DECISION_ACCEPT';
             // 3. Set status of round
             $status = REVIEW_ROUND_STATUS_ACCEPTED;
             // 4. Assign the default users to the next workflow stage
             Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_EDITING);
             $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_EDITING);
             $monographDao->updateMonograph($monograph);
             break;
         case SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW:
             // 1. Record the decision
             SeriesEditorAction::recordDecision($monograph, SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW);
             // 2. Create a new external review round
             $reviewRoundDao->build($monograph->getId(), REVIEW_TYPE_EXTERNAL, 1, 1);
             // 3. Get selected files and put in review_round_files table
             $selectedFiles = $this->getData('selectedFiles');
             $filesForReview = array();
             foreach ($selectedFiles as $selectedFile) {
                 $filesForReview[] = explode("-", $selectedFile);
             }
             $reviewRoundDao->setFilesForReview($monograph->getId(), REVIEW_TYPE_EXTERNAL, 1, $filesForReview);
             // 4. select email key
             // FIXME #6123: will we have an email key for this decision?
             $emailKey = 'EDITOR_DECISION_ACCEPT';
             // 5. Set status of round
             $status = REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL;
             // 6. Assign the default users to the next workflow stage
             Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_EXTERNAL_REVIEW);
             $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_EXTERNAL_REVIEW);
             $monograph->setCurrentRound(1);
             $monographDao->updateMonograph($monograph);
             break;
         default:
             // only support the three decisions above
             assert(false);
     }
     $currentReviewRound =& $reviewRoundDao->build($monograph->getId(), $monograph->getCurrentReviewType(), $monograph->getCurrentRound());
     $currentReviewRound->setStatus($status);
     $reviewRoundDao->updateObject($currentReviewRound);
     // n. Send Personal message to author
     $submitter =& $monograph->getUser();
     import('classes.mail.MonographMailTemplate');
     $email =& new MonographMailTemplate($monograph, $emailKey, null, true);
     $email->setBody($this->getData('personalMessage'));
     $email->addRecipient($submitter->getEmail(), $submitter->getFullName());
     $email->setAssoc(MONOGRAPH_EMAIL_EDITOR_NOTIFY_AUTHOR, MONOGRAPH_EMAIL_TYPE_EDITOR, $currentReviewRound->getRound());
     // Attach the selected reviewer attachments
     $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     $selectedAttachments = $this->getData('selectedAttachments') ? $this->getData('selectedAttachments') : array();
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($monograph->getId(), $monograph->getCurrentRound());
     assert(is_array($reviewIndexes));
     if (is_array($selectedAttachments)) {
         foreach ($selectedAttachments as $attachmentId) {
             $monographFile =& $submissionFileDao->getLatestRevision($attachmentId);
             $fileName = $monographFile->getOriginalFileName();
             $reviewAssignmentId = $monographFile->getAssocId();
             assert($monographFile->getAssocType == ASSOC_TYPE_REVIEW_ASSIGNMENT);
             assert(is_numeric($reviewAssignmentId));
             $email->addAttachment($monographFile->getFilePath(), String::enumerateAlphabetically($reviewIndexes[$reviewAssignmentId]) . '-' . $monographFile->getOriginalFileName());
             // Update monograph to set viewable as true, so author can view the file on their submission summary page
             $monographFile->setViewable(true);
             $submissionFileDao->updateObject($monographFile);
         }
     }
     $email->send();
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:85,代码来源:PromoteForm.inc.php

示例8: importPeerReviews

 /**
  * Import all free-text/review form reviews to paste into message
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function importPeerReviews($args, $request)
 {
     // Retrieve the authorized submission.
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     // Retrieve the current review round.
     $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
     // Retrieve peer reviews.
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $submissionCommentDao = DAORegistry::getDAO('SubmissionCommentDAO');
     $reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
     $reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId());
     $reviewIndexes = $reviewAssignmentDao->getReviewIndexesForRound($submission->getId(), $reviewRound->getId());
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
     $body = '';
     $textSeparator = '------------------------------------------------------';
     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
             $submissionComments = $submissionCommentDao->getSubmissionComments($submission->getId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId());
             $body .= "\n\n{$textSeparator}\n";
             // If it is not a double blind review, show reviewer's name.
             if ($reviewAssignment->getReviewMethod() != SUBMISSION_REVIEW_METHOD_DOUBLEBLIND) {
                 $body .= $reviewAssignment->getReviewerFullName() . "\n";
             } else {
                 $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n";
             }
             while ($comment = $submissionComments->next()) {
                 // If the comment is viewable by the author, then add the comment.
                 if ($comment->getViewable()) {
                     $body .= String::html2text($comment->getComments()) . "\n\n";
                 }
             }
             $body .= "{$textSeparator}\n\n";
             if ($reviewFormId = $reviewAssignment->getReviewFormId()) {
                 $reviewId = $reviewAssignment->getId();
                 $reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewFormId);
                 if (!$submissionComments) {
                     $body .= "{$textSeparator}\n";
                     $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n\n";
                 }
                 while ($reviewFormElement = $reviewFormElements->next()) {
                     $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]) . "\n";
                                 }
                             } else {
                                 $body .= "\t" . String::html2text($possibleResponses[$reviewFormResponse->getValue()]) . "\n";
                             }
                             $body .= "\n";
                         } else {
                             $body .= "\t" . String::html2text($reviewFormResponse->getValue()) . "\n\n";
                         }
                     }
                 }
                 $body .= "{$textSeparator}\n\n";
             }
         }
     }
     if (empty($body)) {
         return new JSONMessage(false, __('editor.review.noReviews'));
     } else {
         return new JSONMessage(true, $body);
     }
 }
开发者ID:energylevels,项目名称:pkp-lib,代码行数:77,代码来源:PKPEditorDecisionHandler.inc.php


注:本文中的String::enumerateAlphabetically方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。