Commit ee3bac05 authored by Nigel McNie's avatar Nigel McNie
Browse files

Clean up and i18nise blog summary and display of individual blogs.

parent a688b2bd
......@@ -56,9 +56,25 @@ class HtmlExportBlog extends HtmlExportArtefactPlugin {
}
public function get_summary() {
$smarty = $this->exporter->get_smarty();
if ($blogs = get_records_select_array('artefact', "owner = ? AND artefacttype = 'blog'", array($this->exporter->get('user')->get('id')), 'title')) {
foreach ($blogs as &$blog) {
$blog->link = 'files/blog/' . PluginExportHtml::text_to_path($blog->title) . '/index.html';
}
$smarty->assign('blogs', $blogs);
$stryouhaveblogs = (count($blogs) == 1)
? get_string('youhaveoneblog', 'artefact.blog')
: get_string('youhaveblogs', 'artefact.blog', count($blogs));
}
else {
$stryouhaveblogs = get_string('youhavenoblogs', 'artefact.blog');
}
$smarty->assign('stryouhaveblogs', $stryouhaveblogs);
return array(
'title' => 'Blogs',
'description' => "<p>You have {$this->blogcount} blogs</p>",
'title' => get_string('blogs', 'artefact.blog'),
'description' => $smarty->fetch('export:html/blog:summary.tpl'),
);
}
......
{include file="export:html:header.tpl"}
<h2>Blog: {$title|escape}</h2>
{$rendered_blog}
{include file="export:html:footer.tpl"}
<p>{$stryouhaveblogs}</p>
{if $blogs}
<ul>
{foreach from=$blogs item=blog}
<li><a href="{$blog->link|escape}">{$blog->title|escape}</a></li>
{/foreach}
</ul>
{/if}
......@@ -130,4 +130,8 @@ $string['copynocopy'] = 'Skip this block entirely when copying the View';
$string['viewposts'] = 'Copied posts (%s)';
$string['postscopiedfromview'] = 'Posts copied from %s';
$string['youhavenoblogs'] = 'You have no blogs.';
$string['youhaveoneblog'] = 'You have 1 blog.';
$string['youhaveblogs'] = 'You have %s blogs.';
?>
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