/** Action for deleting findspot * @access public * @return void * @throws Pas_Exception_Param */ public function deleteAction() { if ($this->getParam('id', false)) { $type = $this->getParam('recordtype'); $recordID = $this->getParam('recordID'); if ($this->_request->isPost()) { $id = (int) $this->_request->getPost('id'); $this->view->recordID = (int) $this->_request->getPost('recordID'); $this->view->type = $type; $this->setController($this->_request->getPost('type')); $this->setRedirect($this->getController()); $del = $this->_request->getPost('del'); if ($del == 'Yes' && $id > 0) { $where = 'id = ' . $id; $this->_findspots->delete($where); $this->_helper->solrUpdater->update('objects', $recordID, $this->_request->getPost('type')); $this->getFlash()->addMessage('Findspot deleted.'); } $this->redirect($this->getRedirect() . 'record/id/' . $recordID); } else { $id = (int) $this->_request->getParam('id'); $type = $this->getParam('recordtype'); if ($id > 0) { $this->view->findspot = $this->_findspots->getFindtoFindspotDelete($this->getParam('id'), $this->getController()); } } } else { throw new Pas_Exception_Param($this->_missingParameter, 404); } }
/** Delete a record */ public function deleteAction() { if ($this->_request->isPost()) { $id = (int) $this->_request->getPost('id'); $del = $this->_request->getPost('del'); if ($del == 'Yes' && $id > 0) { $where = $this->_finds->getAdapter()->quoteInto('id = ?', $id); $this->_finds->delete($where); $findID = $this->_request->getPost('findID'); $findspots = new Findspots(); $whereFindspots = array(); $whereFindspots[] = $this->_finds->getAdapter()->quoteInto('findID = ?', $findID); $this->_flashMessenger->addMessage('Record deleted!'); $findspots->delete($whereFindspots); $this->_helper->solrUpdater->deleteById('beowulf', $id); $this->_redirect(self::REDIRECT); } $this->_flashMessenger->addMessage('No changes made!'); $this->_redirect('database/artefacts/record/id/' . $id); } else { $id = (int) $this->_request->getParam('id'); if ($id > 0) { $this->view->find = $this->_finds->fetchRow('id=' . $id); } } }