Commit 27dee023 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Blog render metadata

parent 53a11386
......@@ -80,6 +80,7 @@ $string['postbodydesc'] = ' ';
$string['postedon'] = 'Posted on';
$string['posttitle'] = 'Title';
$string['posttitledesc'] = 'The title appears above your post.';
$string['posts'] = 'posts';
$string['publish'] = 'Publish';
$string['publishfailed'] = 'An error occurred. Your post was not published';
$string['publishblogpost?'] = 'Are you sure you want to publish this post?';
......
......@@ -250,6 +250,25 @@ class ArtefactTypeBlog extends ArtefactType {
$smarty->assign_by_ref('javascript', $javascript);
return $smarty->fetch('artefact:blog:render/blog_renderfull.tpl');
}
protected function get_metadata() {
$data = parent::get_metadata();
$data['description'] = array('name' => get_string('description'),
'value' => $this->get('description'));
$data['type']['value'] = get_string($this->get('artefacttype'), 'artefact.blog');
$data['size'] = array('name' => get_string('size'),
'value' => $this->count_children() . ' '
. get_string('posts', 'artefact.blog'));
return $data;
}
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');
}
public function get_icon() {
}
......
<table>
<tbody>
{foreach from=$PROPERTIES item=item}
<tr>
<td>{$item.name}</td>
<td>{$item.value}</td>
</tr>
{/foreach}
</tbody>
</table>
......@@ -513,10 +513,6 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
}
public function count_children() {
return count_records('artefact', 'parent', $this->get('id'));
}
public function folder_contents() {
if ($children = get_records_array('artefact', 'parent', $this->get('id'))) {
return $children;
......
......@@ -141,6 +141,10 @@ abstract class ArtefactType {
// @todo
}
public function count_children() {
return count_records('artefact', 'parent', $this->get('id'));
}
public function has_children() {
if ($this->get_children_metadata()) {
return true;
......
......@@ -347,6 +347,7 @@ $string['artefactnotfound'] = 'Artefact with id %s not found';
$string['created'] = 'Created';
$string['lastmodified'] = 'Last modified';
$string['owner'] = 'Owner';
$string['size'] = 'Size';
$string['title'] = 'Title';
$string['type'] = 'Type';
......
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