public function indexAction() { $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('media'), array('action' => 'index')); $mediaMapper = new MediaMapper(); if ($this->getRequest()->getPost('action') === 'delete' && $this->getRequest()->getPost('check_medias') > 0) { foreach ($this->getRequest()->getPost('check_medias') as $mediaId) { $mediaMapper->delMediaById($mediaId); } $this->addMessage('deleteSuccess'); $this->redirect(array('action' => 'index')); } $pagination = new \Ilch\Pagination(); $pagination->setPage($this->getRequest()->getParam('page')); if ($this->getRequest()->getParam('rows')) { $pagination->setRowsPerPage($this->getRequest()->getParam('rows')); $rows = array('rows' => $this->getRequest()->getParam('rows')); $this->getView()->set('rows', $rows); } else { $rows = array(); $this->getView()->set('rows', $rows); } if ($this->getRequest()->getPost('search') === 'search') { $pagination->setRowsPerPage($this->getRequest()->getPost('rows')); $rows = array('rows' => $this->getRequest()->getPost('rows')); $this->getView()->set('rows', $rows); } $this->getView()->set('pagination', $pagination); $this->getView()->set('medias', $mediaMapper->getMediaList($pagination)); $this->getView()->set('catnames', $mediaMapper->getCatList()); $this->getView()->set('media_ext_img', $this->getConfig()->get('media_ext_img')); $this->getView()->set('media_ext_file', $this->getConfig()->get('media_ext_file')); $this->getView()->set('media_ext_video', $this->getConfig()->get('media_ext_video')); }
public function indexAction() { $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('media'), array('controller' => 'index', 'action' => 'index'))->add($this->getTranslator()->trans('cats'), array('action' => 'index')); $mediaMapper = new MediaMapper(); if ($this->getRequest()->getPost('action') === 'delete') { foreach ($this->getRequest()->getPost('check_cats') as $catId) { $mediaMapper->delCatById($catId); } $this->addMessage('deleteSuccess'); $this->redirect(array('action' => 'index')); } $this->getView()->set('cats', $mediaMapper->getCatList()); }