mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-16414 - make the handling of the download portfolio plugin nicer
This commit is contained in:
parent
45b7e6104d
commit
abcd0fc53e
3 changed files with 40 additions and 1 deletions
|
@ -2,5 +2,6 @@
|
||||||
|
|
||||||
$string['downloadfile'] = 'Download your portfolio export file';
|
$string['downloadfile'] = 'Download your portfolio export file';
|
||||||
$string['pluginname'] = 'File download';
|
$string['pluginname'] = 'File download';
|
||||||
|
$string['downloading'] = 'Downloading ...';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
30
portfolio/type/download/file.php
Normal file
30
portfolio/type/download/file.php
Normal 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();
|
||||||
|
|
||||||
|
?>
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once($CFG->libdir . '/portfoliolib.php');
|
require_once($CFG->libdir . '/portfoliolib.php');
|
||||||
require_once($CFG->libdir . '/packer/zip_packer.php');
|
|
||||||
|
|
||||||
class portfolio_plugin_download extends portfolio_plugin_pull_base {
|
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() {
|
public function get_extra_finish_options() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
return array($this->get_base_file_url() => get_string('downloadfile', 'portfolio_download'));
|
return array($this->get_base_file_url() => get_string('downloadfile', 'portfolio_download'));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function send_package() {}
|
public function send_package() {}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue