From d48b2c3f329e7116b74d7fe57b66ba2e4323938a Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 31 Oct 2006 10:47:26 +0000 Subject: [PATCH] Add return option to notify(). Merged from MOODLE_17_STABLE. --- lib/weblib.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index e240d4c0f0..7bc2efd220 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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 '
'. $message .'
'."
\n"; + $output = '
'. $message .'
'."
\n"; + + if ($return) { + return $output; + } + echo $output; } -- 2.39.5