MDL-12221 custom themes revisited - fixed bug in previous commit, added more developer debug

This commit is contained in:
skodak
2007-11-23 20:23:43 +00:00
parent d6756ebbbc
commit 6900784f92
2 changed files with 21 additions and 3 deletions
+20 -1
View File
@@ -2797,6 +2797,11 @@ function print_footer($course=NULL, $usercourse=NULL, $return=false) {
$menu = '';
}
/// there should be exactly one open container 'content'
if (open_containers() != 1) {
debugging('Unexpected number of open containers: '.open_containers().', expecting 1.', DEBUG_DEVELOPER);
}
/// Provide some performance info if required
$performanceinfo = '';
if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {
@@ -3911,7 +3916,7 @@ function print_container_end($return=false) {
global $THEME;
if (empty($THEME->open_containers)) {
debugging('Incorrect closing of custom corners - no more open containers');
debugging('Incorrect closing of custom corners - no more open containers.', DEBUG_DEVELOPER);
$idbase = '';
} else {
$idbase = array_pop($THEME->open_containers);
@@ -3930,6 +3935,20 @@ function print_container_end($return=false) {
}
}
/**
* Returns number of currently open containers
* @return int number of open containers
*/
function open_containers() {
global $THEME;
if (!isset($THEME->open_containers)) {
$THEME->open_containers = array();
}
return count($THEME->open_containers);
}
/**
* Force closing of all open containers except the main content one.
* @param boolean $return, return as string or just print it
+1 -2
View File
@@ -40,7 +40,6 @@
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
?>
<hr />
<?php }
print_container_end(); ?>
<?php } ?>
<!-- END OF HEADER -->
<?php print_container_start(true, '', 'content'); ?>