/**
* Print a message in a standard themed box.
+ * See, {@link print_simple_box_start}.
*
- * @param string $message ?
- * @param string $align ?
- * @param string $width ?
- * @param string $color ?
- * @param int $padding ?
- * @param string $class ?
+ * @param string $align string, alignment of the box, not the text (default center, left, right).
+ * @param string $width string, width of the box, including units %, for example '100%'.
+ * @param string $color string, background colour of the box, for example '#eee'.
+ * @param int $padding integer, padding in pixels, specified without units.
+ * @param string $class string, space-separated class names.
* @todo Finish documenting this function
*/
function print_simple_box($message, $align='', $width='', $color='', $padding=5, $class='generalbox', $id='') {
/**
* Print the top portion of a standard themed box.
+ * To improve accessibility, the box is now a DIV, not a TABLE.
+ * If the box is left aligned and width is not specified the box will shrink
+ * to fit - as per the 1.5 table behaviour.
+ * If alignment and width are not specified, the box will be centred and given
+ * a width of 30em, based on usability studies
+ * {@link http://www.maxdesign.com.au/presentation/em/ Ideal line length for content}.
+ * Text will be left aligned - the behaviour has changed, but will hopefully look OK.
*
- * @param string $align string, alignment of the box, not the text (default left, center, right).
- * @param string $width string, width of the box, including units, for example '100%'.
+ * @param string $align string, alignment of the box, not the text (default center, left, right).
+ * @param string $width string, width of the box, including % units, for example '100%'.
* @param string $color string, background colour of the box, for example '#eee'.
* @param int $padding integer, padding in pixels, specified without units.
* @param string $class string, space-separated class names.
if ($color) {
$style_out .= 'background-color:'. $color .'; ';
}
- if ($align && 'center' == $align) {
+ if (!$align || 'center' == $align) {
+ if (! $width) {
+ $style_out .= 'width:30em; ';
+ }
$style_out .= 'margin-left:auto; margin-right:auto; ';
}
- elseif (!$align || 'left' == $align) {
+ elseif ($align && 'left' == $align) {
$style_out .= 'float:left; ';
}
else {
if ($id) {
$id = 'id="'. $id .'"';
}
- echo "<div $id class=\"$class\" style=\"$style_out\"><div class=\"$class"."content\" style=\"$style_in\">\n";
+ echo "\n<div $id class=\"$class\" style=\"$style_out\"><div class=\"$class"."content\" style=\"$style_in\">\n";
+ global $CFG;
+ if ($CFG->debug > 7) {
+ echo "<!--PARAMS, a:$align, w:$width, c:$color, p:$padding, cl:$class, id:$id -->\n";
+ }
}
/**