[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/portfolio/download/ -> lib.php (source)

   1  <?php
   2  
   3  require_once($CFG->libdir . '/portfoliolib.php');
   4  
   5  class portfolio_plugin_download extends portfolio_plugin_pull_base {
   6  
   7      protected $exportconfig;
   8  
   9      public static function get_name() {
  10          return get_string('pluginname', 'portfolio_download');
  11      }
  12  
  13      public static function allows_multiple_instances() {
  14          return false;
  15      }
  16  
  17      public function expected_time($callertime) {
  18          return PORTFOLIO_TIME_LOW;
  19      }
  20  
  21      public function prepare_package() {
  22  
  23          $files = $this->exporter->get_tempfiles();
  24  
  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.
  29          }
  30      }
  31  
  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');
  36          }
  37      }
  38  
  39      public function send_package() {}
  40  
  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;
  47          }
  48          return true;
  49      }
  50  
  51      public function get_interactive_continue_url() {
  52          return false;
  53      }
  54  }
  55  


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1