Пример #1
0
 /** Unlink an image from a record
  */
 public function unlinkAction()
 {
     if ($this->_getParam('returnID', false)) {
         $this->view->findID = $this->_getParam('secuid');
         $this->view->returnID = $this->_getParam('returnID');
         if ($this->_request->isPost()) {
             $id = (int) $this->_request->getPost('id');
             $del = $this->_request->getPost('del');
             if ($del == 'Yes' && $id > 0) {
                 $imageID = $this->_request->getPost('imageID');
                 $findID = $this->_request->getPost('findID');
                 $slides = new Slides();
                 $imagedata = $slides->fetchRow('imageID = ' . $id);
                 $imageID = $imagedata['secuid'];
                 $linked = new FindsImages();
                 $where = array();
                 $where[] = $linked->getAdapter()->quoteInto('image_id = ?', $imageID);
                 $where[] = $linked->getAdapter()->quoteInto('find_id = ?', $findID);
                 $linked->delete($where);
                 $this->_flashMessenger->addMessage('Image and links deleted!');
                 $this->_redirect('/database/artefacts/record/id/' . $this->_getParam('returnID'));
                 $this->_helper->cache->remove('findtoimage' . $returnID);
             }
         } else {
             $id = (int) $this->_request->getParam('id');
             if ((int) $id > 0) {
                 $this->view->slide = $this->_images->fetchRow($slides->select()->where('imageID = ?', $id));
                 $this->view->params = $this->_getAllParams();
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }