PageRenderTime 109ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/pathway.php

https://github.com/joebushi/joomla
PHP | 64 lines | 36 code | 9 blank | 19 comment | 4 complexity | 139f3a4d5a9900b5b2c9faf6fed5be27 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  5. * @license GNU General Public License version 2 or later; see LICENSE.txt
  6. */
  7. // No direct access.
  8. defined('_JEXEC') or die;
  9. /**
  10. * Class to manage the site application pathway.
  11. *
  12. * @package Joomla.Site
  13. * @subpackage Application
  14. * @since 1.5
  15. */
  16. class JPathwaySite extends JPathway
  17. {
  18. /**
  19. * Class constructor.
  20. *
  21. * @param array
  22. */
  23. public function __construct($options = array())
  24. {
  25. //Initialise the array.
  26. $this->_pathway = array();
  27. $menu = &JSite::getMenu();
  28. if ($item = $menu->getActive())
  29. {
  30. $menus = $menu->getMenu();
  31. $home = $menu->getDefault();
  32. if (is_object($home) && ($item->id != $home->id))
  33. {
  34. foreach($item->tree as $menupath)
  35. {
  36. $url = '';
  37. $link = $menu->getItem($menupath);
  38. switch($link->type)
  39. {
  40. case 'menulink':
  41. case 'url':
  42. $url = $link->link;
  43. break;
  44. case 'separator':
  45. $url = null;
  46. break;
  47. default:
  48. $url = 'index.php?Itemid='.$link->id;
  49. }
  50. $this->addItem($menus[$menupath]->title, $url);
  51. }
  52. }
  53. }
  54. }
  55. }