Record a file view in database.
public recordView ( $submissionFile ) | ||
$submissionFile | SubmissionFile |
/** * record a file view. * Must be overridden in subclases. * @param $submissionFile SubmissionFile the file to record. */ function recordView($submissionFile) { SubmissionFileManager::recordView($submissionFile); }
/** * Download a file. * @param $fileId int the file id of the file to download * @param $revision int the revision of the file to download * @param $inline boolean print file as inline instead of attachment, optional * @param $filename string The client-side download filename (optional) * @return boolean */ function downloadFile($fileId, $revision = null, $inline = false, $filename = null) { $returner = false; $submissionFile = $this->_getFile($fileId, $revision); if (isset($submissionFile)) { // Make sure that the file belongs to the submission. if ($submissionFile->getSubmissionId() != $this->getSubmissionId()) { fatalError('Invalid file id!'); } SubmissionFileManager::recordView($submissionFile); // Send the file to the user. $filePath = $submissionFile->getFilePath(); $mediaType = $submissionFile->getFileType(); $returner = parent::downloadFile($filePath, $mediaType, $inline, $filename); } return $returner; }