]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12221 custom themes revisited - fixed bug in previous commit, added more develope...
authorskodak <skodak>
Fri, 23 Nov 2007 20:26:16 +0000 (20:26 +0000)
committerskodak <skodak>
Fri, 23 Nov 2007 20:26:16 +0000 (20:26 +0000)
lib/weblib.php
theme/standardwhite/header.html

index 849c5a21abe9e7d0cd7b688ee3a13665c2996997..6174f4ef775316847acf596ee728a539924386e2 100644 (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
index 986fd4c921311c44db5b716ddbce814b96b923a9..deb3ec5762e9698c488ed70c6b1e891441346ff5 100644 (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'); ?>