1 <?php
2 3 4 5 6 7 8
9
10 defined('JPATH_PLATFORM') or die;
11
12 13 14 15 16
17 class JDocumentRendererHtmlModules extends JDocumentRenderer
18 {
19 20 21 22 23 24 25 26 27 28 29
30 public function render($position, $params = array(), $content = null)
31 {
32 $renderer = $this->_doc->loadRenderer('module');
33 $buffer = '';
34
35 $app = JFactory::getApplication();
36 $user = JFactory::getUser();
37 $frontediting = ($app->isClient('site') && $app->get('frontediting', 1) && !$user->guest);
38 $menusEditing = ($app->get('frontediting', 1) == 2) && $user->authorise('core.edit', 'com_menus');
39
40 foreach (JModuleHelper::getModules($position) as $mod)
41 {
42 $moduleHtml = $renderer->render($mod, $params, $content);
43
44 if ($frontediting && trim($moduleHtml) != '' && $user->authorise('module.edit.frontend', 'com_modules.module.' . $mod->id))
45 {
46 $displayData = array('moduleHtml' => &$moduleHtml, 'module' => $mod, 'position' => $position, 'menusediting' => $menusEditing);
47 JLayoutHelper::render('joomla.edit.frontediting_modules', $displayData);
48 }
49
50 $buffer .= $moduleHtml;
51 }
52
53 JEventDispatcher::getInstance()->trigger('onAfterRenderModules', array(&$buffer, &$params));
54
55 return $buffer;
56 }
57 }
58