Skip to content

Commit

Permalink
MDL-12221 custom themes revisited - fixed bug in previous commit, add…
Browse files Browse the repository at this point in the history
…ed more developer debug; merged from MOODLE_19_STABLE
  • Loading branch information
skodak committed Nov 23, 2007
1 parent 9f7f1a7 commit 0ad439b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
21 changes: 20 additions & 1 deletion lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions theme/standardwhite/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h1 class="headermain"><?php echo $heading ?></h1>
<?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'); ?>

0 comments on commit 0ad439b

Please sign in to comment.