Skip to content

Commit

Permalink
MDL-11370 :: added a global var $THEME->customcornersopen to track pr…
Browse files Browse the repository at this point in the history
…operly closed custom corners divs. In function print_footer I added a check if some custom_corneres divs are still open and eventually close them.
  • Loading branch information
urs_hunkler committed Sep 24, 2007
1 parent 540286f commit c7a66cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/custom_corners_lib.php
Expand Up @@ -17,6 +17,7 @@
* @param mixed $idbase, optionally, define one idbase to be added to all the elements in the corners
*/
function print_custom_corners_start($clearfix=false, $return=false, $idbase=null) {
global $THEME;

/// Analise if we want ids for the custom corner elements
$idbt = '';
Expand All @@ -37,7 +38,9 @@ function print_custom_corners_start($clearfix=false, $return=false, $idbase=null
$output .= "\n";
$output .= '<div '.$idi1.'class="i1"><div '.$idi2.'class="i2">';
$output .= (!empty($clearfix)) ? '<div '.$idi3.'class="i3 clearfix">' : '<div '.$idi3.'class="i3">';


$THEME->customcornersopen += 1;

if ($return) {
return $output;
} else {
Expand All @@ -53,6 +56,7 @@ function print_custom_corners_start($clearfix=false, $return=false, $idbase=null
* @param mixed $idbase, optionally, define one idbase to be added to all the elements in the corners
*/
function print_custom_corners_end($return=false, $idbase=null) {
global $THEME;

/// Analise if we want ids for the custom corner elements
$idbb = '';
Expand All @@ -66,7 +70,9 @@ function print_custom_corners_end($return=false, $idbase=null) {
$output .= "\n";
$output .= '<div '.$idbb.'class="bb"><div>&nbsp;</div></div>'."\n";
$output .= '</div>';


$THEME->customcornersopen -= ($THEME->customcornersopen > 0) ? 1 : 0;

if ($return) {
return $output;
} else {
Expand Down
8 changes: 8 additions & 0 deletions lib/weblib.php
Expand Up @@ -2665,6 +2665,13 @@ function print_footer($course=NULL, $usercourse=NULL, $return=false) {
}
}

/// Close eventually open custom_corner divs
if ((!empty($THEME->customcorners)) && ($THEME->customcornersopen > 1)) {
require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
while ($THEME->customcornersopen > 1) {
print_custom_corners_end();
}
}

/// Include the actual footer file

Expand Down Expand Up @@ -5948,6 +5955,7 @@ function print_side_block_start($heading='', $attributes = array()) {
if (!empty($THEME->customcorners)) {
echo '<div class="i1"><div class="i2">';
echo '<div class="i3">';
$THEME->customcornersopen += 1;
}
echo '<div class="content">';

Expand Down

0 comments on commit c7a66cc

Please sign in to comment.