/** * action single * * @return void */ public function singleAction() { $templatePath = $this->getTemplate(); $downloads = $this->downloadRepository->findByCat($this->settings['category']); $this->view->setTemplatePathAndFilename($templatePath); $this->view->assign('downloads', $downloads); }
/** * action download * * @param \NetBrothers\Nbdownloader\Domain\Model\Download $download * @return void */ public function downloadAction(\NetBrothers\Nbdownloader\Domain\Model\Download $download) { $counter = intval($download->getCounter()); $counter++; $download->setCounter($counter); $this->downloadRepository->update($download); $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll(); $publicUrl = $download->getSource()->getOriginalResource()->getPublicUrl(); $fileName = $this->downloadRepository->getDownloadName($download, $this->settings); $mimeType = \NetBrothers\Nbdownloader\Helper\GetMimeType::getMimeType($publicUrl); header("Content-type: {$mimeType}"); header("Content-Disposition: attachment; filename=\"{$fileName}\""); ob_clean(); flush(); readfile(PATH_site . $publicUrl); exit; }