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


PHP PKPString::enumerateAlphabetically方法代码示例

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


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

示例1: 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 .= "<br><br>{$textSeparator}<br>";
             // If it is an open review, show reviewer's name.
             if ($reviewAssignment->getReviewMethod() == SUBMISSION_REVIEW_METHOD_OPEN) {
                 $body .= $reviewAssignment->getReviewerFullName() . "<br>\n";
             } else {
                 $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => PKPString::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "<br>\n";
             }
             while ($comment = $submissionComments->next()) {
                 // If the comment is viewable by the author, then add the comment.
                 if ($comment->getViewable()) {
                     $body .= PKPString::html2text($comment->getComments()) . "\n\n";
                 }
             }
             $body .= "<br>{$textSeparator}<br><br>";
             if ($reviewFormId = $reviewAssignment->getReviewFormId()) {
                 $reviewId = $reviewAssignment->getId();
                 $reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewFormId);
                 if (!$submissionComments) {
                     $body .= "{$textSeparator}\n";
                     $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => PKPString::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n\n";
                 }
                 while ($reviewFormElement = $reviewFormElements->next()) {
                     $body .= PKPString::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" . PKPString::html2text($possibleResponses[$value]) . "\n";
                                 }
                             } else {
                                 $body .= "\t" . PKPString::html2text($possibleResponses[$reviewFormResponse->getValue()]) . "\n";
                             }
                             $body .= "\n";
                         } else {
                             $body .= "\t" . PKPString::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:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:77,代码来源:PKPEditorDecisionHandler.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(), PKPString::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();
         $user = $request->getUser();
         $email->assignParams(array('submissionUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'authorDashboard', 'submission', $submission->getId()), 'contextName' => $context->getLocalizedName(), 'authorName' => $submission->getAuthorString(), 'editorialContactSignature' => $user->getContactSignature()));
         $email->send($request);
     }
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:77,代码来源:EditorDecisionWithEmailForm.inc.php


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