Commit da42551f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Size option for blog, blogpost listself rendering

parent 22e83877
......@@ -225,6 +225,19 @@ class ArtefactTypeBlog extends ArtefactType {
return $smarty->fetch('artefact:blog:render/blog_listchildren.tpl');
}
protected function listself($options) {
$smarty = smarty();
$smarty->assign('title', $this->get('title'));
if (isset($options['size']) && $options['size']) {
$smarty->assign('size', $this->count_children() . ' ' . get_string('posts', 'artefact.blog'));
}
return $smarty->fetch('artefact:blog:render/blog_listself.tpl');
}
/**
* This function implements the render_full functionality for blogs.
* Rendering full involves rendering blog posts with render_full, and
......@@ -440,8 +453,12 @@ class ArtefactTypeBlogPost extends ArtefactType {
*/
protected function listself($options) {
$smarty = smarty();
$smarty->assign('artefact', $this);
return $smarty->fetch('artefact:blog:render/blogpost_listself.tpl');
$smarty->assign('title', $this->get('title'));
if (isset($options['size']) && $options['size']) {
$smarty->assign('size', $this->count_attachments() . ' '
. get_string('attachments', 'artefact.blog'));
}
return $smarty->fetch('artefact:blog:render/blog_listself.tpl');
}
/**
......
<div>{$title}
{if isset($size)}
({$size})
{/if}
</div>
{**
* This template displays a blog post.
*}
<div>
<span>{$artefact->get('title')|escape}</span>
<div>{$artefact->get('description')}</div>
</div>
Supports Markdown
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