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.
This commit is contained in:
urs_hunkler 2007-11-16 13:33:51 +00:00
parent 61ac129b10
commit 10654e2d4a

View File

@ -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.
*