/** * Downloads a supplementary file * @param $args array * @param $request Request */ function downloadSuppFile($args, &$request) { $router =& $request->getRouter(); $paperId = isset($args[0]) ? $args[0] : 0; $suppId = isset($args[1]) ? $args[1] : 0; $schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF); $this->validate($request, $paperId); $paper =& $this->paper; $suppFileDao = DAORegistry::getDAO('SuppFileDAO'); if ($schedConf->getSetting('enablePublicSuppFileId')) { $suppFile =& $suppFileDao->getSuppFileByBestSuppFileId($paper->getId(), $suppId); } else { $suppFile =& $suppFileDao->getSuppFile((int) $suppId, $paper->getId()); } if ($paper && $suppFile) { import('classes.file.PaperFileManager'); $paperFileManager = new PaperFileManager($paper->getId()); $paperFileManager->downloadFile($suppFile->getFileId(), null, $suppFile->isInlineable()); } }
/** * Download file. * @param $paperId int * @param $fileId int * @param $revision int */ function downloadFile($paperId, $fileId, $revision = null) { import('classes.file.PaperFileManager'); $paperFileManager = new PaperFileManager($paperId); return $paperFileManager->downloadFile($fileId, $revision); }