예제 #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);
     }
 }
예제 #2
0
 /** Delete an image
  * @access public
  * @return void
  */
 public function deleteAction()
 {
     if ($this->_request->isPost()) {
         $id = (int) $this->_request->getPost('id');
         $del = $this->_request->getPost('del');
         if ($del == 'Yes' && $id > 0) {
             $imagedata = $this->_images->getFileName($id);
             $filename = $imagedata['0']['f'];
             $splitf = explode('.', $filename);
             $spf = $splitf['0'];
             $imagedir = $imagedata['0']['imagedir'];
             $imagenumber = $imagedata['0']['imageID'];
             $zoom = './' . $imagedir . 'zoom/' . $spf . '_zdata';
             $thumb = IMAGE_PATH . 'thumbnails/' . $imagenumber . '.jpg';
             $small = './' . $imagedir . 'small/' . $filename;
             $display = './' . $imagedir . 'display/' . $filename;
             $medium = './' . $imagedir . 'medium/' . $filename;
             $original = './' . $imagedir . $filename;
             $where = 'imageID = ' . $id;
             $this->_images->delete($where);
             $this->_helper->solrUpdater->deleteById('images', $id);
             $linked = new FindsImages();
             $wherelinks = array();
             $wherelinks[] = $linked->getAdapter()->quoteInto('image_id = ?', $imagedata['0']['secuid']);
             $linked->delete($wherelinks);
             $this->getFlash()->addMessage('Image and metadata deleted');
             unlink($thumb);
             unlink($display);
             unlink($small);
             unlink($original);
             unlink($medium);
             unlink(strtolower($thumb));
             unlink(strtolower($display));
             unlink(strtolower($small));
             unlink(strtolower($original));
             unlink(strtolower($medium));
             unlink($zoom);
         }
         $this->redirect('/database/myscheme/myimages/');
     } else {
         $id = (int) $this->_request->getParam('id');
         if ((int) $id > 0) {
             $this->view->slide = $this->_images->fetchRow('imageID =' . $id);
         }
     }
 }
예제 #3
0
 public function deleteimagelinkAction()
 {
     if ($this->_getParam('id', false)) {
         $links = new FindsImages();
         $where = $links->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id'));
         $links->delete($where);
     } else {
         throw new Exception('No parameter on url string');
     }
 }
예제 #4
0
 /** Delete image link
  * @access public
  * @return mixed
  */
 public function deleteimagelinkAction()
 {
     if ($this->getParam('id', false)) {
         $links = new FindsImages();
         $where = $links->getAdapter()->quoteInto('id = ?', (int) $this->getParam('id'));
         $links->delete($where);
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }