From 10654e2d4a33eac8fa59befc8400e4b468c27824 Mon Sep 17 00:00:00 2001 From: urs_hunkler Date: Fri, 16 Nov 2007 13:33:51 +0000 Subject: [PATCH] merged from 1.9 :: MDL-12221 :: Added wrapper functions for print_box, print_box_start and print_box_end to be able to add custom_corners to any boxes. If you call print_custom_corners_box with the same parameters as print_box and custom_corners is enabled you get the custom corners divs within those boxes and can style them accordingly. --- lib/weblib.php | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/lib/weblib.php b/lib/weblib.php index 2f54e62743..3a0b492234 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -3742,6 +3742,80 @@ function print_box_end($return=false) { } +/** + * Function adds custom_corners to boxes + * + * @param string $message, the content of the box + * @param string $classes, space-separated class names. + * @param string $ids, space-separated id names. + * @param boolean $return, return as string or just print it + */ +function print_custom_corners_box($message, $classes='generalbox', $ids='', $return=false) { + + $output = print_custom_corners_box_start($classes, $ids, true); + $output .= stripslashes_safe($message); + $output .= print_custom_corners_box_end(true); + + if ($return) { + return $output; + } else { + echo $output; + } +} + + +/** + * Function adds custom_corners to boxes + * Calls print_box_start + * + * @param string $classes, space-separated class names. + * @param string $ids, space-separated id names. + * @param boolean $return, return as string or just print it + */ +function print_custom_corners_box_start($classes='generalbox', $ids='', $return=false) { + global $CFG, $THEME; + + $output = print_box_start('ccbox '.$classes, $ids, true); + + if (!empty($THEME->customcorners)) { + require_once($CFG->dirroot.'/lib/custom_corners_lib.php'); + + $output .= print_custom_corners_start(true, true); + } + + if ($return) { + return $output; + } else { + echo $output; + } +} + + +/** + * Function adds custom_corners to boxes + * Calls print_box_end + * + * @param boolean $return, return as string or just print it + */ +function print_custom_corners_box_end($return=false) { + global $CFG, $THEME; + + if (!empty($THEME->customcorners)) { + require_once($CFG->dirroot.'/lib/custom_corners_lib.php'); + + $output .= print_custom_corners_end(true); + } + + $output .= print_box_end(true);; + + if ($return) { + return $output; + } else { + echo $output; + } +} + + /** * Print a self contained form with a single submit button. * -- 2.39.5