From: mjollnir_ Date: Tue, 16 Sep 2008 14:23:41 +0000 (+0000) Subject: MDL-16414 - make the handling of the download portfolio plugin nicer X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=abcd0fc53e53b4d3ebcc0cac07234f3261214ed6;p=moodle.git MDL-16414 - make the handling of the download portfolio plugin nicer --- diff --git a/lang/en_utf8/portfolio_download.php b/lang/en_utf8/portfolio_download.php index f2a3b9864b..c36e35ef51 100644 --- a/lang/en_utf8/portfolio_download.php +++ b/lang/en_utf8/portfolio_download.php @@ -2,5 +2,6 @@ $string['downloadfile'] = 'Download your portfolio export file'; $string['pluginname'] = 'File download'; +$string['downloading'] = 'Downloading ...'; ?> diff --git a/portfolio/type/download/file.php b/portfolio/type/download/file.php new file mode 100644 index 0000000000..b734b43e5a --- /dev/null +++ b/portfolio/type/download/file.php @@ -0,0 +1,30 @@ +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('' . get_string('returntowhereyouwere', 'portfolio') . '
'); + +echo '
+
+ +
+ '; + +print_footer(); + +?> diff --git a/portfolio/type/download/lib.php b/portfolio/type/download/lib.php index d5a9386262..d7d3ba33fc 100644 --- a/portfolio/type/download/lib.php +++ b/portfolio/type/download/lib.php @@ -1,7 +1,6 @@ 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() {}