[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/includes/ -> pathway.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  // No direct access.
   8  defined('_JEXEC') or die;
   9  
  10  /**
  11   * Class to manage the site application pathway.
  12   *
  13   * @package        Joomla.Site
  14   * @subpackage    Application
  15   * @since        1.5
  16   */
  17  class JPathwaySite extends JPathway
  18  {
  19      /**
  20       * Class constructor.
  21       *
  22       * @param    array
  23       *
  24       * @return    JPathwaySite
  25       * @since    1.5
  26       */
  27  	public function __construct($options = array())
  28      {
  29          //Initialise the array.
  30          $this->_pathway = array();
  31  
  32          $app    = JApplication::getInstance('site');
  33          $menu    = $app->getMenu();
  34  
  35          if ($item = $menu->getActive()) {
  36              $menus = $menu->getMenu();
  37              $home = $menu->getDefault();
  38  
  39              if (is_object($home) && ($item->id != $home->id)) {
  40                  foreach($item->tree as $menupath)
  41                  {
  42                      $url = '';
  43                      $link = $menu->getItem($menupath);
  44  
  45                      switch($link->type)
  46                      {
  47                          case 'separator':
  48                              $url = null;
  49                              break;
  50  
  51                          case 'url':
  52                              if ((strpos($link->link, 'index.php?') === 0) && (strpos($link->link, 'Itemid=') === false)) {
  53                                  // If this is an internal Joomla link, ensure the Itemid is set.
  54                                  $url = $link->link.'&Itemid='.$link->id;
  55                              }
  56                              else {
  57                                  $url = $link->link;
  58                              }
  59                              break;
  60  
  61                          case 'alias':
  62                              // If this is an alias use the item id stored in the parameters to make the link.
  63                              $url = 'index.php?Itemid='.$link->params->get('aliasoptions');
  64                              break;
  65  
  66                          default:
  67                              $router = JSite::getRouter();
  68                              if ($router->getMode() == JROUTER_MODE_SEF) {
  69                                  $url = 'index.php?Itemid='.$link->id;
  70                              }
  71                              else {
  72                                  $url .= $link->link.'&Itemid='.$link->id;
  73                              }
  74                              break;
  75                      }
  76  
  77                      $this->addItem($menus[$menupath]->title, $url);
  78                  }
  79              }
  80          }
  81      }
  82  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1