Ejemplo n.º 1
0
 function setDueDate($args, $request)
 {
     $paperId = (int) array_shift($args);
     $reviewId = (int) array_shift($args);
     $this->validate($request, $paperId, TRACK_DIRECTOR_ACCESS_REVIEW);
     $conference =& $request->getConference();
     $schedConf =& $request->getSchedConf();
     $submission =& $this->submission;
     $dueDate = $request->getUserVar('dueDate');
     $numWeeks = $request->getUserVar('numWeeks');
     if ($dueDate != null || $numWeeks != null) {
         TrackDirectorAction::setDueDate($paperId, $reviewId, $dueDate, $numWeeks);
         $request->redirect(null, null, null, 'submissionReview', $paperId);
     } else {
         $this->setupTemplate($request, true, $paperId, 'review');
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         $reviewAssignment = $reviewAssignmentDao->getById($reviewId);
         $settings = $schedConf->getSettings();
         $templateMgr =& TemplateManager::getManager();
         if ($reviewAssignment->getDateDue() != null) {
             $templateMgr->assign('dueDate', $reviewAssignment->getDateDue());
         }
         if ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
             // Get number of days from now until review deadline date
             $reviewDeadlineDate = strtotime($schedConf->getSetting('numWeeksPerReviewAbsolute'));
             $daysDiff = ($reviewDeadlineDate - strtotime(date("Y-m-d"))) / (60 * 60 * 24);
             $numWeeksPerReview = round($daysDiff / 7);
         } elseif ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_RELATIVE) {
             $numWeeksPerReview = (int) $schedConf->getSetting('numWeeksPerReviewRelative');
         } else {
             $numWeeksPerReview = 0;
         }
         $templateMgr->assign('paperId', $paperId);
         $templateMgr->assign('reviewId', $reviewId);
         $templateMgr->assign('todaysDate', date('Y-m-d'));
         $templateMgr->assign('numWeeksPerReview', $numWeeksPerReview);
         $templateMgr->assign('actionHandler', 'setDueDate');
         $templateMgr->display('trackDirector/setDueDate.tpl');
     }
 }
Ejemplo n.º 2
0
 /**
  * Assigns a reviewer to a submission.
  * @param $trackDirectorSubmission object
  * @param $reviewerId int
  * @param $stage int
  */
 function addReviewer($trackDirectorSubmission, $reviewerId, $stage)
 {
     $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     $reviewer =& $userDao->getUser($reviewerId);
     // Check to see if the requested reviewer is not already
     // assigned to review this paper.
     if ($stage == null) {
         $stage = $trackDirectorSubmission->getCurrentStage();
     }
     $assigned = $trackDirectorSubmissionDao->reviewerExists($trackDirectorSubmission->getPaperId(), $reviewerId, $stage);
     // Only add the reviewer if he has not already
     // been assigned to review this paper.
     if (!$assigned && isset($reviewer) && !HookRegistry::call('TrackDirectorAction::addReviewer', array(&$trackDirectorSubmission, $reviewerId))) {
         $reviewAssignment = new ReviewAssignment();
         $reviewAssignment->setReviewerId($reviewerId);
         $reviewAssignment->setDateAssigned(Core::getCurrentDate());
         $reviewAssignment->setStage($stage);
         // Assign review form automatically if needed
         $schedConfId = $trackDirectorSubmission->getSchedConfId();
         $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
         $schedConf =& $schedConfDao->getSchedConf($schedConfId);
         $conferenceId = $schedConf->getConferenceId();
         $trackDao =& DAORegistry::getDAO('TrackDAO');
         $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
         $trackId = $trackDirectorSubmission->getTrackId();
         $track =& $trackDao->getTrack($trackId, $conferenceId);
         if ($track && ($reviewFormId = (int) $track->getReviewFormId())) {
             if ($reviewFormDao->reviewFormExists($reviewFormId, ASSOC_TYPE_CONFERENCE, $conferenceId)) {
                 $reviewAssignment->setReviewFormId($reviewFormId);
             }
         }
         $trackDirectorSubmission->addReviewAssignment($reviewAssignment);
         $trackDirectorSubmissionDao->updateTrackDirectorSubmission($trackDirectorSubmission);
         $reviewAssignment = $reviewAssignmentDao->getReviewAssignment($trackDirectorSubmission->getPaperId(), $reviewerId, $stage);
         $schedConf =& Request::getSchedConf();
         if ($schedConf->getSetting('reviewDeadlineType') != null) {
             if ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
                 TrackDirectorAction::setDueDate($trackDirectorSubmission->getPaperId(), $reviewAssignment->getId(), $schedConf->getSetting('numWeeksPerReviewAbsolute'), null, false);
             } elseif ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_RELATIVE) {
                 TrackDirectorAction::setDueDate($trackDirectorSubmission->getPaperId(), $reviewAssignment->getId(), null, $schedConf->getSetting('numWeeksPerReviewRelative'), false);
             }
         }
         // Add log
         import('paper.log.PaperLog');
         import('paper.log.PaperEventLogEntry');
         PaperLog::logEvent($trackDirectorSubmission->getPaperId(), PAPER_LOG_REVIEW_ASSIGN, LOG_TYPE_REVIEW, $reviewAssignment->getId(), 'log.review.reviewerAssigned', array('reviewerName' => $reviewer->getFullName(), 'paperId' => $trackDirectorSubmission->getPaperId(), 'stage' => $stage));
     }
 }