Merge branch 'MDL-49143-28' of git://github.com/cameron1729/moodle into MOODLE_28_STABLE
[moodle.git] / portfolio / download / lib.php
blob3959382063c41d7e50617929aaae8d1b0bd51c6c
1 <?php
3 require_once($CFG->libdir . '/portfoliolib.php');
5 class portfolio_plugin_download extends portfolio_plugin_pull_base {
7 protected $exportconfig;
9 public static function get_name() {
10 return get_string('pluginname', 'portfolio_download');
13 public static function allows_multiple_instances() {
14 return false;
17 public function expected_time($callertime) {
18 return PORTFOLIO_TIME_LOW;
21 public function prepare_package() {
23 $files = $this->exporter->get_tempfiles();
25 if (count($files) == 1) {
26 $this->set('file', array_shift($files));
27 } else {
28 $this->set('file', $this->exporter->zip_tempfiles()); // this will throw a file_exception which the exporter catches separately.
32 public function steal_control($stage) {
33 if ($stage == PORTFOLIO_STAGE_FINISHED) {
34 global $CFG;
35 return $CFG->wwwroot . '/portfolio/download/file.php?id=' . $this->get('exporter')->get('id');
39 public function send_package() {}
41 public function verify_file_request_params($params) {
42 // for download plugin the only thing we need to verify is that
43 // the logged in user is the same as the exporting user
44 global $USER;
45 if ($USER->id != $this->user->id) {
46 return false;
48 return true;
51 public function get_interactive_continue_url() {
52 return false;