예제 #1
0
 /**
  * Assigns a track director to a submission.
  * @param $paperId int
  * @return boolean true iff ready for redirect
  */
 function assignDirector($paperId, $trackDirectorId, $isDirector = false, $send = false)
 {
     $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
     $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     $conference =& Request::getConference();
     $directorSubmission =& $directorSubmissionDao->getDirectorSubmission($paperId);
     $trackDirector =& $userDao->getUser($trackDirectorId);
     if (!isset($trackDirector)) {
         return true;
     }
     import('mail.PaperMailTemplate');
     $email = new PaperMailTemplate($directorSubmission, 'DIRECTOR_ASSIGN');
     if ($user->getId() === $trackDirectorId || !$email->isEnabled() || $send && !$email->hasErrors()) {
         HookRegistry::call('DirectorAction::assignDirector', array(&$directorSubmission, &$trackDirector, &$isDirector, &$email));
         if ($email->isEnabled() && $user->getId() !== $trackDirectorId) {
             $email->setAssoc(PAPER_EMAIL_DIRECTOR_ASSIGN, PAPER_EMAIL_TYPE_DIRECTOR, $trackDirector->getId());
             $email->send();
         }
         $editAssignment = new EditAssignment();
         $editAssignment->setPaperId($paperId);
         // Make the selected director the new director
         $editAssignment->setDirectorId($trackDirectorId);
         $editAssignment->setDateNotified(Core::getCurrentDate());
         $editAssignment->setDateUnderway(null);
         $editAssignments =& $directorSubmission->getEditAssignments();
         array_push($editAssignments, $editAssignment);
         $directorSubmission->setEditAssignments($editAssignments);
         $directorSubmissionDao->updateDirectorSubmission($directorSubmission);
         // Add log
         import('paper.log.PaperLog');
         import('paper.log.PaperEventLogEntry');
         PaperLog::logEvent($paperId, PAPER_LOG_DIRECTOR_ASSIGN, LOG_TYPE_DIRECTOR, $trackDirectorId, 'log.director.directorAssigned', array('directorName' => $trackDirector->getFullName(), 'paperId' => $paperId));
         return true;
     } else {
         if (!Request::getUserVar('continued')) {
             $email->addRecipient($trackDirector->getEmail(), $trackDirector->getFullName());
             $submissionUrl = Request::url(null, null, $isDirector ? 'director' : 'trackDirector', 'submissionReview', $paperId);
             $submissionUrl = $submissionUrl . "?u=" . $trackDirector->getUserId();
             $paramArray = array('editorialContactName' => $trackDirector->getFullName(), 'directorUsername' => $trackDirector->getUsername(), 'directorPassword' => $trackDirector->getPassword(), 'editorialContactSignature' => $user->getContactSignature(), 'submissionUrl' => $submissionUrl);
             $email->assignParams($paramArray);
         }
         $email->displayEditForm(Request::url(null, null, null, 'assignDirector', 'send'), array('paperId' => $paperId, 'directorId' => $trackDirectorId));
         return false;
     }
 }
예제 #2
0
 /**
  * Automatically assign Track Directors to new submissions.
  * @param $paper object
  * @return array of track directors
  */
 function assignDirectors(&$paper)
 {
     $trackId = $paper->getTrackId();
     $schedConf =& Request::getSchedConf();
     $trackDirectorsDao =& DAORegistry::getDAO('TrackDirectorsDAO');
     $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
     $trackDirectors =& $trackDirectorsDao->getDirectorsByTrackId($schedConf->getId(), $trackId);
     foreach ($trackDirectors as $trackDirector) {
         $editAssignment = new EditAssignment();
         $editAssignment->setPaperId($paper->getId());
         $editAssignment->setDirectorId($trackDirector->getId());
         $editAssignmentDao->insertEditAssignment($editAssignment);
         unset($editAssignment);
     }
     return $trackDirectors;
 }
예제 #3
0
 /**
  * Internal function to return an edit assignment object from a row.
  * @param $row array
  * @return EditAssignment
  */
 function &_returnEditAssignmentFromRow(&$row)
 {
     $editAssignment = new EditAssignment();
     $editAssignment->setEditId($row['edit_id']);
     $editAssignment->setPaperId($row['paper_id']);
     $editAssignment->setDirectorId($row['director_id']);
     $editAssignment->setDirectorFullName($row['first_name'] . ' ' . $row['last_name']);
     $editAssignment->setDirectorFirstName($row['first_name']);
     $editAssignment->setDirectorLastName($row['last_name']);
     $editAssignment->setDirectorInitials($row['initials']);
     $editAssignment->setDirectorEmail($row['email']);
     $editAssignment->setIsDirector($row['director_role_id'] == ROLE_ID_DIRECTOR ? 1 : 0);
     $editAssignment->setDateUnderway($this->datetimeFromDB($row['date_underway']));
     $editAssignment->setDateNotified($this->datetimeFromDB($row['date_notified']));
     HookRegistry::call('EditAssignmentDAO::_returnEditAssignmentFromRow', array(&$editAssignment, &$row));
     return $editAssignment;
 }