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

Template-ify the file export summary.

parent 86dcbd57
......@@ -56,11 +56,14 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
}
public function get_summary() {
$filecount = count(array_filter($this->artefactdata, create_function('$a', 'return $a->artefacttype != "folder";')));
$foldercount = count(array_filter($this->artefactdata, create_function('$a', 'return $a->artefacttype == "folder";')));
$smarty = $this->exporter->get_smarty();
$smarty->assign('filecount', count(array_filter($this->artefactdata, create_function('$a', 'return $a->artefacttype != "folder";'))));
$smarty->assign('foldercount', count(array_filter($this->artefactdata, create_function('$a', 'return $a->artefacttype == "folder";'))));
$smarty->assign('spaceused', $this->exporter->get('user')->get('quotaused'));
return array(
'title' => 'Files',
'description' => "<p>You have {$filecount} files in {$foldercount} folders. <a href=\"files/file/index.html\">Browse</a>.</p>",
'title' => get_string('Files', 'artefact.file'),
'description' => $smarty->fetch('export:html/file:summary.tpl'),
);
}
......
<p><a href="{$rootpath}files/file/index.html">Browse your file collection</a></p>
<ul>
<li>{str tag=Files section=artefact.file}: {$filecount|escape}</li>
<li>{str tag=Folders section=artefact.file}: {$foldercount|escape}</li>
<li>{str tag=spaceused section=artefact.file}: {$spaceused|display_size|escape}</li>
</ul>
......@@ -97,6 +97,7 @@ $string['requireagreement'] = 'Require Agreement';
$string['savechanges'] = 'Save changes';
$string['selectafile'] = 'Select a file';
$string['Size'] = 'Size';
$string['spaceused'] = 'Space used';
$string['timeouterror'] = 'File upload failed: try uploading the file again';
$string['title'] = 'Name';
$string['titlefieldisrequired'] = 'The name field is required';
......
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