コード例 #1
0
ファイル: BannersController.php プロジェクト: noikiy/amatteur
 public function deleteMultiAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     if (!WM_Users::allow('delete', $this->getRequest()->getController())) {
         echo $this->translate('You do not have permission to this action');
     } else {
         $action_check = $this->getRequest()->getPost('action_check');
         if ($action_check && is_array($action_check)) {
             foreach ($action_check as $record_id) {
                 Model_Banners::delete($record_id);
             }
         }
     }
 }
コード例 #2
0
 public function bannersAction()
 {
     $Banners = new Model_Banners();
     //read and edit
     if ($this->_getParam('edit')) {
         $banner_id = $this->_getParam('edit');
         $this->view->data = $Banners->listBanners($banner_id);
         if ($_POST) {
             $Banners->update($_POST['ID'], array('Title' => $_POST['Title'], 'URLSegment' => $_POST['URLSegment'], 'CustomOrder' => $_POST['CustomOrder'], 'CategoryID' => $_POST['CategoryID'], 'Tags' => $_POST['Tags']));
             $this->_redirect('/admin/banners/edit/' . $_POST['ID']);
         }
         //$generic = new Model_Generic;
         $this->view->categories = $this->categories();
         $this->render('banners-edit');
     }
     if ($_POST) {
         //create
         if (empty($_FILES['file']['name'][0])) {
             $this->_redirect('/admin/banners/');
         }
         if (is_array($_FILES['file']['name'])) {
             $process_upload = $Banners->create($_FILES, $_POST['Title'], $_POST['URLSegment']);
             $this->view->uploaded_files = $process_upload;
         }
     }
     if ($this->_getParam('delete')) {
         $banner_id = $this->_getParam('delete');
         $this->view->data = $Banners->delete($banner_id);
         $this->_redirect('/admin/banners');
     }
     $banners_list = $Banners->listBanners();
     $this->paginator($banners_list);
 }