Example #1
0
 public function categorydeleteAction()
 {
     $this->view->title = "Category";
     //calling the delete form
     $delform = new Category_Form_Delete();
     $this->view->deleteform = $delform;
     //getting the id
     $id = $this->_getParam('id');
     $this->view->id = $id;
     //calling the category model
     $category = new Category_Model_Category();
     $this->view->categorydetails = $category->getCategory($id);
     $getstatus = $category->getcategorystatus($id);
     //         // if that product id is not used by anyone we can delete that record
     if (!$getstatus) {
         //delete action
         if ($this->_request->isPost() && $this->_request->getPost('Delete')) {
             $formdata = $this->_request->getPost();
             if ($delform->isValid($formdata)) {
                 //editing the record
                 $previousdata = $this->view->adm->editRecord("ourbank_category", $id);
                 // //updating the previous data
                 $this->view->adm->updateLog("ourbank_category_log", $previousdata[0], $this->view->createdby);
                 // delete that particular record
                 $this->view->adm->deleteRecord('ourbank_category', $id);
                 $this->_redirect('category/index/');
             }
         }
     } else {
         $this->_helper->flashMessenger->addMessage('You cannot delete this product, its in usage');
         $this->_helper->redirector('index');
     }
 }
Example #2
0
 public function holidaydeleteAction()
 {
     //calling the delete form
     $delform = new Category_Form_Delete();
     $this->view->deleteform = $delform;
     //getting the id
     $id = $this->_getParam('id');
     $this->view->id = $id;
     //calling holiday model
     $holiday = new Holiday_Model_Holiday();
     $this->view->holidaydetails = $holiday->getHoliday($id);
     //Delete action
     if ($this->_request->isPost() && $this->_request->getPost('Delete')) {
         $formdata = $this->_request->getPost();
         if ($delform->isValid($formdata)) {
             $redirect = $this->view->adm->deleteRecord("ourbank_holiday", $id);
             //update
             $this->_redirect('/holiday');
         }
     }
 }