MDL-16007 - add new $dontdie parameter to the send_ file functions
[moodle.git] / portfolio / type / download / lib.php
CommitLineData
67a87e7d 1<?php
2
3require_once($CFG->libdir . '/portfoliolib.php');
4
5class portfolio_plugin_download extends portfolio_plugin_base {
6
7 protected $zipfile;
8 protected $exportconfig;
9
67a87e7d 10 public static function allows_multiple() {
11 return false;
12 }
13
14 public function expected_time($callertime) {
15 return PORTFOLIO_TIME_LOW;
16 }
17
d67bfc32 18 public function prepare_package() {
67a87e7d 19 // just zip up whatever files the caller has created for us
20 // and move them to the user's temporary area.
21 $userdir = temp_portfolio_usertemp_directory($this->get('user')->id);
22
23 $newfile = 'portfolio_export_' . time() . '.zip';
24 $files = get_directory_list($tempdir);
25 foreach ($files as $key => $file) {
26 $files[$key] = $tempdir . '/' . $file;
27 }
28
29 zip_files($files, $userdir . '/' . $newfile);
30 $this->set('zipfile', $newfile);
31
32 return true;
33 }
34
35 public function send_package() {
36 return true;
37 }
38
39 public function get_extra_finish_options() {
40 global $CFG;
41 return array(
42 // @todo this will go through files api later, this is a (nonworking) hack for now.
43 $CFG->wwwroot . '/file.php?file=' . $this->zipfile => get_string('downloadfile', 'portfolio_download'),
44 );
45 }
46
47 public function get_continue_url() {
48 return false;
49 }
d67bfc32 50
51 public static function plugin_sanity_check() {
52 return 'notupgradedtousefilesapi';
53 }
67a87e7d 54}
55
56?>