public function treatGalleryAction() { $imageMapper = new ImageMapper(); $pagination = new \Ilch\Pagination(); $galleryMapper = new GalleryMapper(); $id = $this->getRequest()->getParam('id'); $galleryTitle = $galleryMapper->getGalleryById($id); $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('gallery'), array('action' => 'index'))->add($this->getTranslator()->trans($galleryTitle->getTitle()), array('action' => 'treatgallery', 'id' => $id)); if ($this->getRequest()->getPost('action') == 'delete') { foreach ($this->getRequest()->getPost('check_gallery') as $imageId) { $imageMapper->deleteById($imageId); } $this->addMessage('deleteSuccess'); $this->redirect(array('action' => 'treatgallery', 'id' => $id)); } if ($this->getRequest()->getPost()) { foreach ($this->getRequest()->getPost('check_image') as $imageId) { $catId = $this->getRequest()->getParam('id'); $model = new \Modules\Gallery\Models\Image(); $model->setImageId($imageId); $model->setCat($catId); $imageMapper->save($model); } } $pagination->setPage($this->getRequest()->getParam('page')); $this->getView()->set('image', $imageMapper->getImageByGalleryId($id, $pagination)); $this->getView()->set('pagination', $pagination); $this->getView()->set('galleryTitle', $galleryTitle->getTitle()); }
public function showAction() { $imageMapper = new ImageMapper(); $pagination = new \Ilch\Pagination(); $galleryMapper = new GalleryMapper(); $id = $this->getRequest()->getParam('id'); $gallery = $galleryMapper->getGalleryById($id); $this->getLayout()->set('metaTitle', $this->getTranslator()->trans('gallery') . ' - ' . $gallery->getTitle()); $this->getLayout()->set('metaDescription', $this->getTranslator()->trans('gallery') . ' - ' . $gallery->getDesc()); $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuGalleryOverview'), array('action' => 'index'))->add($gallery->getTitle(), array('action' => 'show', 'id' => $id)); $pagination->setPage($this->getRequest()->getParam('page')); $this->getView()->set('image', $imageMapper->getImageByGalleryId($id, $pagination)); $this->getView()->set('pagination', $pagination); }