]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16048 - beginning of printing useful summary during export
authormjollnir_ <mjollnir_>
Tue, 19 Aug 2008 15:23:47 +0000 (15:23 +0000)
committermjollnir_ <mjollnir_>
Tue, 19 Aug 2008 15:23:47 +0000 (15:23 +0000)
MDL-16046 - bugfix of previous commit (added field to portfolio_tempdata but forgot to change insert)

lang/en_utf8/portfolio.php
lib/portfoliolib.php

index 3bcd5e76b0d5101fc5b8b7ecb9ff24a1b7931064..f4aa2f6c42c11f29725fc38d31d77c43771519b7 100644 (file)
@@ -20,6 +20,7 @@ $string['err_uniquename'] = 'Portfolio name must be unique (per plugin)';
 $string['enabled'] = 'Enable portfolios';
 $string['enableddesc'] = 'This will allow administrators to configure remote systems for users to export content to';
 $string['exporting'] = 'Exporting to portfolio';
+$string['exportingcontentfrom'] = 'Exporting content from $a';
 $string['exportcomplete'] = 'Portfolio export complete!';
 $string['exportqueued'] = 'Portfolio export has been successfully queued for transfer';
 $string['exportedpreviously'] = 'Previous exports';
index 869c7646acf1d304e5b40e05700b074a27322fc4..566a888b49074f86c937f8ff06a0fe19fa082922 100644 (file)
@@ -853,6 +853,14 @@ abstract class portfolio_caller_base {
     * nice name to display to the user about this caller location
     */
     public abstract static function display_name();
+
+    /**
+    * return a string to put at the header summarising this export
+    * by default, just the display name (usually just 'assignment' or something unhelpful
+    */
+    public function heading_summary() {
+        return get_string('exportingcontentfrom', 'portfolio', $this->display_name());
+    }
 }
 
 abstract class portfolio_module_caller_base extends portfolio_caller_base {
@@ -880,6 +888,10 @@ abstract class portfolio_module_caller_base extends portfolio_caller_base {
         }
         return $this->course;
     }
+
+    public function heading_summary() {
+        return get_string('exportingcontentfrom', 'portfolio', $this->display_name() . ': ' . $this->cm->name);
+    }
 }
 
 /**
@@ -1938,8 +1950,7 @@ final class portfolio_exporter {
                 $this->instance->set_export_config($pluginbits);
                 return true;
             } else {
-                $this->print_header();
-                print_heading(get_string('configexport' ,'portfolio'));
+                $this->print_header('configexport');
                 print_simple_box_start();
                 $mform->display();
                 print_simple_box_end();
@@ -1978,8 +1989,7 @@ final class portfolio_exporter {
         $strconfirm = get_string('confirmexport', 'portfolio');
         $yesurl = $CFG->wwwroot . '/portfolio/add.php?stage=' . PORTFOLIO_STAGE_QUEUEORWAIT;
         $nourl  = $CFG->wwwroot . '/portfolio/add.php?cancel=1';
-        $this->print_header();
-        print_heading($strconfirm);
+        $this->print_header('confirmexport');
         print_simple_box_start();
         print_heading(get_string('confirmsummary', 'portfolio'), '', 4);
         $mainsummary = array();
@@ -2108,12 +2118,11 @@ final class portfolio_exporter {
         $continueurl = $this->instance->get_continue_url();
         $extras = $this->instance->get_extra_finish_options();
 
-        $this->print_header();
+        $key = 'exportcomplete';
         if ($queued) {
-            print_heading(get_string('exportqueued', 'portfolio'));
-        } else {
-            print_heading(get_string('exportcomplete', 'portfolio'));
+            $key = 'exportqueued';
         }
+        $this->print_header($key, false);
         if ($returnurl) {
             echo '<a href="' . $returnurl . '">' . get_string('returntowhereyouwere', 'portfolio') . '</a><br />';
         }
@@ -2136,11 +2145,20 @@ final class portfolio_exporter {
     * @param string $titlestring key for a portfolio language string
     * @param string $headerstring key for a portfolio language string
     */
-    public function print_header($titlestr='exporting', $headerstr='exporting') {
-        $titlestr = get_string($titlestr, 'portfolio');
-        $headerstr = get_string($headerstr, 'portfolio');
+    public function print_header($headingstr, $summary=true) {
+        $titlestr = get_string('exporting', 'portfolio');
+        $headerstr = get_string('exporting', 'portfolio');
 
         print_header($titlestr, $headerstr, $this->navigation);
+        print_heading(get_string($headingstr, 'portfolio'));
+
+        if (!$summary) {
+            return;
+        }
+
+        print_simple_box_start();
+        echo $this->caller->heading_summary();
+        print_simple_box_end();
     }
 
     /**
@@ -2165,6 +2183,7 @@ final class portfolio_exporter {
             $r = (object)array(
                 'data' => base64_encode(serialize($this)),
                 'expirytime' => time() + (60*60*24),
+                'userid' => $this->user->id,
             );
             $this->id = $DB->insert_record('portfolio_tempdata', $r);
             $this->save(); // call again so that id gets added to the save data.