]> git.mjollnir.org Git - moodle.git/commitdiff
Added feature to blocks (and restorelib) so that blocks get a method call (default...
authorsam_marshall <sam_marshall>
Thu, 21 Sep 2006 12:07:15 +0000 (12:07 +0000)
committersam_marshall <sam_marshall>
Thu, 21 Sep 2006 12:07:15 +0000 (12:07 +0000)
backup/restorelib.php
blocks/moodleblock.class.php

index 6ecd1dfc79e36e2937fc39a2edca291cbffbc69c..334928c495c0ff22aad74acb46ab7b06b14186ad 100644 (file)
                         $status = false;
                         break;
                     }
+                    
+                    //Get an object for the block and tell it it's been restored so it can update dates
+                    //etc. if necessary
+                    $blockobj=block_instance($instance->name,$instance);
+                    $blockobj->after_restore($restore);
     
                     //Now we can increment the weight counter
                     ++$maxweights[$instance->position];
         }
     }
 
-?>
+?>
\ No newline at end of file
index 9b07fb91224d363137bc833ff8fa0ab6853462b0..ee35ca7b08d9449a9990c5f18261de22e1de9b01 100644 (file)
@@ -122,6 +122,14 @@ class block_base {
      */
     function before_delete() {
     }
+    
+    /**
+     * Function that can be overridden to do extra setup after a block instance has been
+     * restored from backup. For example, it may need to alter any dates that the block
+     * stores, if the $restore->course_startdateoffset is set.  
+     */
+    function after_restore($restore) {
+    }
 
     /**
      * Returns the block name, as present in the class name,
@@ -708,4 +716,4 @@ class block_list extends block_base {
 
 }
 
-?>
+?>
\ No newline at end of file