PageRenderTime 38ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/business13/html/mod_roknavmenu/themes/gantry-splitmenu/layout.php

https://bitbucket.org/izubizarreta/https-bitbucket.org-bityvip-alpes
PHP | 135 lines | 111 code | 15 blank | 9 comment | 37 complexity | a1d47dab2c2cd494fe9627b2d162300e MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause, LGPL-2.1, MIT, LGPL-3.0, LGPL-2.0, JSON
  1. <?php
  2. /**
  3. * @version 3.2.22 August 3, 2012
  4. * @author RocketTheme http://www.rockettheme.com
  5. * @copyright Copyright (C) 2007 - 2012 RocketTheme, LLC
  6. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die('Restricted access');
  10. class GantrySplitmenuLayout extends AbstractRokMenuLayout
  11. {
  12. protected $theme_path;
  13. protected $params;
  14. private $activeid;
  15. public function __construct(&$args)
  16. {
  17. parent::__construct($args);
  18. global $gantry;
  19. $theme_rel_path = "/html/mod_roknavmenu/themes/gantry-splitmenu";
  20. $this->theme_path = $gantry->templatePath . $theme_rel_path;
  21. $this->args['theme_path'] = $this->theme_path;
  22. $this->args['theme_rel_path'] = $gantry->templateUrl. $theme_rel_path;
  23. $this->args['theme_url'] = $this->args['theme_rel_path'];
  24. }
  25. public function stageHeader()
  26. {
  27. global $gantry;
  28. //don't include class_sfx on 3rd level menu
  29. $this->args['class_sfx'] = (array_key_exists('startlevel', $this->args) && $this->args['startLevel']==1) ? '' : $this->args['class_sfx'];
  30. $this->activeid = (array_key_exists('splitmenu_fusion_enable_current_id', $this->args) && $this->args['splitmenu_fusion_enable_current_id']== 0) ? false : true;
  31. JHtml::_('behavior.mootools');
  32. if ($this->isIe(6)) {
  33. $gantry->addScript(JURI::Root(true).'/modules/mod_roknavmenu/themes/fusion/js/sfhover.js');
  34. }
  35. }
  36. function isIe($version = false)
  37. {
  38. $agent=$_SERVER['HTTP_USER_AGENT'];
  39. $found = strpos($agent,'MSIE ');
  40. if ($found) {
  41. if ($version) {
  42. $ieversion = substr(substr($agent,$found+5),0,1);
  43. if ($ieversion == $version) return true;
  44. else return false;
  45. } else {
  46. return true;
  47. }
  48. } else {
  49. return false;
  50. }
  51. if (stristr($agent, 'msie'.$ieversion)) return true;
  52. return false;
  53. }
  54. protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
  55. {
  56. $item_params = $item->getParams();
  57. //not so elegant solution to add subtext
  58. $item_subtext = $item_params->get('splitmenu_item_subtext','');
  59. if ($item_subtext=='') $item_subtext = false;
  60. else $item->addLinkClass('subtext');
  61. ?>
  62. <li <?php if($item->hasListItemClasses()) : ?>class="<?php echo $item->getListItemClasses()?>"<?php endif;?> <?php if($item->hasCssId() && $this->activeid):?>id="<?php echo $item->getCssId();?>"<?php endif;?>>
  63. <?php if ($item->getType() == 'menuitem') : ?>
  64. <a <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?>"<?php endif;?> <?php if($item->hasLink()):?>href="<?php echo $item->getLink();?>"<?php endif;?> <?php if($item->hasTarget()):?>target="<?php echo $item->getTarget();?>"<?php endif;?> <?php if ($item->hasAttribute('onclick')): ?>onclick="<?php echo $item->getAttribute('onclick'); ?>"<?php endif; ?><?php if ($item->hasLinkAttribs()): ?> <?php echo $item->getLinkAttribs(); ?><?php endif; ?>>
  65. <span>
  66. <?php echo $item->getTitle();?>
  67. <?php if (!empty($item_subtext)) :?>
  68. <em><?php echo $item_subtext; ?></em>
  69. <?php endif; ?>
  70. <?php if ($item->getParent() == 0 && $item->hasChildren()): ?>
  71. <span class="daddyicon"></span>
  72. <?php endif; ?>
  73. <?php if ($item->getCssId()): ?>
  74. <div class="arrow-indicator"></div>
  75. <?php endif; ?>
  76. </span>
  77. </a>
  78. <?php elseif($item->getType() == 'separator') : ?>
  79. <span <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?> nolink"<?php endif;?>>
  80. <span>
  81. <?php echo $item->getTitle();?>
  82. <?php if (!empty($item_subtext)) :?>
  83. <em><?php echo $item_subtext; ?></em>
  84. <?php endif; ?>
  85. <?php if ($item->getParent() == 0 && $item->hasChildren()): ?>
  86. <span class="daddyicon"></span>
  87. <?php endif; ?>
  88. </span>
  89. </span>
  90. <?php endif; ?>
  91. <?php if ($item->hasChildren()): ?>
  92. <ul class="level<?php echo intval($item->getLevel())+2; ?>">
  93. <?php foreach ($item->getChildren() as $child) : ?>
  94. <?php $this->renderItem($child, $menu); ?>
  95. <?php endforeach; ?>
  96. </ul>
  97. <?php endif; ?>
  98. </li>
  99. <?php
  100. }
  101. public function renderMenu(&$menu) {
  102. ob_start();
  103. ?>
  104. <?php if ($menu->getChildren()) : ?>
  105. <div class="rt-splitmenu">
  106. <div class="rt-menubar">
  107. <div class="rt-menubar2">
  108. <ul class="menu<?php echo $this->args['class_sfx']; ?> level1" <?php if(array_key_exists('tag_id',$this->args)):?><?php endif;?>>
  109. <?php foreach ($menu->getChildren() as $item) : ?>
  110. <?php $this->renderItem($item, $menu); ?>
  111. <?php endforeach; ?>
  112. </ul>
  113. </div>
  114. </div>
  115. </div>
  116. <?php endif; ?>
  117. <?php
  118. return ob_get_clean();
  119. }
  120. }