Source code for file /joomla/application/module/helper.php
Documentation is available at helper.php
* @version $Id: helper.php 6674 2007-02-19 05:52:03Z Jinx $
* @package Joomla.Framework
* @subpackage Application
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
// Import library dependencies
jimport('joomla.application.component.helper');
* @package Joomla.Framework
* @subpackage Application
* @param string $name The name of the module
* @return object The Module object
$total =
count($modules);
for ($i =
0; $i <
$total; $i++
) {
if ($modules[$i]->name ==
$name)
* Get modules by position
* @param string $position The position of the module
* @return array An array of module objects
$total =
count($modules);
for($i =
0; $i <
$total; $i++
) {
if($modules[$i]->position ==
$position) {
$result[] =
& $modules[$i];
global $mainframe, $option;
// Handle legacy globals if enabled
if ($mainframe->getCfg('legacy'))
// Include legacy globals
global $my, $database, $acl;
// Get the task variable for local scope
// For backwards compatibility extract the config vars as globals
$path =
JPATH_BASE.
'/modules/'.
$module->module.
'/'.
$module->module.
'.php';
if (!$module->user &&
file_exists( $path ) &&
empty($module->content))
$lang->load($module->module);
// Load the module chrome functions
require_once (JPATH_BASE.
'/modules/templates/modules.php');
$chromePath =
JPATH_BASE.
'/templates/'.
$mainframe->getTemplate().
'/html/modules.php';
if (!isset
( $chrome[$chromePath]))
require_once ($chromePath);
$chrome[$chromePath] =
true;
//make sure a style is set
if(!isset
($attribs['style'])) {
$attribs['style'] =
'none';
//dynamically add outline style
$attribs['style'] .=
' outline';
foreach(explode(' ', $attribs['style']) as $style)
$chromeMethod =
'modChrome_'.
$style;
// Apply chrome and render module
$module->style =
$attribs['style'];
$chromeMethod($module, $params, $attribs);
* Get the path to a layout for a module
* @param string $module The name of the module
* @param string $layout The name of the module layout
* @return string The path to the module layout
// Build the template and base path for the layout
$tPath =
JPATH_BASE.
DS.
'templates'.
DS.
$mainframe->getTemplate().
DS.
'html'.
DS.
$module.
DS.
$layout.
'.php';
$bPath =
JPATH_BASE.
DS.
'modules'.
DS.
$module.
DS.
'tmpl'.
DS.
$layout.
'.php';
// If the template has a layout override use it
global $mainframe, $Itemid;
$aid =
$user->get('aid', 0);
$wheremenu = isset
( $Itemid ) ?
' AND ( mm.menuid = '.
$Itemid .
' OR mm.menuid = 0 )' :
'';
$query =
'SELECT id, title, module, position, content, showtitle, control, params'
.
' FROM #__modules AS m'
.
' LEFT JOIN #__modules_menu AS mm ON mm.moduleid = m.id'
.
' WHERE m.published = 1'
.
' AND m.access <= '. (int)
$aid
.
' AND m.client_id = '. (int)
$mainframe->getClientId()
.
' ORDER BY position, ordering';
$modules =
$db->loadObjectList();
$total =
count($modules);
for($i =
0; $i <
$total; $i++
)
//determine if this is a custom module
$file =
$modules[$i]->module;
$custom =
substr( $file, 0, 4 ) ==
'mod_' ?
0 :
1;
$modules[$i]->user =
$custom;
// CHECK: custom module name is given by the title field, otherwise it's just 'om' ??
$modules[$i]->name =
$custom ?
$modules[$i]->title :
substr( $file, 4 );
$modules[$i]->style =
null;
$modules[$i]->position =
strtolower($modules[$i]->position);