]> git.mjollnir.org Git - moodle.git/commitdiff
merged from 1.9 :: MDL-12221 :: Added wrapper functions for print_box, print_box_star...
authorurs_hunkler <urs_hunkler>
Fri, 16 Nov 2007 13:33:51 +0000 (13:33 +0000)
committerurs_hunkler <urs_hunkler>
Fri, 16 Nov 2007 13:33:51 +0000 (13:33 +0000)
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

index 2f54e627431ea822cbd1e2b9639f1d7a45da935d..3a0b492234c6885245fd1d6ceec12f095e8f1f0c 100644 (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.
  *