Add return option to notify(). Backported from MOODLE_17_STABLE.

This commit is contained in:
tjhunt
2006-10-31 10:48:01 +00:00
parent fee8ca9ee9
commit 4ca8d4783b
+8 -3
View File
@@ -4337,16 +4337,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;
}