_submission = $submission; $this->_isCurrentUserAssignedAuthor = $isCurrentUserAssignedAuthor; parent::__construct(); } // // Overridden methods from GridRow // /** * @copydoc GridRow::initialize() * * @param null|mixed $template */ public function initialize($request, $template = null) { parent::initialize($request, $template); $logEntry = $this->getData(); // a Category object assert($logEntry != null && ($logEntry instanceof EventLogEntry || $logEntry instanceof EmailLogEntry)); if ($logEntry instanceof EventLogEntry) { switch ($logEntry->getEventType()) { case SubmissionFileEventLogEntry::SUBMISSION_LOG_FILE_REVISION_UPLOAD: case SubmissionFileEventLogEntry::SUBMISSION_LOG_FILE_UPLOAD: $submissionFileId = $logEntry->getData('submissionFileId'); $fileId = $logEntry->getData('fileId'); $submissionFile = $submissionFileId ? Repo::submissionFile()->get($submissionFileId) : null; if (!$submissionFile) { break; } $filename = $logEntry->getLocalizedData('filename') ?? $submissionFile->getLocalizedData('name'); if ($submissionFile) { $anonymousAuthor = false; $maybeAnonymousAuthor = $this->_isCurrentUserAssignedAuthor && $submissionFile->getData('fileStage') === SubmissionFile::SUBMISSION_FILE_REVIEW_ATTACHMENT; if ($maybeAnonymousAuthor && $submissionFile->getData('assocType') === Application::ASSOC_TYPE_REVIEW_ASSIGNMENT) { $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ $reviewAssignment = $reviewAssignmentDao->getById($submissionFile->getData('assocId')); if ($reviewAssignment && in_array($reviewAssignment->getReviewMethod(), [ReviewAssignment::SUBMISSION_REVIEW_METHOD_ANONYMOUS, ReviewAssignment::SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS])) { $anonymousAuthor = true; } } if (!$anonymousAuthor) { $workflowStageId = Repo::submissionFile()->getWorkflowStageId($submissionFile); // If a submission file is attached to a query that has been deleted, we cannot // determine its stage. Don't present a download link in this case. if ($workflowStageId || $submissionFile->getData('fileStage') != SubmissionFile::SUBMISSION_FILE_QUERY) { $this->addAction(new DownloadFileLinkAction($request, $submissionFile, $workflowStageId, __('common.download'), $fileId, $filename)); } } } break; } } elseif ($logEntry instanceof EmailLogEntry) { $this->addAction( new EmailLinkAction( $request, __('submission.event.viewEmail'), [ 'submissionId' => $logEntry->getAssocId(), 'emailLogEntryId' => $logEntry->getId(), ] ) ); } } }