コード例 #1
0
ファイル: Index.php プロジェクト: prepare4battle/Ilch-2.0
 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'));
 }
コード例 #2
0
ファイル: Iframe.php プロジェクト: prepare4battle/Ilch-2.0
 public function multiAction()
 {
     $this->getLayout()->setFile('modules/admin/layouts/iframe');
     $mediaMapper = new MediaMapper();
     $pagination = new \Ilch\Pagination();
     $pagination->setPage($this->getRequest()->getParam('page'));
     $lastId = $this->getRequest()->getParam('lastid');
     if ($this->getRequest()->getParam('type') === 'multi') {
         $type = $this->getConfig()->get('media_ext_img');
     }
     if ($this->getRequest()->getParam('type') === 'file') {
         $type = $this->getConfig()->get('media_ext_file');
     }
     if ($this->getRequest()->getParam('type') === 'video') {
         $type = $this->getConfig()->get('media_ext_video');
     }
     if (empty($lastId)) {
         $pagination->setRowsPerPage('40');
         $this->getView()->set('medias', $mediaMapper->getMediaListByEnding($type, $pagination));
     } else {
         $this->getView()->set('medias', $mediaMapper->getMediaListScroll($lastId));
     }
     $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'));
 }