View difference between Paste ID: jX88B38J and DQM4JYwJ
SHOW: | | - or go back to the newest paste.
1
<?php
2
/**
3
 * @package     Joomla.Administrator
4
 * @subpackage  Template.Isis
5
 *
6
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
7
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
8
 */
9
10
defined('_JEXEC') or die;
11
12
function renderMessage($msgList)
13
{
14
	$buffer  = null;
15
	
16
	$buffer .= "<script>
17
                	setTimeout(function() {
18
                    		jQuery('#system-message-container').fadeOut('fast');
19
                	}, 2000);
20
            	</script>";
21
22
	$buffer .= "\n<div id=\"system-message-container\">";
23
	$alert = array('error' => 'alert-error', 'warning' => '', 'notice' => 'alert-info', 'message' => 'alert-success');
24
25
	// Only render the message list and the close button if $msgList has items
26
	if (is_array($msgList) && (count($msgList) >= 1))
27
	{
28
		$buffer .= '<button type="button" class="close" data-dismiss="alert">&times;</button>';
29
		foreach ($msgList as $type => $msgs)
30
		{
31
			$buffer .= '<div class="alert ' . $alert[$type]. '">';
32
			$buffer .= "\n<h4 class=\"alert-heading\">" . JText::_($type) . "</h4>";
33
			if (count($msgs))
34
			{
35
				foreach ($msgs as $msg)
36
				{
37
					$buffer .= "\n\t\t<p>" . $msg . "</p>";
38
				}
39
			}
40
			$buffer .= "\n</div>";
41
		}
42
	}
43
44
	$buffer .= "\n</div>";
45
46
	return $buffer;
47
}