Example #1
0
 public function get_row(midcom_core_dbaobject $document)
 {
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     $entry = array();
     $entry['id'] = $document->id;
     $entry['index_title'] = $document->title;
     $entry['index_filesize'] = 0;
     $entry['filesize'] = '';
     $entry['mimetype'] = '';
     $icon = MIDCOM_STATIC_URL . '/stock-icons/mime/gnome-text-blank.png';
     $alt = '';
     $att = $document->load_attachment();
     if ($att) {
         $icon = midcom_helper_misc::get_mime_icon($att->mimetype);
         $alt = $att->name;
         $stats = $att->stat();
         $entry['index_filesize'] = $stats[7];
         $entry['filesize'] = midcom_helper_misc::filesize_to_string($stats[7]);
         $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype);
     }
     $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"';
     $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>';
     $entry['title'] = $title;
     $entry['created'] = strftime('%Y-%m-%d %X', $document->metadata->created);
     $entry['index_author'] = '';
     $entry['author'] = '';
     if ($document->author) {
         $author = org_openpsa_contacts_person_dba::get_cached($document->author);
         $entry['index_author'] = $author->rname;
         $author_card = org_openpsa_widgets_contact::get($author->guid);
         $entry['author'] = $author_card->show_inline();
     }
     return $entry;
 }