]> git.mjollnir.org Git - moodle.git/commitdiff
Add return option to notify(). Merged from MOODLE_17_STABLE.
authortjhunt <tjhunt>
Tue, 31 Oct 2006 10:47:26 +0000 (10:47 +0000)
committertjhunt <tjhunt>
Tue, 31 Oct 2006 10:47:26 +0000 (10:47 +0000)
lib/weblib.php

index e240d4c0f019483db3c586274b4c69cf9b9a3fc7..7bc2efd220d42b9d99f43976db2e8220c73eb833 100644 (file)
@@ -4749,16 +4749,21 @@ function redirect($url, $message='', $delay=-1) {
  * @param string $message The message to print out
  * @param string $style Optional style to display message text in
  * @param string $align Alignment option
+ * @param bool $return whether to return an output string or echo now
  */
-function notify ($message, $style='notifyproblem', $align='center') {
-
+function notify($message, $style='notifyproblem', $align='center', $return=false) {
     if ($style == 'green') {
         $style = 'notifysuccess';  // backward compatible with old color system
     }
 
     $message = clean_text($message);
 
-    echo '<div class="'.$style.'" align="'. $align .'">'. $message .'</div>'."<br />\n";
+    $output = '<div class="'.$style.'" align="'. $align .'">'. $message .'</div>'."<br />\n";
+    
+    if ($return) {
+        return $output;
+    }
+    echo $output;
 }