29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-29 16:43:42 +00:00
cms/includes/pathway.php
2010-06-23 17:41:14 +00:00

65 lines
1.2 KiB
PHP

<?php
/**
* @version $Id$
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
/**
* Class to manage the site application pathway.
*
* @package Joomla.Site
* @subpackage Application
* @since 1.5
*/
class JPathwaySite extends JPathway
{
/**
* Class constructor.
*
* @param array
*/
public function __construct($options = array())
{
//Initialise the array.
$this->_pathway = array();
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($item = $menu->getActive())
{
$menus = $menu->getMenu();
$home = $menu->getDefault();
if (is_object($home) && ($item->id != $home->id))
{
foreach($item->tree as $menupath)
{
$url = '';
$link = $menu->getItem($menupath);
switch($link->type)
{
case 'menulink':
case 'url':
$url = $link->link;
break;
case 'separator':
$url = null;
break;
default:
$url = 'index.php?Itemid='.$link->id;
}
$this->addItem($menus[$menupath]->title, $url);
}
}
}
}
}