private function getAttachments() { $attachments = new EntityAttachmentCollection(); $sh = new SearchHandler($attachments, FALSE); $sh->addConstraint(new Constraint('data_model', '=', 'modulecomponent')); $sh->addConstraint(new Constraint('entity_id', '=', ModuleComponent::getComponentId($this->_modules['module'], strtolower(get_class($this))))); $sh->addConstraint(new Constraint('createdby', '=', EGS_USERNAME)); $files = $attachments->load($sh, null, RETURN_ROWS); $dirobjs = array(); if (count($files) > 0) { foreach ($files as $attachment) { $link = '/?' . setParamsString(array('modules' => $this->_modules, 'controller' => 'attachments', 'action' => 'view_file', 'other' => array(file_id => $attachment['file_id']))); $details = array('name' => $attachment['file'], 'link' => $link, 'type' => 'attachment', 'delete' => array('modules' => $this->_modules, 'controller' => 'attachments', 'action' => 'delete', 'id' => $attachment['id']), 'size' => sizify($attachment['size']), 'mtime' => un_fix_date($attachment['lastupdated'])); $dirobjs['file'][] = $details; } } return $dirobjs; }
public function format($value) { return sizify($value); }