$missingblocks = array();
$recblocks = get_records('blocks','visible','1');
+ // Note down which blocks are going to get displayed
+ blocks_used($allblocks, $recblocks);
+
if($editing && $recblocks) {
foreach($recblocks as $recblock) {
// If it's not hidden or displayed right now...
}
} else {
$USER->editing = false;
+
+ // Note down which blocks are going to get displayed
+ $allblocks = array_merge($leftblocks, $rightblocks);
+ $recblocks = get_records('blocks','visible','1');
+ blocks_used($allblocks, $recblocks);
}
$SESSION->fromdiscussion = "$CFG->wwwroot/course/view.php?id=$course->id";
//Just call this with the appropiate parammeters.
return blocks_get_default_blocks(NULL,$blockinfo);
}
+
+// This is used to register the blocks that are displayed in the course page.
+// Set in course/view.php, and read from any other place.
+function blocks_used($blocks = NULL, $records = NULL) {
+ static $used = NULL;
+
+ if(!empty($blocks) && !empty($records)) {
+ $used = array();
+ foreach($blocks as $val) {
+ if($val > 0 && isset($records[$val])) {
+ $used[] = $records[$val]->name;
+ }
+ }
+ }
+
+ return $used;
+}
+
?>