Beispiel #1
0
 /**
  * Delete attachment record
  *
  * @return  void
  */
 public function deleteItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0, $aid = 0)
 {
     $aid = $aid ? $aid : Request::getInt('aid', 0);
     // Load attachment
     $row = new \Components\Publications\Tables\Attachment($this->_parent->_db);
     // We need attachment record
     if (!$aid || !$row->load($aid)) {
         $this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_CONTENT_ERROR_EDIT_CONTENT'));
         return false;
     }
     // Attachment type
     $type = $row->type;
     // Get attachment type model
     $attModel = new \Components\Publications\Models\Attachments($this->_parent->_db);
     // Save incoming attachment info
     $attModel->remove($type, $row, $pub, $actor, $elementId, $manifest->elements->{$elementId}, $manifest->params);
     // Set success message
     if ($attModel->get('_message')) {
         $this->set('_message', $attModel->get('_message'));
     }
     // Set request to update curation record
     if ($attModel->get('_update')) {
         $this->_parent->set('_update', 1);
     }
     return true;
 }