Agora_Driver::getAttachmentLink PHP Method

    public function getAttachmentLink($message_id)
    {
        if (!$this->allowAttachments()) {
            return '';
        }
        $sql = 'SELECT file_id, file_name, file_size, file_type FROM agora_files WHERE message_id = ?';
        try {
            $files = $this->_db->select($sql, array($message_id));
        } catch (Horde_Db_Exception $e) {
            throw new Agora_Exception($e->getMessage());
        }
        if (empty($files)) {
            return $files;
        }
        /* Constuct the link with a tooltip for further info on the download. */
        $html = '<br />';
        $view_url = Horde::url('view.php');
        foreach ($files as $file) {
            $mime_icon = $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->getIcon($file['file_type']);
            $title = _("download") . ': ' . $file['file_name'];
            $tooltip = $title . "\n" . sprintf(_("size: %s"), $this->formatSize($file['file_size'])) . "\n" . sprintf(_("type: %s"), $file['file_type']);
            $url = $view_url->add(array('forum_id' => $this->_forum_id, 'message_id' => $message_id, 'file_id' => $file['file_id'], 'file_name' => $file['file_name'], 'file_type' => $file['file_type']));
            $html .= Horde::linkTooltip($url, $title, '', '', '', $tooltip) . Horde::img($mime_icon, $title, 'align="middle"', '') . '&nbsp;' . $file['file_name'] . '</a>&nbsp;&nbsp;<br />';
        }
        return $html;
    }