Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
modules.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Document
5  *
6  * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
7  * @license GNU General Public License version 2 or later; see LICENSE
8  */
9 
10 defined('JPATH_PLATFORM') or die;
11 
12 /**
13  * JDocument Modules renderer
14  *
15  * @package Joomla.Platform
16  * @subpackage Document
17  * @since 11.1
18  */
20 {
21  /**
22  * Renders multiple modules script and returns the results as a string
23  *
24  * @param string $position The position of the modules to render
25  * @param array $params Associative array of values
26  * @param string $content Module content
27  *
28  * @return string The output of the script
29  *
30  * @since 11.1
31  */
32  public function render($position, $params = array(), $content = null)
33  {
34  $renderer = $this->_doc->loadRenderer('module');
35  $buffer = '';
36 
37  $app = JFactory::getApplication();
38  $frontediting = $app->get('frontediting', 1);
39  $user = JFactory::getUser();
40 
41  $canEdit = $user->id && $frontediting && !($app->isAdmin() && $frontediting < 2) && $user->authorise('core.edit', 'com_modules');
42  $menusEditing = ($frontediting == 2) && $user->authorise('core.edit', 'com_menus');
43 
44  foreach (JModuleHelper::getModules($position) as $mod)
45  {
46  $moduleHtml = $renderer->render($mod, $params, $content);
47 
48  if ($app->isSite() && $canEdit && trim($moduleHtml) != '' && $user->authorise('core.edit', 'com_modules.module.' . $mod->id))
49  {
50  $displayData = array('moduleHtml' => &$moduleHtml, 'module' => $mod, 'position' => $position, 'menusediting' => $menusEditing);
51  JLayoutHelper::render('joomla.edit.frontediting_modules', $displayData);
52  }
53 
54  $buffer .= $moduleHtml;
55  }
56 
57  return $buffer;
58  }
59 }