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


PHP TemporaryFileManager::articleToTemporaryFile方法代码示例

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


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

示例1: notifyReviewer

 /**
  * Notifies a reviewer about a review assignment.
  * @param $sectionEditorSubmission object
  * @param $reviewId int
  * @param $send boolean
  * @param $request object
  * @return boolean true iff ready for redirect
  */
 function notifyReviewer($sectionEditorSubmission, $reviewId, $send, $request)
 {
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $journal =& $request->getJournal();
     $user =& $request->getUser();
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $isEmailBasedReview = $journal->getSetting('mailSubmissionsToReviewers') == 1 ? true : false;
     $reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
     // If we're using access keys, disable the address fields
     // for this message. (Prevents security issue: section editor
     // could CC or BCC someone else, or change the reviewer address,
     // in order to get the access key.)
     $preventAddressChanges = $reviewerAccessKeysEnabled;
     import('classes.mail.ArticleMailTemplate');
     // Determine which email template to use based on journal settings and current round
     switch (true) {
         case $isEmailBasedReview && $reviewAssignment->getRound() == 1:
             $emailTemplate = 'REVIEW_REQUEST_ATTACHED';
             break;
         case $isEmailBasedReview && $reviewAssignment->getRound() > 1:
             $emailTemplate = 'REVIEW_REQUEST_ATTACHED_SUBSEQUENT';
             break;
         case $reviewerAccessKeysEnabled && $reviewAssignment->getRound() == 1:
             $emailTemplate = 'REVIEW_REQUEST_ONECLICK';
             break;
         case $reviewerAccessKeysEnabled && $reviewAssignment->getRound() > 1:
             $emailTemplate = 'REVIEW_REQUEST_ONECLICK_SUBSEQUENT';
             break;
         case $reviewAssignment->getRound() == 1:
             $emailTemplate = 'REVIEW_REQUEST';
             break;
         case $reviewAssignment->getRound() > 1:
             $emailTemplate = 'REVIEW_REQUEST_SUBSEQUENT';
             break;
     }
     $email = new ArticleMailTemplate($sectionEditorSubmission, $emailTemplate, null, $isEmailBasedReview ? true : null);
     if ($preventAddressChanges) {
         $email->setAddressFieldsEnabled(false);
     }
     if ($reviewAssignment->getSubmissionId() == $sectionEditorSubmission->getId() && $reviewAssignment->getReviewFileId()) {
         $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
         if (!isset($reviewer)) {
             return true;
         }
         if (!$email->isEnabled() || $send && !$email->hasErrors()) {
             HookRegistry::call('SectionEditorAction::notifyReviewer', array(&$sectionEditorSubmission, &$reviewAssignment, &$email));
             if ($email->isEnabled()) {
                 if ($reviewerAccessKeysEnabled) {
                     import('lib.pkp.classes.security.AccessKeyManager');
                     import('pages.reviewer.ReviewerHandler');
                     $accessKeyManager = new AccessKeyManager();
                     // Key lifetime is the typical review period plus four weeks
                     $keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
                     $email->addPrivateParam('ACCESS_KEY', $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime));
                 }
                 if ($preventAddressChanges) {
                     // Ensure that this messages goes to the reviewer, and the reviewer ONLY.
                     $email->clearAllRecipients();
                     $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
                 }
                 $email->send($request);
             }
             $reviewAssignment->setDateNotified(Core::getCurrentDate());
             $reviewAssignment->setCancelled(0);
             $reviewAssignment->stampModified();
             $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
             return true;
         } else {
             if (!$request->getUserVar('continued') || $preventAddressChanges) {
                 $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
             }
             if (!$request->getUserVar('continued')) {
                 $weekLaterDate = strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week'));
                 if ($reviewAssignment->getDateDue() != null) {
                     $reviewDueDate = strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue()));
                 } else {
                     $numWeeks = max((int) $journal->getSetting('numWeeksPerReview'), 2);
                     $reviewDueDate = strftime(Config::getVar('general', 'date_format_short'), strtotime('+' . $numWeeks . ' week'));
                 }
                 $submissionUrl = $request->url(null, 'reviewer', 'submission', $reviewId, $reviewerAccessKeysEnabled ? array('key' => 'ACCESS_KEY') : array());
                 $paramArray = array('reviewerName' => $reviewer->getFullName(), 'weekLaterDate' => $weekLaterDate, 'reviewDueDate' => $reviewDueDate, 'reviewerUsername' => $reviewer->getUsername(), 'reviewerPassword' => $reviewer->getPassword(), 'editorialContactSignature' => $user->getContactSignature(), 'reviewGuidelines' => String::html2text($journal->getLocalizedSetting('reviewGuidelines')), 'submissionReviewUrl' => $submissionUrl, 'abstractTermIfEnabled' => $sectionEditorSubmission->getLocalizedAbstract() == '' ? '' : __('article.abstract'), 'passwordResetUrl' => $request->url(null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))));
                 $email->assignParams($paramArray);
                 if ($isEmailBasedReview) {
                     // An email-based review process was selected. Attach
                     // the current review version.
                     import('classes.file.TemporaryFileManager');
                     $temporaryFileManager = new TemporaryFileManager();
                     $reviewVersion =& $sectionEditorSubmission->getReviewFile();
                     if ($reviewVersion) {
                         $temporaryFile = $temporaryFileManager->articleToTemporaryFile($reviewVersion, $user->getId());
//.........这里部分代码省略.........
开发者ID:yuricampos,项目名称:ojs,代码行数:101,代码来源:SectionEditorAction.inc.php

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


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