Commit f6ae70cf authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon
Browse files

Bug 1857379: Add attachment panel to recent posts block



- add DB query to get attachment data
- add in attachment panel for recent posts tpl
- change chevron class
- fix warning by adding artefacttype to db query
- add in icon
- add tooltip for download icon

Change-Id: I53dbd7f034bd02e40ed0b144e0829639788f2d9f
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 015a9482
...@@ -127,6 +127,23 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype { ...@@ -127,6 +127,23 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
$data->tags = $tags; $data->tags = $tags;
} }
$data->owner = $blog->get('owner'); $data->owner = $blog->get('owner');
$sql = 'SELECT a.title, a.id, a.artefacttype, af.size, a.description
FROM {artefact} a
JOIN {artefact_file_files} af ON af.artefact = a.id
JOIN {artefact_attachment} at ON at.attachment = a.id
WHERE at.artefact = ?
ORDER BY a.title';
if ($attachments = get_records_sql_array($sql, array($data->id))) {
foreach ($attachments as &$attachment) {
$f = artefact_instance_from_id($attachment->id);
$attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0));
$attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id;
if (isset($options['viewid'])) {
$attachment->downloadpath .= '&view=' . $options['viewid'];
}
}
$data->attachments = $attachments;
}
} }
$smarty = smarty_core(); $smarty = smarty_core();
......
...@@ -76,7 +76,12 @@ ...@@ -76,7 +76,12 @@
</div> </div>
<div id="recent_post_{$post->id}" class="collapse content-text"> <div id="recent_post_{$post->id}" class="collapse content-text">
<span>{$post->description|safe}</span> <span>{$post->description|safe}</span>
{if isset($post->attachments) && !$modal}
{include file="artefact:blog:render/blogpost_renderattachments.tpl" attachments=$post->attachments postid=$post->id}
{/if}
</div> </div>
</div> </div>
{/foreach} {/foreach}
</div> </div>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{/if} {/if}
<a href="{$item->downloadpath}"> <a href="{$item->downloadpath}">
<span class="sr-only">{str tag=Download section=artefact.file} {$item->title}</span> <span class="sr-only">{str tag=Download section=artefact.file} {$item->title}</span>
<span class="icon icon-download icon-lg float-right text-watermark icon-action" role="presentation" aria-hidden="true"></span> <span class="icon icon-download icon-lg float-right text-watermark icon-action" role="presentation" aria-hidden="true" data-toggle="tooltip" title="{str tag=Download section=artefact.file} {$item->title}"></span>
</a> </a>
{if $item->description} {if $item->description}
<div class="file-description text-small"> <div class="file-description text-small">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment