Added feature to blocks (and restorelib) so that blocks get a method call (default does nothing) after they are restored. This allows blocks to change their settings if necessary in respect of the new course roll-forward 'restore and change start date' feature that Al implemented recently. The core blocks happen not to store dates anyway so don't need this, but contributed blocks may well do.

This commit is contained in:
sam_marshall 2006-09-21 12:07:15 +00:00
parent db33348f53
commit a82e9bc3bb
2 changed files with 15 additions and 2 deletions

View File

@ -797,6 +797,11 @@
$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];
@ -5461,4 +5466,4 @@
}
}
?>
?>

View 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 {
}
?>
?>