Commit 86299da6 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Blogpost render metadata

parent b1e0d07e
......@@ -33,6 +33,7 @@ $string['alignment'] = 'Alignment';
$string['attach'] = 'Attach';
$string['attachedfilelistloaded'] = 'Attached file list loaded';
$string['attachedfiles'] = 'Attached files';
$string['attachments'] = 'Attachments';
$string['blogdesc'] = 'Description';
$string['blogdescdesc'] = 'e.g., ‘A record of Jill\'s experiences and reflections’.';
$string['blogfilesdirdescription'] = 'Files uploaded as blog post attachments';
......
......@@ -265,7 +265,6 @@ class ArtefactTypeBlog extends ArtefactType {
protected function render_metadata($options) {
$smarty = smarty();
$smarty->assign('PROPERTIES', $this->get_metadata());
log_debug($smarty);
return $smarty->fetch('artefact:blog:render/blog_rendermetadata.tpl');
}
......@@ -457,6 +456,32 @@ class ArtefactTypeBlogPost extends ArtefactType {
return $smarty->fetch('artefact:blog:render/blogpost_renderfull.tpl');
}
protected function count_attachments() {
return count_records('artefact_blog_blogpost_file', 'blogpost', $this->get('id'));
}
protected function get_metadata() {
$data = parent::get_metadata();
unset($data['description']);
unset($data['size']);
$data['type']['value'] = get_string($this->get('artefacttype'), 'artefact.blog');
$data['attachments'] = array('name' => get_string('attachments', 'artefact.blog'),
'value' => $this->count_attachments() . ' '
. get_string('files', 'artefact.file'));
return $data;
}
protected function render_metadata($options) {
$smarty = smarty();
$smarty->assign('PROPERTIES', $this->get_metadata());
return $smarty->fetch('artefact:blog:render/blog_rendermetadata.tpl');
}
public function get_icon() {
}
......
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