3 require_once($CFG->libdir . '/portfoliolib.php');
5 class portfolio_plugin_download extends portfolio_plugin_base {
8 protected $exportconfig;
10 public static function supported_formats() {
11 return array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_HTML);
12 // @todo more later, like moodle backup for example
15 public static function allows_multiple() {
19 public function expected_time($callertime) {
20 return PORTFOLIO_TIME_LOW;
23 public function prepare_package($tempdir) {
24 // just zip up whatever files the caller has created for us
25 // and move them to the user's temporary area.
26 $userdir = temp_portfolio_usertemp_directory($this->get('user')->id);
28 $newfile = 'portfolio_export_' . time() . '.zip';
29 $files = get_directory_list($tempdir);
30 foreach ($files as $key => $file) {
31 $files[$key] = $tempdir . '/' . $file;
34 zip_files($files, $userdir . '/' . $newfile);
35 $this->set('zipfile', $newfile);
40 public function send_package() {
44 public function get_extra_finish_options() {
47 // @todo this will go through files api later, this is a (nonworking) hack for now.
48 $CFG->wwwroot . '/file.php?file=' . $this->zipfile => get_string('downloadfile', 'portfolio_download'),
52 public function get_continue_url() {