Ejemplo n.º 1
0
 /**
  * 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);
 }
 /**
  * Internal function to return an ArticleEventLogEntry object from a row.
  * @param $row array
  * @return ArticleEventLogEntry
  */
 function &_returnLogEntryFromRow(&$row)
 {
     $entry = new ArticleEventLogEntry();
     $entry->setId($row['log_id']);
     $entry->setArticleId($row['article_id']);
     $entry->setUserId($row['user_id']);
     $entry->setDateLogged($this->datetimeFromDB($row['date_logged']));
     $entry->setIPAddress($row['ip_address']);
     $entry->setLogLevel($row['log_level']);
     $entry->setEventType($row['event_type']);
     $entry->setAssocType($row['assoc_type']);
     $entry->setAssocId($row['assoc_id']);
     $entry->setMessage($row['message']);
     HookRegistry::call('ArticleEventLogDAO::_returnLogEntryFromRow', array(&$entry, &$row));
     return $entry;
 }
Ejemplo n.º 3
0
 /**
  * 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);
         }
     }
 }