/** * Load revision attachment. * * @throws \Exception Throws exception if no attachment found. * @return null */ protected function load_attachment() { $this->attachments->configure(TITANIA_CONTRIB, $this->contrib->contrib_id)->load(array($this->revision->attachment_id)); $this->attachment = $this->attachments->get($this->revision->attachment_id); if (!$this->attachment) { throw new \Exception($this->user->lang['ERROR_NO_ATTACHMENT']); } }
/** * Get very basic data for loaded attachments. * * @return array */ public function get_basic_attachment_data() { $data = array(); foreach ($this->operator->get_fixed_indices() as $id) { $attach = $this->operator->get($id); $data[$id] = array('attach_id' => $id, 'real_filename' => $attach->get('real_filename'), 'type' => $this->form_name, 'url' => $attach->get_url(), 'thumb' => $attach->has_thumbnail() ? $attach->get_url(array('thumb' => 1, 'view' => 'inline')) : ''); } return $data; }