public function treatDownloadsAction() { $fileMapper = new FileMapper(); $pagination = new \Ilch\Pagination(); $downloadsMapper = new DownloadsMapper(); $id = $this->getRequest()->getParam('id'); $downloadsTitle = $downloadsMapper->getDownloadsById($id); if ($this->getRequest()->getPost('action') == 'delete') { foreach ($this->getRequest()->getPost('check_downloads') as $fileId) { $fileMapper->deleteById($fileId); } $this->addMessage('deleteSuccess'); $this->redirect(array('action' => 'treatdownloads', 'id' => $id)); } if ($this->getRequest()->getPost()) { foreach ($this->getRequest()->getPost('check_image') as $fileId) { $catId = $this->getRequest()->getParam('id'); $model = new \Modules\Downloads\Models\File(); $model->setFileId($fileId); $model->setCat($catId); $fileMapper->save($model); } } $pagination->setPage($this->getRequest()->getParam('page')); $this->getView()->set('file', $fileMapper->getFileByDownloadsId($id, $pagination)); $this->getView()->set('pagination', $pagination); $this->getView()->set('downloadsTitle', $downloadsTitle->getTitle()); }
public function showAction() { $fileMapper = new FileMapper(); $pagination = new \Ilch\Pagination(); $downloadsMapper = new DownloadsMapper(); $id = $this->getRequest()->getParam('id'); $downloads = $downloadsMapper->getDownloadsById($id); $this->getLayout()->set('metaTitle', $this->getTranslator()->trans('downloads') . ' - ' . $downloads->getTitle()); $this->getLayout()->set('metaDescription', $this->getTranslator()->trans('downloads') . ' - ' . $downloads->getDesc()); $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuDownloadsOverview'), array('action' => 'index'))->add($downloads->getTitle(), array('action' => 'show', 'id' => $id)); $pagination->setPage($this->getRequest()->getParam('page')); $this->getView()->set('file', $fileMapper->getFileByDownloadsId($id, $pagination)); $this->getView()->set('pagination', $pagination); }