示例#1
0
 public function proddeleteAction()
 {
     $this->view->title = "Usuń produkt";
     $produkty = new Produkty();
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_Alpha');
         $filter = new Zend_Filter_Alpha();
         $pro_id = (int) $this->_request->getPost('pro_id');
         $del = $filter->filter($this->_request->getPost('del'));
         if ($del == 'Yes' && $pro_id > 0) {
             $where = 'pro_id = ' . $pro_id;
             $rows_affected = $produkty->delete($where);
         }
     } else {
         $pro_id = (int) $this->_request->getParam('pro_id');
         if ($pro_id > 0) {
             // only render if we have an id and can find the pages.
             $this->view->produkty = $produkty->fetchRow('pro_id=' . $pro_id);
             if ($this->view->produkty->pro_id > 0) {
                 // render template automatically
                 return;
             }
         }
     }
     // redirect back to the pages list unless we have rendered the view
     $this->_redirect('/admin');
 }