/** * Add a new event log entry with the specified parameters, including log level. * @param $articleId int * @param $logLevel char * @param $eventType int * @param $assocType int * @param $assocId int * @param $messageKey string * @param $messageParams array */ function logEventLevel($articleId, $logLevel, $eventType, $assocType = 0, $assocId = 0, $messageKey = null, $messageParams = array()) { $entry =& new ArticleEventLogEntry(); $entry->setLogLevel($logLevel); $entry->setEventType($eventType); $entry->setAssocType($assocType); $entry->setAssocId($assocId); if (isset($messageKey)) { $entry->setLogMessage($messageKey, $messageParams); } return ArticleLog::logEventEntry($articleId, $entry); }
/** * Upload the copyedited version of an article. * @param $copyeditorSubmission object */ function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage) { import("file.ArticleFileManager"); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); // Only allow an upload if they're in the initial or final copyediting // stages. if ($copyeditStage == 'initial' && ($copyeditorSubmission->getDateNotified() == null || $copyeditorSubmission->getDateCompleted() != null)) { return; } else { if ($copyeditStage == 'final' && ($copyeditorSubmission->getDateFinalNotified() == null || $copyeditorSubmission->getDateFinalCompleted() != null)) { return; } else { if ($copyeditStage != 'initial' && $copyeditStage != 'final') { return; } } } $articleFileManager =& new ArticleFileManager($copyeditorSubmission->getArticleId()); $user =& Request::getUser(); $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission)); if ($copyeditorSubmission->getCopyeditFileId() != null) { $fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getCopyeditFileId()); } else { $fileId = $articleFileManager->uploadCopyeditFile($fileName); } } if (isset($fileId) && $fileId != 0) { $copyeditorSubmission->setCopyeditFileId($fileId); if ($copyeditStage == 'initial') { $copyeditorSubmission->setInitialRevision($articleFileDao->getRevisionNumber($fileId)); } elseif ($copyeditStage == 'final') { $copyeditorSubmission->setFinalRevision($articleFileDao->getRevisionNumber($fileId)); } $copyeditorSubmissionDao->updateCopyeditorSubmission($copyeditorSubmission); // Add log import('article.log.ArticleLog'); import('article.log.ArticleEventLogEntry'); $entry =& new ArticleEventLogEntry(); $entry->setArticleId($copyeditorSubmission->getArticleId()); $entry->setUserId($user->getUserId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType(ARTICLE_LOG_COPYEDIT_COPYEDITOR_FILE); $entry->setLogMessage('log.copyedit.copyeditorFile'); $entry->setAssocType(ARTICLE_LOG_TYPE_COPYEDIT); $entry->setAssocId($fileId); ArticleLog::logEventEntry($copyeditorSubmission->getArticleId(), $entry); } }
/** * Upload the annotated version of an article. * @param $reviewId int */ function uploadReviewerVersion($reviewId) { import('classes.file.ArticleFileManager'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO'); $reviewAssignment =& $reviewAssignmentDao->getById($reviewId); $sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId()); $articleFileManager = new ArticleFileManager($sectionDecision->getArticleId()); // Only upload the file if the reviewer has yet to submit a recommendation // and if review forms are not used if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) { $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { // Check if file already uploaded $reviewFile =& $reviewAssignment->getReviewerFile(); if ($reviewFile != null) { $articleFileManager->deleteFile($reviewFile->getFileId()); } HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment)); if ($reviewAssignment->getReviewerFileId() != null) { $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId(), $reviewAssignment->getReviewerFileId()); } else { $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId()); } } } if (isset($fileId) && $fileId != 0) { $reviewAssignment->setReviewerFileId($fileId); $reviewAssignment->stampModified(); $reviewAssignmentDao->updateReviewAssignment($reviewAssignment); // Add log import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); $userDao =& DAORegistry::getDAO('UserDAO'); $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); $entry = new ArticleEventLogEntry(); $entry->setArticleId($sectionDecision->getArticleId()); $entry->setUserId($reviewer->getId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType(ARTICLE_LOG_REVIEW_FILE); $entry->setLogLevel('N'); $entry->setLogMessage('log.review.reviewerFile'); $entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW); $entry->setAssocId($reviewAssignment->getId()); ArticleLog::logEventEntry($sectionDecision->getArticleId(), $entry); //Send a notification to section editors import('lib.pkp.classes.notification.NotificationManager'); $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle($sectionDecision->getArticleId()); $notificationManager = new NotificationManager(); $notificationUsers = $article->getAssociatedUserIds(false, false); $user =& Request::getUser(); $message = $article->getProposalId() . ':<br/>' . $user->getUsername(); foreach ($notificationUsers as $userRole) { $url = Request::url(null, $userRole['role'], 'submission', array($article->getId(), 'submissionReview'), null, 'peerReview'); $notificationManager->createNotification($userRole['id'], 'notification.type.reviewerFile', $message, $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT); } } }
/** * 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->getById($reviewId); $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true); if (HookRegistry::call('SectionEditorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) { return; } // Upload the review file. import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($reviewAssignment->getSubmissionId()); // Only upload the file if the reviewer has yet to submit a recommendation if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) { $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { if ($reviewAssignment->getReviewerFileId() != null) { $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId()); } else { $fileId = $articleFileManager->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('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); $entry = new ArticleEventLogEntry(); $entry->setArticleId($reviewAssignment->getSubmissionId()); $entry->setUserId($user->getId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType(ARTICLE_LOG_REVIEW_FILE_BY_PROXY); $entry->setLogMessage('log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'articleId' => $reviewAssignment->getSubmissionId(), 'round' => $reviewAssignment->getRound(), 'userName' => $user->getFullName())); $entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW); $entry->setAssocId($reviewAssignment->getId()); ArticleLog::logEventEntry($reviewAssignment->getSubmissionId(), $entry); } }
/** * Upload the copyedited version of an article. * @param $copyeditorSubmission object */ function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage) { import('classes.file.ArticleFileManager'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); if ($copyeditStage == 'initial') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId()); } else { if ($copyeditStage == 'final') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId()); } } // Only allow an upload if they're in the initial or final copyediting // stages. if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) { return; } else { if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) { return; } else { if ($copyeditStage != 'initial' && $copyeditStage != 'final') { return; } } } $articleFileManager = new ArticleFileManager($copyeditorSubmission->getArticleId()); $user =& Request::getUser(); $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission)); if ($signoff->getFileId() != null) { $fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)); } else { $fileId = $articleFileManager->uploadCopyeditFile($fileName); } } if (isset($fileId) && $fileId != 0) { $signoff->setFileId($fileId); // No revision anymore //$signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId)); $signoffDao->updateObject($signoff); // Add log import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); $entry = new ArticleEventLogEntry(); $entry->setArticleId($copyeditorSubmission->getArticleId()); $entry->setUserId($user->getId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType(ARTICLE_LOG_COPYEDIT_COPYEDITOR_FILE); $entry->setLogMessage('log.copyedit.copyeditorFile'); $entry->setAssocType(ARTICLE_LOG_TYPE_COPYEDIT); $entry->setAssocId($fileId); ArticleLog::logEventEntry($copyeditorSubmission->getArticleId(), $entry); } }
/** * Upload the annotated version of an article. * @param $reviewId int */ function uploadReviewerVersion($reviewId) { import("file.ArticleFileManager"); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId); $articleFileManager =& new ArticleFileManager($reviewAssignment->getArticleId()); // Only upload the file if the reviewer has yet to submit a recommendation // and if review forms are not used if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) { $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment)); if ($reviewAssignment->getReviewerFileId() != null) { $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId()); } else { $fileId = $articleFileManager->uploadReviewFile($fileName); } } } if (isset($fileId) && $fileId != 0) { $reviewAssignment->setReviewerFileId($fileId); $reviewAssignment->stampModified(); $reviewAssignmentDao->updateReviewAssignment($reviewAssignment); // Add log import('article.log.ArticleLog'); import('article.log.ArticleEventLogEntry'); $userDao =& DAORegistry::getDAO('UserDAO'); $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); $entry =& new ArticleEventLogEntry(); $entry->setArticleId($reviewAssignment->getArticleId()); $entry->setUserId($reviewer->getUserId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType(ARTICLE_LOG_REVIEW_FILE); $entry->setLogMessage('log.review.reviewerFile'); $entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW); $entry->setAssocId($reviewAssignment->getReviewId()); ArticleLog::logEventEntry($reviewAssignment->getArticleId(), $entry); } }