MDL-16414 - make the handling of the download portfolio plugin nicer

This commit is contained in:
mjollnir_ 2008-09-16 14:23:41 +00:00
parent 45b7e6104d
commit abcd0fc53e
3 changed files with 40 additions and 1 deletions

View File

@ -2,5 +2,6 @@
$string['downloadfile'] = 'Download your portfolio export file';
$string['pluginname'] = 'File download';
$string['downloading'] = 'Downloading ...';
?>

View File

@ -0,0 +1,30 @@
<?php
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
require_once($CFG->libdir . '/portfoliolib.php');
require_js(array(
'yui_yahoo',
'yui_dom',
));
$id = required_param('id', PARAM_INT);
$exporter = portfolio_exporter::rewaken_object($id);
$exporter->verify_rewaken();
$exporter->print_header(get_string('downloading', 'portfolio_download'), false);
$returnurl = $exporter->get('caller')->get_return_url();
notify('<a href="' . $returnurl . '">' . get_string('returntowhereyouwere', 'portfolio') . '</a><br />');
echo '<div id="redirect">
<form action="' . $exporter->get('instance')->get_base_file_url() . '" method="post" id="redirectform">
<input type="submit" value="' . get_string('downloadfile', 'portfolio_download') . '" />
</form>
<script language="javascript">
f = YAHOO.util.Dom.get("redirectform");
YAHOO.util.Dom.addClass(f.parentNode, "hide");
f.submit();
</script>';
print_footer();
?>

View File

@ -1,7 +1,6 @@
<?php
require_once($CFG->libdir . '/portfoliolib.php');
require_once($CFG->libdir . '/packer/zip_packer.php');
class portfolio_plugin_download extends portfolio_plugin_pull_base {
@ -30,10 +29,19 @@ class portfolio_plugin_download extends portfolio_plugin_pull_base {
}
}
public function steal_control($stage) {
if ($stage == PORTFOLIO_STAGE_FINISHED) {
global $CFG;
return $CFG->wwwroot . '/portfolio/type/download/file.php?id=' . $this->get('exporter')->get('id');
}
}
/*
public function get_extra_finish_options() {
global $CFG;
return array($this->get_base_file_url() => get_string('downloadfile', 'portfolio_download'));
}
*/
public function send_package() {}