Exemplo n.º 1
0
 /**
  * Records whether or not the reviewer accepts the review assignment.
  * @param $request PKPRequest
  * @param $reviewAssignment ReviewAssignment
  * @param $submission Submission
  * @param $decline boolean
  * @param $emailText string optional
  */
 function confirmReview($request, $reviewAssignment, $submission, $decline, $emailText = null)
 {
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     $reviewer = $userDao->getById($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return true;
     }
     // Only confirm the review for the reviewer if
     // he has not previously done so.
     if ($reviewAssignment->getDateConfirmed() == null) {
         $email = $this->getResponseEmail($submission, $reviewAssignment, $request, $decline);
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setReplyTo($reviewer->getEmail(), $reviewer->getFullName());
         HookRegistry::call('ReviewerAction::confirmReview', array($request, &$submission, &$email, $decline));
         import('lib.pkp.classes.log.PKPSubmissionEmailLogEntry');
         // Import email event constants
         $email->setEventType($decline ? SUBMISSION_EMAIL_REVIEW_DECLINE : SUBMISSION_EMAIL_REVIEW_CONFIRM);
         if ($emailText) {
             $email->setBody($emailText);
         }
         $email->send($request);
         $reviewAssignment->setDeclined($decline);
         $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateObject($reviewAssignment);
         // Add log
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         $entry = new SubmissionEventLogEntry();
         $entry->setSubmissionId($reviewAssignment->getSubmissionId());
         $entry->setUserId($reviewer->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType($decline ? SUBMISSION_LOG_REVIEW_DECLINE : SUBMISSION_LOG_REVIEW_ACCEPT);
         SubmissionLog::logEvent($request, $submission, $decline ? SUBMISSION_LOG_REVIEW_DECLINE : SUBMISSION_LOG_REVIEW_ACCEPT, $decline ? 'log.review.reviewDeclined' : 'log.review.reviewAccepted', array('reviewerName' => $reviewer->getFullName(), 'submissionId' => $reviewAssignment->getSubmissionId(), 'round' => $reviewAssignment->getRound()));
     }
 }
 /**
  * An action triggered by a confirmation modal to allow an editor to unconsider a review.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function unconsiderReview($args, $request)
 {
     if (!$request->checkCSRF()) {
         return new JSONMessage(false);
     }
     // This resets the state of the review to 'unread', but does not delete note history.
     $submission = $this->getSubmission();
     $user = $request->getUser();
     $reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT);
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment->setUnconsidered(REVIEW_ASSIGNMENT_UNCONSIDERED);
     $reviewAssignmentDao->updateObject($reviewAssignment);
     $this->_updateReviewRoundStatus($reviewAssignment);
     // log the unconsider.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     $entry = new SubmissionEventLogEntry();
     $entry->setSubmissionId($reviewAssignment->getSubmissionId());
     $entry->setUserId($user->getId());
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setEventType(SUBMISSION_LOG_REVIEW_UNCONSIDERED);
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_UNCONSIDERED, 'log.review.reviewUnconsidered', array('editorName' => $user->getFullName(), 'submissionId' => $submission->getId(), 'round' => $reviewAssignment->getRound()));
     return DAO::getDataChangedEvent($reviewAssignment->getId());
 }