Exemple #1
0
 /**
  * Records the reviewer's submission recommendation.
  * @param $reviewId int
  * @param $recommendation int
  * @param $send boolean
  */
 function recordRecommendation(&$reviewerSubmission, $recommendation, $send)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     // Check validity of selected recommendation
     $reviewerRecommendationOptions =& ReviewAssignment::getReviewerRecommendationOptions();
     if (!isset($reviewerRecommendationOptions[$recommendation])) {
         return true;
     }
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewerSubmission->getReviewId());
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return true;
     }
     // Only record the reviewers recommendation if
     // no recommendation has previously been submitted.
     if ($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation === '') {
         import('mail.PaperMailTemplate');
         $email = new PaperMailTemplate($reviewerSubmission, 'REVIEW_COMPLETE');
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setFrom($reviewer->getEmail(), $reviewer->getFullName());
         if (!$email->isEnabled() || $send && !$email->hasErrors()) {
             HookRegistry::call('ReviewerAction::recordRecommendation', array(&$reviewerSubmission, &$email, $recommendation));
             if ($email->isEnabled()) {
                 $email->setAssoc(PAPER_EMAIL_REVIEW_COMPLETE, PAPER_EMAIL_TYPE_REVIEW, $reviewerSubmission->getReviewId());
                 $email->send();
             }
             $reviewAssignment->setRecommendation($recommendation);
             $reviewAssignment->setDateCompleted(Core::getCurrentDate());
             $reviewAssignment->stampModified();
             $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
             // Add log
             import('paper.log.PaperLog');
             import('paper.log.PaperEventLogEntry');
             $entry = new PaperEventLogEntry();
             $entry->setPaperId($reviewAssignment->getPaperId());
             $entry->setUserId($reviewer->getId());
             $entry->setDateLogged(Core::getCurrentDate());
             $entry->setEventType(PAPER_LOG_REVIEW_RECOMMENDATION);
             $entry->setLogMessage('log.review.reviewRecommendationSet', array('reviewerName' => $reviewer->getFullName(), 'paperId' => $reviewAssignment->getPaperId(), 'stage' => $reviewAssignment->getStage()));
             $entry->setAssocType(LOG_TYPE_REVIEW);
             $entry->setAssocId($reviewAssignment->getId());
             PaperLog::logEventEntry($reviewAssignment->getPaperId(), $entry);
         } else {
             if (!Request::getUserVar('continued')) {
                 $assignedDirectors = $email->toAssignedDirectors($reviewerSubmission->getPaperId());
                 $reviewingTrackDirectors = $email->toAssignedTrackDirectors($reviewerSubmission->getPaperId());
                 if (empty($assignedDirectors) && empty($reviewingTrackDirectors)) {
                     $schedConf =& Request::getSchedConf();
                     $email->addRecipient($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                     $editorialContactName = $schedConf->getSetting('contactName');
                 } else {
                     if (!empty($reviewingTrackDirectors)) {
                         $editorialContact = array_shift($reviewingTrackDirectors);
                     } else {
                         $editorialContact = array_shift($assignedDirectors);
                     }
                     $editorialContactName = $editorialContact->getDirectorFullName();
                 }
                 $reviewerRecommendationOptions =& ReviewAssignment::getReviewerRecommendationOptions();
                 $email->assignParams(array('editorialContactName' => $editorialContactName, 'reviewerName' => $reviewer->getFullName(), 'paperTitle' => strip_tags($reviewerSubmission->getLocalizedTitle()), 'recommendation' => Locale::translate($reviewerRecommendationOptions[$recommendation])));
             }
             $email->displayEditForm(Request::url(null, null, 'reviewer', 'recordRecommendation'), array('reviewId' => $reviewerSubmission->getReviewId(), 'recommendation' => $recommendation));
             return false;
         }
     }
     return true;
 }
 /**
  * Records the reviewer's submission recommendation.
  * @param $reviewId int
  * @param $recommendation int
  * @param $send boolean
  */
 function emailDirector($reviewerSubmission, $paperId, $send)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     // Check validity of selected recommendation
     //$reviewerRecommendationOptions =& ReviewAssignment::getReviewerRecommendationOptions();
     //$reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewerSubmission->getReviewId());
     //$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     $reviewer = Request::getUser();
     if (!isset($reviewer)) {
         return true;
     }
     // Only record the reviewers recommendation if
     // no recommendation has previously been submitted.
     if (true) {
         import('mail.PaperMailTemplate');
         $email = new PaperMailTemplate($reviewerSubmission, 'REVIEW_EMAIL_DIRECTOR');
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setFrom($reviewer->getEmail(), $reviewer->getFullName());
         if (!$email->isEnabled() || $send && !$email->hasErrors()) {
             if ($email->isEnabled()) {
                 $email->setAssoc(PAPER_EMAIL_REVIEW_COMPLETE, PAPER_EMAIL_TYPE_REVIEW, $reviewerSubmission->getReviewId());
                 $email->send();
             }
         } else {
             if (!Request::getUserVar('continued')) {
                 $assignedDirectors = $email->toAssignedDirectors($paperId);
                 $reviewingTrackDirectors = $email->toAssignedTrackDirectors($paperId);
                 if (empty($assignedDirectors) && empty($reviewingTrackDirectors)) {
                     $schedConf =& Request::getSchedConf();
                     $email->addRecipient($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                     $editorialContactName = $schedConf->getSetting('contactName');
                 } else {
                     if (!empty($reviewingTrackDirectors)) {
                         $editorialContact = array_shift($reviewingTrackDirectors);
                     } else {
                         $editorialContact = array_shift($assignedDirectors);
                     }
                     $editorialContactName = $editorialContact->getDirectorFullName();
                 }
                 $submissionUrl = Request::url(null, null, 'director', 'submissionAssignReviewer', $paperId, array(), "peerReview");
                 $email->assignParams(array('editorialContactName' => $editorialContactName, 'reviewerName' => $reviewer->getFullName(), 'paperTitle' => strip_tags($reviewerSubmission->getLocalizedTitle()), 'submissionUrl' => $submissionUrl));
             }
             $email->displayEditForm(Request::url(null, null, 'reviewer', 'submission', $reviewerSubmission->getPaperId()));
             return false;
         }
     }
     return true;
 }