示例#1
0
 /**
  * Add a new event log entry with the specified parameters, including log level.
  * @param $paperId int
  * @param $logLevel char
  * @param $eventType int
  * @param $assocType int
  * @param $assocId int
  * @param $messageKey string
  * @param $messageParams array
  */
 function logEventLevel($paperId, $logLevel, $eventType, $assocType = 0, $assocId = 0, $messageKey = null, $messageParams = array())
 {
     $entry = new PaperEventLogEntry();
     $entry->setLogLevel($logLevel);
     $entry->setEventType($eventType);
     $entry->setAssocType($assocType);
     $entry->setAssocId($assocId);
     if (isset($messageKey)) {
         $entry->setLogMessage($messageKey, $messageParams);
     }
     return PaperLog::logEventEntry($paperId, $entry);
 }
示例#2
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;
     }
 }
 /**
  * Save changes to paper.
  */
 function execute()
 {
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $conference = Request::getConference();
     $schedConf = Request::getSchedConf();
     // Update paper
     $paper =& $this->paper;
     $paper->setDateSubmitted(Core::getCurrentDate());
     $paper->setSubmissionProgress(0);
     $paper->stampStatusModified();
     // We've collected the paper now -- bump the review progress
     if ($this->paper->getSubmissionFileId() != null) {
         $paper->setCurrentStage(REVIEW_STAGE_PRESENTATION);
     }
     $paperDao->updatePaper($paper);
     // Designate this as the review version by default.
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paper->getId());
     AuthorAction::designateReviewVersion($authorSubmission);
     unset($authorSubmission);
     // Update any review assignments so they may access the file
     $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paper->getId());
     $reviewAssignments =& $reviewAssignmentDao->getReviewAssignmentsByPaperId($paper->getId(), REVIEW_STAGE_PRESENTATION);
     foreach ($reviewAssignments as $reviewAssignment) {
         $reviewAssignment->setReviewFileId($authorSubmission->getReviewFileId());
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
     }
     $reviewMode = $authorSubmission->getReviewMode();
     $user =& Request::getUser();
     if ($reviewMode == REVIEW_MODE_BOTH_SIMULTANEOUS || $reviewMode == REVIEW_MODE_PRESENTATIONS_ALONE) {
         // Editors have not yet been assigned; assign them.
         $this->assignDirectors($paper);
     }
     $this->confirmSubmission($paper, $user, $schedConf, $conference, $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_UPLOAD_ACK' : 'SUBMISSION_ACK');
     // 同時寄一封給大會主席
     $this->confirmSubmissionBBC($paper, $user, $schedConf, $conference, $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_UPLOAD_ACK_BCC' : 'SUBMISSION_ACK_BCC');
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     PaperLog::logEvent($this->paperId, PAPER_LOG_PRESENTATION_SUBMIT, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.presentationSubmitted', array('submissionId' => $paper->getId(), 'authorName' => $user->getFullName()));
     return $this->paperId;
 }
示例#4
0
 function handlePaperNode(&$conference, &$schedConf, &$paperNode, &$track, &$paper, &$publishedPaper, &$errors, &$user, $isCommandLine, &$dependentItems)
 {
     $errors = array();
     $conferenceSupportedLocales = array_keys($conference->getSupportedLocaleNames());
     // => locales must be set up before
     $conferencePrimaryLocale = $conference->getPrimaryLocale();
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     $paper = new Paper();
     $paper->setSchedConfId($schedConf->getId());
     $paper->setUserId($user->getId());
     $paper->setTrackId($track->getId());
     $paper->setStatus(STATUS_PUBLISHED);
     $paper->setSubmissionProgress(0);
     $paper->setCurrentStage(REVIEW_STAGE_ABSTRACT);
     $paper->setReviewMode(REVIEW_MODE_ABSTRACTS_ALONE);
     $paper->setDateSubmitted(Core::getCurrentDate());
     $paper->stampStatusModified();
     $titleExists = false;
     for ($index = 0; $node = $paperNode->getChildByName('title', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $conferencePrimaryLocale;
         } elseif (!in_array($locale, $conferenceSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.paperTitleLocaleUnsupported', array('paperTitle' => $node->getValue(), 'locale' => $locale));
             return false;
         }
         $paper->setTitle($node->getValue(), $locale);
         $titleExists = true;
     }
     if (!$titleExists || $paper->getTitle($conferencePrimaryLocale) == "") {
         $errors[] = array('plugins.importexport.native.import.error.paperTitleMissing', array('trackTitle' => $track->getLocalizedTitle()));
         return false;
     }
     for ($index = 0; $node = $paperNode->getChildByName('abstract', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $conferencePrimaryLocale;
         } elseif (!in_array($locale, $conferenceSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.paperAbstractLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
             return false;
         }
         $paper->setAbstract($node->getValue(), $locale);
     }
     if ($indexingNode = $paperNode->getChildByName('indexing')) {
         for ($index = 0; $node = $indexingNode->getChildByName('discipline', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $conferencePrimaryLocale;
             } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.paperDisciplineLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                 return false;
             }
             $paper->setDiscipline($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('type', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $conferencePrimaryLocale;
             } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.paperTypeLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                 return false;
             }
             $paper->setType($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('subject', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $conferencePrimaryLocale;
             } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.paperSubjectLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                 return false;
             }
             $paper->setSubject($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('subject_class', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $conferencePrimaryLocale;
             } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.paperSubjectClassLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                 return false;
             }
             $paper->setSubjectClass($node->getValue(), $locale);
         }
         if ($coverageNode = $indexingNode->getChildByName('coverage')) {
             for ($index = 0; $node = $coverageNode->getChildByName('geographical', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $conferencePrimaryLocale;
                 } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.paperCoverageGeoLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                     return false;
                 }
                 $paper->setCoverageGeo($node->getValue(), $locale);
             }
             for ($index = 0; $node = $coverageNode->getChildByName('chronological', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $conferencePrimaryLocale;
                 } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.paperCoverageChronLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                     return false;
                 }
                 $paper->setCoverageChron($node->getValue(), $locale);
             }
             for ($index = 0; $node = $coverageNode->getChildByName('sample', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $conferencePrimaryLocale;
                 } elseif (!in_array($locale, $conferenceSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.paperCoverageSampleLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
                     return false;
                 }
                 $paper->setCoverageSample($node->getValue(), $locale);
             }
         }
     }
     for ($index = 0; $node = $paperNode->getChildByName('sponsor', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $conferencePrimaryLocale;
         } elseif (!in_array($locale, $conferenceSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.paperSponsorLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale));
             return false;
         }
         $paper->setSponsor($node->getValue(), $locale);
     }
     if ($node = $paperNode->getChildByName('pages')) {
         $paper->setPages($node->getValue());
     }
     if ($language = $paperNode->getAttribute('language')) {
         $paper->setLanguage($language);
     }
     /* --- Handle authors --- */
     $hasErrors = false;
     for ($index = 0; $node = $paperNode->getChildByName('author', $index); $index++) {
         if (!NativeImportDom::handleAuthorNode($conference, $schedConf, $node, $track, $paper, $authorErrors)) {
             $errors = array_merge($errors, $authorErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     $paperDao->insertPaper($paper);
     $dependentItems[] = array('paper', $paper);
     // Log the import in the paper event log.
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     PaperLog::logEvent($paper->getId(), PAPER_LOG_PAPER_IMPORT, PAPER_LOG_DEFAULT, 0, 'log.imported', array('userName' => $user->getFullName(), 'paperId' => $paper->getId()));
     // Insert published paper entry.
     $publishedPaper = new PublishedPaper();
     $publishedPaper->setPaperId($paper->getId());
     $publishedPaper->setSchedConfId($schedConf->getId());
     if ($node = $paperNode->getChildByName('date_published')) {
         $publishedDate = strtotime($node->getValue());
         if ($publishedDate === -1) {
             $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue()));
             return false;
         } else {
             $publishedPaper->setDatePublished($publishedDate);
         }
     }
     $node = $paperNode->getChildByName('open_access');
     $publishedPaper->setSeq(REALLY_BIG_NUMBER);
     $publishedPaper->setViews(0);
     $publishedPaper->setPublicPaperId($paperNode->getAttribute('public_id'));
     $publishedPaper->setPubId($publishedPaperDao->insertPublishedPaper($publishedPaper));
     $publishedPaperDao->resequencePublishedPapers($track->getId(), $schedConf->getId());
     /* --- Galleys (html or otherwise handled simultaneously) --- */
     import('file.PaperFileManager');
     $paperFileManager = new PaperFileManager($paper->getId());
     /* --- Handle galleys --- */
     $hasErrors = false;
     $galleyCount = 0;
     for ($index = 0; $index < count($paperNode->children); $index++) {
         $node =& $paperNode->children[$index];
         if ($node->getName() == 'htmlgalley') {
             $isHtml = true;
         } elseif ($node->getName() == 'galley') {
             $isHtml = false;
         } else {
             continue;
         }
         if (!NativeImportDom::handleGalleyNode($conference, $schedConf, $node, $track, $paper, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $paperFileManager)) {
             $errors = array_merge($errors, $galleyErrors);
             $hasErrors = true;
         }
         $galleyCount++;
     }
     if ($hasErrors) {
         return false;
     }
     /* --- Handle supplemental files --- */
     $hasErrors = false;
     for ($index = 0; $node = $paperNode->getChildByName('supplemental_file', $index); $index++) {
         if (!NativeImportDom::handleSuppFileNode($conference, $schedConf, $node, $track, $paper, $suppFileErrors, $isCommandLine, $paperFileManager)) {
             $errors = array_merge($errors, $suppFileErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     // Index the inserted paper.
     import('search.PaperSearchIndex');
     PaperSearchIndex::indexPaperMetadata($paper);
     PaperSearchIndex::indexPaperFiles($paper);
     return true;
 }
示例#5
0
 /**
  * Upload the annotated version of a paper.
  * @param $reviewId int
  */
 function uploadReviewerVersion($reviewId)
 {
     import('file.PaperFileManager');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
     $paperFileManager = new PaperFileManager($reviewAssignment->getPaperId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     if (!(($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled())) {
         return false;
     }
     $fileName = 'upload';
     if ($paperFileManager->uploadError($fileName)) {
         return false;
     }
     if (!$paperFileManager->uploadedFileExists($fileName)) {
         return false;
     }
     HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
     if ($reviewAssignment->getReviewerFileId() != null) {
         $fileId = $paperFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
     } else {
         $fileId = $paperFileManager->uploadReviewFile($fileName);
     }
     if ($fileId == 0) {
         return false;
     }
     $reviewAssignment->setReviewerFileId($fileId);
     $reviewAssignment->stampModified();
     $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
     // Add log
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     $entry = new PaperEventLogEntry();
     $entry->setPaperId($reviewAssignment->getPaperId());
     $entry->setUserId($reviewer->getId());
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setEventType(PAPER_LOG_REVIEW_FILE);
     $entry->setLogMessage('log.review.reviewerFile');
     $entry->setAssocType(LOG_TYPE_REVIEW);
     $entry->setAssocId($reviewAssignment->getId());
     PaperLog::logEventEntry($reviewAssignment->getPaperId(), $entry);
     return true;
 }
示例#6
0
 /**
  * Upload the revised version of a paper.
  * @param $authorSubmission object
  */
 function uploadRevisedVersion($authorSubmission)
 {
     import('file.PaperFileManager');
     $paperFileManager = new PaperFileManager($authorSubmission->getPaperId());
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $fileName = 'upload';
     if ($paperFileManager->uploadError($fileName)) {
         return false;
     }
     if (!$paperFileManager->uploadedFileExists($fileName)) {
         return false;
     }
     HookRegistry::call('AuthorAction::uploadRevisedVersion', array(&$authorSubmission));
     if ($authorSubmission->getRevisedFileId() != null) {
         $fileId = $paperFileManager->uploadDirectorDecisionFile($fileName, $authorSubmission->getRevisedFileId());
     } else {
         $fileId = $paperFileManager->uploadDirectorDecisionFile($fileName);
     }
     if (!$fileId) {
         return false;
     }
     $authorSubmission->setRevisedFileId($fileId);
     $authorSubmissionDao->updateAuthorSubmission($authorSubmission);
     // Add log entry
     $user =& Request::getUser();
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     PaperLog::logEvent($authorSubmission->getPaperId(), PAPER_LOG_AUTHOR_REVISION, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.documentRevised', array('authorName' => $user->getFullName(), 'fileId' => $fileId, 'paperId' => $authorSubmission->getPaperId()));
 }
示例#7
0
 /**
  * Save the email in the paper email log.
  */
 function log()
 {
     import('paper.log.PaperEmailLogEntry');
     import('paper.log.PaperLog');
     $entry = new PaperEmailLogEntry();
     // Log data
     $entry->setEventType($this->eventType);
     $entry->setAssocType($this->assocType);
     $entry->setAssocId($this->assocId);
     // Email data
     $entry->setSubject($this->getSubject());
     $entry->setBody($this->getBody());
     $entry->setFrom($this->getFromString());
     $entry->setRecipients($this->getRecipientString());
     $entry->setCcs($this->getCcString());
     $entry->setBccs($this->getBccString());
     // Add log entry
     $paper =& $this->paper;
     PaperLog::logEmailEntry($paper->getId(), $entry);
 }
示例#8
0
 /**
  * Save changes to paper.
  * @return int the paper ID
  */
 function execute()
 {
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     $authorDao =& DAORegistry::getDAO('AuthorDAO');
     $paper =& $this->paper;
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     // Update paper
     $paper->setTitle($this->getData('title'), null);
     // Localized
     $reviewMode = $this->paper->getReviewMode();
     if ($reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE) {
         $paper->setAbstract($this->getData('abstract'), null);
         // Localized
     }
     $paper->setDiscipline($this->getData('discipline'), null);
     // Localized
     $paper->setSubjectClass($this->getData('subjectClass'), null);
     // Localized
     $paper->setSubject($this->getData('subject'), null);
     // Localized
     $paper->setCoverageGeo($this->getData('coverageGeo'), null);
     // Localized
     $paper->setCoverageChron($this->getData('coverageChron'), null);
     // Localized
     $paper->setCoverageSample($this->getData('coverageSample'), null);
     // Localized
     $paper->setType($this->getData('type'), null);
     // Localized
     $paper->setLanguage($this->getData('language'));
     // Localized
     $paper->setSponsor($this->getData('sponsor'), null);
     // Localized
     $paper->setCitations($this->getData('citations'));
     // Update the submission progress if necessary.
     if ($paper->getSubmissionProgress() <= $this->step) {
         $paper->stampStatusModified();
         // If we aren't about to collect the paper, the submission is complete
         // (for now)
         $reviewMode = $this->paper->getReviewMode();
         if ($reviewMode == REVIEW_MODE_BOTH_SIMULTANEOUS || $reviewMode == REVIEW_MODE_PRESENTATIONS_ALONE) {
             if (!$schedConf->getSetting('acceptSupplementaryReviewMaterials')) {
                 $paper->setSubmissionProgress($this->step + 2);
             } else {
                 $paper->setSubmissionProgress($this->step + 1);
             }
             // The line below is necessary to ensure that
             // the paper upload goes in with the correct
             // stage number (i.e. paper).
             $paper->setCurrentStage(REVIEW_STAGE_PRESENTATION);
         } else {
             $paper->setDateSubmitted(Core::getCurrentDate());
             $paper->stampStatusModified();
             $paper->setCurrentStage(REVIEW_STAGE_ABSTRACT);
             $this->assignDirectors($paper);
             if ($schedConf->getSetting('acceptSupplementaryReviewMaterials')) {
                 $paper->setSubmissionProgress($this->step + 2);
             } else {
                 $paper->setSubmissionProgress(0);
                 $this->confirmSubmission($paper, $user, $schedConf, $conference, 'SUBMISSION_ACK');
             }
         }
     }
     // Update authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $paper->getAuthor($authors[$i]['authorId']);
             $isExistingAuthor = true;
         } else {
             // Create a new author
             $author = new Author();
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             $author->setAffiliation($authors[$i]['affiliation']);
             $author->setCountry($authors[$i]['country']);
             $author->setEmail($authors[$i]['email']);
             $author->setUrl($authors[$i]['url']);
             $author->setBiography($authors[$i]['biography'], null);
             // Localized
             $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
             $author->setSequence($authors[$i]['seq']);
             if ($isExistingAuthor == false) {
                 $paper->addAuthor($author);
             }
         }
         unset($author);
     }
     // Remove deleted authors
     $deletedAuthors = explode(':', $this->getData('deletedAuthors'));
     for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
         $paper->removeAuthor($deletedAuthors[$i]);
     }
     // Save the paper
     $paperDao->updatePaper($paper);
     // Log the submission, even though it may not be "complete"
     // at this step. This is important because we don't otherwise
     // capture changes in review process.
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     PaperLog::logEvent($this->paperId, PAPER_LOG_ABSTRACT_SUBMIT, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.abstractSubmitted', array('submissionId' => $paper->getId(), 'authorName' => $user->getFullName()));
     return $this->paperId;
 }
 /**
  * View submission email log.
  */
 function submissionEmailLog($args, $request)
 {
     $paperId = (int) array_shift($args);
     $logId = (int) array_shift($args);
     $this->validate($request, $paperId);
     $submission =& $this->submission;
     $this->setupTemplate($request, true, $paperId, 'history');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('isDirector', Validation::isDirector());
     $templateMgr->assign_by_ref('submission', $submission);
     if ($logId) {
         $logDao =& DAORegistry::getDAO('PaperEmailLogDAO');
         $logEntry =& $logDao->getLogEntry($logId, $paperId);
     }
     if (isset($logEntry)) {
         $templateMgr->assign_by_ref('logEntry', $logEntry);
         $templateMgr->display('trackDirector/submissionEmailLogEntry.tpl');
     } else {
         $rangeInfo =& Handler::getRangeInfo('emailLogEntries', array($paperId));
         import('classes.paper.log.PaperLog');
         while (true) {
             $emailLogEntries =& PaperLog::getEmailLogEntries($paperId, $rangeInfo);
             if ($emailLogEntries->isInBounds()) {
                 break;
             }
             unset($rangeInfo);
             $rangeInfo =& $emailLogEntries->getLastPageRangeInfo();
             unset($emailLogEntries);
         }
         $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
         $templateMgr->display('trackDirector/submissionEmailLog.tpl');
     }
 }
示例#10
0
 /**
  * Upload a review on behalf of its reviewer.
  * @param $reviewId int
  */
 function uploadReviewForReviewer($reviewId)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true);
     if (HookRegistry::call('TrackDirectorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) {
         return;
     }
     // Upload the review file.
     import('file.PaperFileManager');
     $paperFileManager = new PaperFileManager($reviewAssignment->getPaperId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($paperFileManager->uploadError($fileName)) {
             return false;
         }
         if ($paperFileManager->uploadedFileExists($fileName)) {
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $paperFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $paperFileManager->uploadReviewFile($fileName);
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         // Only confirm the review for the reviewer if
         // he has not previously done so.
         if ($reviewAssignment->getDateConfirmed() == null) {
             $reviewAssignment->setDeclined(0);
             $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         }
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         // Add log
         import('paper.log.PaperLog');
         import('paper.log.PaperEventLogEntry');
         $entry = new PaperEventLogEntry();
         $entry->setPaperId($reviewAssignment->getPaperId());
         $entry->setUserId($user->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType(PAPER_LOG_REVIEW_FILE_BY_PROXY);
         $entry->setLogMessage('log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'paperId' => $reviewAssignment->getPaperId(), 'stage' => $reviewAssignment->getStage(), 'userName' => $user->getFullName()));
         $entry->setAssocType(LOG_TYPE_REVIEW);
         $entry->setAssocId($reviewAssignment->getId());
         PaperLog::logEventEntry($reviewAssignment->getPaperId(), $entry);
     }
 }
示例#11
0
 /**
  * Save metadata.
  * @param $paper object
  */
 function saveMetadata($paper)
 {
     if (!HookRegistry::call('Action::saveMetadata', array(&$paper))) {
         import('classes.submission.form.MetadataForm');
         $metadataForm = new MetadataForm($paper);
         $metadataForm->readInputData();
         // Check for any special cases before trying to save
         if (Request::getUserVar('addAuthor')) {
             // Add an author
             $editData = true;
             $authors = $metadataForm->getData('authors');
             array_push($authors, array());
             $metadataForm->setData('authors', $authors);
         } else {
             if (($delAuthor = Request::getUserVar('delAuthor')) && count($delAuthor) == 1) {
                 // Delete an author
                 $editData = true;
                 list($delAuthor) = array_keys($delAuthor);
                 $delAuthor = (int) $delAuthor;
                 $authors = $metadataForm->getData('authors');
                 if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
                     $deletedAuthors = explode(':', $metadataForm->getData('deletedAuthors'));
                     array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
                     $metadataForm->setData('deletedAuthors', join(':', $deletedAuthors));
                 }
                 array_splice($authors, $delAuthor, 1);
                 $metadataForm->setData('authors', $authors);
                 if ($metadataForm->getData('primaryContact') == $delAuthor) {
                     $metadataForm->setData('primaryContact', 0);
                 }
             } else {
                 if (Request::getUserVar('moveAuthor')) {
                     // Move an author up/down
                     $editData = true;
                     $moveAuthorDir = Request::getUserVar('moveAuthorDir');
                     $moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
                     $moveAuthorIndex = (int) Request::getUserVar('moveAuthorIndex');
                     $authors = $metadataForm->getData('authors');
                     if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
                         $tmpAuthor = $authors[$moveAuthorIndex];
                         $primaryContact = $metadataForm->getData('primaryContact');
                         if ($moveAuthorDir == 'u') {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
                             $authors[$moveAuthorIndex - 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex - 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex - 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         } else {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
                             $authors[$moveAuthorIndex + 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex + 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex + 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         }
                     }
                     $metadataForm->setData('authors', $authors);
                 }
             }
         }
         if (isset($editData)) {
             $metadataForm->display();
             return false;
         } else {
             if (!$metadataForm->validate()) {
                 return $metadataForm->display();
             }
             $metadataForm->execute();
             // Send a notification to associated users
             import('lib.pkp.classes.notification.NotificationManager');
             $notificationManager = new NotificationManager();
             $notificationUsers = $paper->getAssociatedUserIds();
             foreach ($notificationUsers as $userRole) {
                 $url = Request::url(null, null, $userRole['role'], 'submission', $paper->getId(), null, 'metadata');
                 $notificationManager->createNotification($userRole['id'], 'notification.type.metadataModified', $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
             }
             // Add log entry
             $user =& Request::getUser();
             import('classes.paper.log.PaperLog');
             import('classes.paper.log.PaperEventLogEntry');
             PaperLog::logEvent($paper->getId(), PAPER_LOG_METADATA_UPDATE, LOG_TYPE_DEFAULT, 0, 'log.director.metadataModified', array('directorName' => $user->getFullName()));
             return true;
         }
     }
 }