1 <?php
2 3 4 5 6 7 8
9
10 defined('JPATH_PLATFORM') or die;
11
12 13 14 15 16
17 class JDocumentRendererHtmlMessage extends JDocumentRenderer
18 {
19 20 21 22 23 24 25 26 27 28 29
30 public function render($name, $params = array(), $content = null)
31 {
32 $msgList = $this->getData();
33 $displayData = array(
34 'msgList' => $msgList,
35 'name' => $name,
36 'params' => $params,
37 'content' => $content,
38 );
39
40 $app = JFactory::getApplication();
41 $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/message.php';
42
43 if (file_exists($chromePath))
44 {
45 include_once $chromePath;
46 }
47
48 if (function_exists('renderMessage'))
49 {
50 JLog::add('renderMessage() is deprecated. Override system message rendering with layouts instead.', JLog::WARNING, 'deprecated');
51
52 return renderMessage($msgList);
53 }
54
55 return JLayoutHelper::render('joomla.system.message', $displayData);
56 }
57
58 59 60 61 62 63 64
65 private function getData()
66 {
67
68 $lists = array();
69
70
71 $messages = JFactory::getApplication()->getMessageQueue();
72
73
74 if (is_array($messages) && !empty($messages))
75 {
76 foreach ($messages as $msg)
77 {
78 if (isset($msg['type']) && isset($msg['message']))
79 {
80 $lists[$msg['type']][] = $msg['message'];
81 }
82 }
83 }
84
85 return $lists;
86 }
87 }
88