From 3d7fe06982bc4a45630498e67d86ac8768d43a3d Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 10 Sep 2008 13:07:16 +0000 Subject: [PATCH] MDL-16414 - make the download plugin just redirect to the file url --- portfolio/type/download/lib.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/portfolio/type/download/lib.php b/portfolio/type/download/lib.php index 244aae85e3..babeb5a2fa 100644 --- a/portfolio/type/download/lib.php +++ b/portfolio/type/download/lib.php @@ -11,6 +11,13 @@ class portfolio_plugin_download extends portfolio_plugin_pull_base { return get_string('pluginname', 'portfolio_download'); } + public function steal_control($stage) { + if ($stage == PORTFOLIO_STAGE_FINISHED) { + return $this->get_base_file_url(); + } + return false; + } + public static function allows_multiple() { return false; } @@ -22,6 +29,12 @@ class portfolio_plugin_download extends portfolio_plugin_pull_base { public function prepare_package() { $files = $this->exporter->get_tempfiles(); + + if (count($files) == 1) { + $this->set('file', array_shift($files)); + return true; + } + $zipper = new zip_packer(); $filename = 'portfolio-export.zip'; @@ -37,11 +50,6 @@ class portfolio_plugin_download extends portfolio_plugin_pull_base { return true; } - public function get_extra_finish_options() { - global $CFG; - return array($CFG->wwwroot . '/portfolio/file.php?id=' . $this->exporter->get('id') => get_string('downloadfile', 'portfolio_download')); - } - public function verify_file_request_params($params) { // for download plugin the only thing we need to verify is that // the logged in user is the same as the exporting user -- 2.39.5