]> git.mjollnir.org Git - moodle.git/commitdiff
portfolio: MDL-20850 fixed some navigation/output
authorPenny Leach <penny@liip.ch>
Tue, 17 Nov 2009 14:01:06 +0000 (14:01 +0000)
committerPenny Leach <penny@liip.ch>
Tue, 17 Nov 2009 14:01:06 +0000 (14:01 +0000)
lib/portfolio/exporter.php
lib/portfoliolib.php
portfolio/add.php

index 801dc0cf6c5f9bde396d4f6e30c4b7c4f7b280a4..46ea79be635dbea465658deb6feee35439ca0dbf 100644 (file)
@@ -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();
index 61db888f5f9b70ddd68f9e9544a2ea0c91978b8b..5ed6b958140d78da7b456855762dbcd2729b5c17 100644 (file)
@@ -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'));
+}
index fe6b7202a4cf3ab88e1a41983f1d24f800736224..6834df733e79ece4bdf32afeec89e9e7a120fb0b 100644 (file)
@@ -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);