Added additional variables from base to general.php layout.
authorPatrick Malley <ptrkmkl@newschoollearning.com>
Mon, 12 Apr 2010 12:09:58 +0000 (12:09 +0000)
committerPatrick Malley <ptrkmkl@newschoollearning.com>
Mon, 12 Apr 2010 12:09:58 +0000 (12:09 +0000)
theme/boxxie/layout/general.php

index da351b9..5be97ff 100644 (file)
@@ -1,4 +1,20 @@
 <?php
+
+$hasheading = ($PAGE->heading);
+$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
+$hasfooter = (empty($PAGE->layout_options['nofooter']));
+$hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT);
+$hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT);
+
+$bodyclasses = array();
+if ($hassidepre && !$hassidepost) {
+    $bodyclasses[] = 'side-pre-only';
+} else if ($hassidepost && !$hassidepre) {
+    $bodyclasses[] = 'side-post-only';
+} else if (!$hassidepost && !$hassidepre) {
+    $bodyclasses[] = 'content-only';
+}
+
 echo $OUTPUT->doctype() ?>
 <html <?php echo $OUTPUT->htmlattributes() ?>>
 <head>
@@ -7,11 +23,11 @@ echo $OUTPUT->doctype() ?>
   <?php echo $OUTPUT->standard_head_html() ?>
 </head>
  
-<body id="<?php echo $PAGE->bodyid; ?>" class="<?php echo $PAGE->bodyclasses; ?>">
+<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
 
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
-<?php if ($PAGE->heading || (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar())) { ?>
+<?php if ($hasheading || $hasnavbar) { ?>
 
 <div id="page-wrapper">
   <div id="page" class="clearfix">
@@ -28,7 +44,7 @@ echo $OUTPUT->doctype() ?>
         ?></div><?php 
       } ?>
       
-      <?php if (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()) { ?>
+      <?php if ($hasnavbar) { ?>
         <div class="navbar clearfix">
           <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
           <div class="navbutton"> <?php echo $PAGE->button; ?></div>
@@ -50,17 +66,21 @@ echo $OUTPUT->doctype() ?>
             </div>
           </div>
                 
+          <?php if ($hassidepre) { ?>
           <div id="region-pre">
             <div class="region-content">
               <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
             </div>
           </div>
-            
+          <?php } ?>
+
+          <?php if ($hassidepost) { ?>
           <div id="region-post">
             <div class="region-content">
               <?php echo $OUTPUT->blocks_for_region('side-post') ?>
             </div>
           </div>
+          <?php } ?>
               
         </div>
       </div>
@@ -79,7 +99,7 @@ echo $OUTPUT->doctype() ?>
 
 <?php }
 
-if ($PAGE->heading || (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar())) { ?>
+if ($hasheading || $hasnavbar) { ?>
   
   </div> <!-- END #page -->
 </div> <!-- END #page-wrapper -->