portfolio: MDL-20850 fixed some navigation/output

This commit is contained in:
Penny Leach 2009-11-17 14:01:06 +00:00
parent 154acd7aa3
commit f1d2641df6
3 changed files with 26 additions and 30 deletions

View file

@ -52,12 +52,6 @@ class portfolio_exporter {
*/ */
private $noexportconfig; private $noexportconfig;
/**
* the navigation to display on the wizard screens
* built from build_navigation
*/
private $navigation;
/** /**
* the user currently exporting content * the user currently exporting content
* always $USER, but more conveniently placed here * always $USER, but more conveniently placed here
@ -125,11 +119,8 @@ class portfolio_exporter {
* @param portfolio_plugin_base subclass $instance portfolio instance (passed by reference) * @param portfolio_plugin_base subclass $instance portfolio instance (passed by reference)
* @param portfolio_caller_base subclass $caller portfolio caller (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 $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->instance =& $instance;
$this->caller =& $caller; $this->caller =& $caller;
if ($instance) { if ($instance) {
@ -138,7 +129,6 @@ class portfolio_exporter {
} }
$this->callerfile = $callerfile; $this->callerfile = $callerfile;
$this->stage = PORTFOLIO_STAGE_CONFIG; $this->stage = PORTFOLIO_STAGE_CONFIG;
$this->navigation = $navigation;
$this->caller->set('exporter', $this); $this->caller->set('exporter', $this);
$this->alreadystolen = array(); $this->alreadystolen = array();
$this->newfilehashes = array(); $this->newfilehashes = array();

View file

@ -993,7 +993,27 @@ function portfolio_insane_notify_admins($insane, $instances=false) {
$eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = $htmlbody; $eventdata->fullmessagehtml = $htmlbody;
$eventdata->smallmessage = $smallbody; $eventdata->smallmessage = $smallbody;
error_log(print_r($eventdata, true));
message_send($eventdata); 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'));
}

View file

@ -98,6 +98,9 @@ if (!empty($dataid)) {
$exporter->save(); $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. // completely new request, look to see what information we've been passed and set up the exporter object.
} else { } else {
// you cannot get here with no information for us, we must at least have the caller. // you cannot get here with no information for us, we must at least have the caller.
@ -157,24 +160,7 @@ if (!empty($dataid)) {
throw new portfolio_caller_exception('nopermissions', 'portfolio', $caller->get_return_url()); throw new portfolio_caller_exception('nopermissions', 'portfolio', $caller->get_return_url());
} }
// for build navigation portfolio_export_pagesetup($PAGE, $caller); // this calls require_login($course) if it can..
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'));
// finally! set up the exporter object with the portfolio instance, and caller information elements // finally! set up the exporter object with the portfolio instance, and caller information elements
$exporter = new portfolio_exporter($instance, $caller, $callbackfile); $exporter = new portfolio_exporter($instance, $caller, $callbackfile);