*/
private $noexportconfig;
- /**
- * the navigation to display on the wizard screens
- * built from build_navigation
- */
- private $navigation;
-
/**
* the user currently exporting content
* always $USER, but more conveniently placed here
* @param portfolio_plugin_base subclass $instance portfolio instance (passed by reference)
* @param portfolio_caller_base subclass $caller portfolio caller (passed by reference)
* @param string $callerfile path to callerfile (relative to dataroot)
- * @param string $navigation result of build_navigation (passed to print_header)
- * deprecated argument as of Moodle 2.0, please use $PAGE methods
- * instead.
*/
- public function __construct(&$instance, &$caller, $callerfile, $navigation='') {
+ public function __construct(&$instance, &$caller, $callerfile) {
$this->instance =& $instance;
$this->caller =& $caller;
if ($instance) {
}
$this->callerfile = $callerfile;
$this->stage = PORTFOLIO_STAGE_CONFIG;
- $this->navigation = $navigation;
$this->caller->set('exporter', $this);
$this->alreadystolen = array();
$this->newfilehashes = array();
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = $htmlbody;
$eventdata->smallmessage = $smallbody;
- error_log(print_r($eventdata, true));
message_send($eventdata);
}
}
+
+function portfolio_export_pagesetup($PAGE, $caller) {
+ // for build navigation
+ if (!$course = $caller->get('course')) {
+ $course = $courseid;
+ }
+
+ // set up the course so that build_navigation works nice
+ $PAGE->set_course($course);
+
+ list($extranav, $cm) = $caller->get_navigation();
+
+ // and now we know the course for sure and maybe the cm, call require_login with it
+ // todo this will have to change when we have things exporting content outside the course context (eg blogs)
+ require_login($course, false, $cm);
+
+ foreach ($extranav as $navitem) {
+ $PAGE->navbar->add($navitem['name']);
+ }
+ $PAGE->navbar->add(get_string('exporting', 'portfolio'));
+}
$exporter->save();
}
}
+
+ portfolio_export_pagesetup($PAGE, $exporter->get('caller')); // this calls require_login($course) if it can..
+
// completely new request, look to see what information we've been passed and set up the exporter object.
} else {
// you cannot get here with no information for us, we must at least have the caller.
throw new portfolio_caller_exception('nopermissions', 'portfolio', $caller->get_return_url());
}
- // for build navigation
- if (!$course = $caller->get('course')) {
- $course = $courseid;
- }
-
- // set up the course so that build_navigation works nice
- $PAGE->set_course($course);
-
- list($extranav, $cm) = $caller->get_navigation();
-
- // and now we know the course for sure and maybe the cm, call require_login with it
- // todo this will have to change when we have things exporting content outside the course context (eg blogs)
- require_login($course, false, $cm);
-
- foreach ($extranav as $navitem) {
- $PAGE->navbar->add($navitem['name']);
- }
- $PAGE->navbar->add(get_string('exporting', 'portfolio'));
+ portfolio_export_pagesetup($PAGE, $caller); // this calls require_login($course) if it can..
// finally! set up the exporter object with the portfolio instance, and caller information elements
$exporter = new portfolio_exporter($instance, $caller, $callbackfile);