Commit e67dec7c authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files
parents 1f99eede 7030984a
......@@ -463,7 +463,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
protected function get_metadata() {
$data = parent::get_metadata();
$data['size'] = array('name' => get_string('size', 'artefact.file'),
'value' => $this->size);
'value' => $this->get('size'));
$url = get_config('wwwroot') . 'artefact/file/download.php?file=' . $this->get('id');
$data['download'] = array('name' => get_string('download', 'artefact.file'),
'value' => make_link($url));
......@@ -485,6 +485,10 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
}
public function count_children() {
return count_records('artefact', 'parent', $this->get('id'));
}
public function folder_contents() {
return get_records_array('artefact', 'parent', $this->get('id'));
}
......@@ -570,6 +574,13 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
return $record->id;
}
protected function get_metadata() {
$data = parent::get_metadata();
$data['size'] = array('name' => get_string('size', 'artefact.file'),
'value' => $this->count_children());
return $data;
}
}
class ArtefactTypeImage extends ArtefactTypeFile {
......
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