3 require_once($CFG->libdir
. '/portfoliolib.php');
4 require_once($CFG->libdir
. '/portfolio/plugin.php');
6 class portfolio_plugin_download
extends portfolio_plugin_pull_base
{
8 protected $exportconfig;
10 public static function get_name() {
11 return get_string('pluginname', 'portfolio_download');
14 public static function allows_multiple_instances() {
18 public function expected_time($callertime) {
19 return PORTFOLIO_TIME_LOW
;
22 public function prepare_package() {
24 $files = $this->exporter
->get_tempfiles();
26 if (count($files) == 1) {
27 $this->set('file', array_shift($files));
29 $this->set('file', $this->exporter
->zip_tempfiles()); // this will throw a file_exception which the exporter catches separately.
33 public function steal_control($stage) {
34 if ($stage == PORTFOLIO_STAGE_FINISHED
) {
36 return $CFG->wwwroot
. '/portfolio/download/file.php?id=' . $this->get('exporter')->get('id');
40 public function send_package() {}
42 public function verify_file_request_params($params) {
43 // for download plugin the only thing we need to verify is that
44 // the logged in user is the same as the exporting user
46 if ($USER->id
!= $this->user
->id
) {
52 public function get_interactive_continue_url() {