From: Penny Leach Date: Tue, 17 Nov 2009 14:01:06 +0000 (+0000) Subject: portfolio: MDL-20850 fixed some navigation/output X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f1d2641df61fa80bdd4e97b63c01a2744885d14d;p=moodle.git portfolio: MDL-20850 fixed some navigation/output --- diff --git a/lib/portfolio/exporter.php b/lib/portfolio/exporter.php index 801dc0cf6c..46ea79be63 100644 --- a/lib/portfolio/exporter.php +++ b/lib/portfolio/exporter.php @@ -52,12 +52,6 @@ class portfolio_exporter { */ 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 @@ -125,11 +119,8 @@ class portfolio_exporter { * @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) { @@ -138,7 +129,6 @@ class portfolio_exporter { } $this->callerfile = $callerfile; $this->stage = PORTFOLIO_STAGE_CONFIG; - $this->navigation = $navigation; $this->caller->set('exporter', $this); $this->alreadystolen = array(); $this->newfilehashes = array(); diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 61db888f5f..5ed6b95814 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -993,7 +993,27 @@ function portfolio_insane_notify_admins($insane, $instances=false) { $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')); +} diff --git a/portfolio/add.php b/portfolio/add.php index fe6b7202a4..6834df733e 100644 --- a/portfolio/add.php +++ b/portfolio/add.php @@ -98,6 +98,9 @@ if (!empty($dataid)) { $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. @@ -157,24 +160,7 @@ if (!empty($dataid)) { 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);