[ Index ]

PHP Cross Reference of Joomla 1.5.25

title

Body

[close]

/modules/mod_mainmenu/tmpl/ -> default.php (source)

   1  <?php
   2  
   3  // no direct access
   4  defined('_JEXEC') or die('Restricted access');
   5  
   6  
   7  if ( ! defined('modMainMenuXMLCallbackDefined') )
   8  {
   9  function modMainMenuXMLCallback(&$node, $args)
  10  {
  11      $user    = &JFactory::getUser();
  12      $menu    = &JSite::getMenu();
  13      $active    = $menu->getActive();
  14      $path    = isset($active) ? array_reverse($active->tree) : null;
  15  
  16      if (($args['end']) && ($node->attributes('level') >= $args['end']))
  17      {
  18          $children = $node->children();
  19          foreach ($node->children() as $child)
  20          {
  21              if ($child->name() == 'ul') {
  22                  $node->removeChild($child);
  23              }
  24          }
  25      }
  26  
  27      if ($node->name() == 'ul') {
  28          foreach ($node->children() as $child)
  29          {
  30              if ($child->attributes('access') > $user->get('aid', 0)) {
  31                  $node->removeChild($child);
  32              }
  33          }
  34      }
  35  
  36      if (($node->name() == 'li') && isset($node->ul)) {
  37          $node->addAttribute('class', 'parent');
  38      }
  39  
  40      if (isset($path) && (in_array($node->attributes('id'), $path) || in_array($node->attributes('rel'), $path)))
  41      {
  42          if ($node->attributes('class')) {
  43              $node->addAttribute('class', $node->attributes('class').' active');
  44          } else {
  45              $node->addAttribute('class', 'active');
  46          }
  47      }
  48      else
  49      {
  50          if (isset($args['children']) && !$args['children'])
  51          {
  52              $children = $node->children();
  53              foreach ($node->children() as $child)
  54              {
  55                  if ($child->name() == 'ul') {
  56                      $node->removeChild($child);
  57                  }
  58              }
  59          }
  60      }
  61  
  62      if (($node->name() == 'li') && ($id = $node->attributes('id'))) {
  63          if ($node->attributes('class')) {
  64              $node->addAttribute('class', $node->attributes('class').' item'.$id);
  65          } else {
  66              $node->addAttribute('class', 'item'.$id);
  67          }
  68      }
  69  
  70      if (isset($path) && $node->attributes('id') == $path[0]) {
  71          $node->addAttribute('id', 'current');
  72      } else {
  73          $node->removeAttribute('id');
  74      }
  75      $node->removeAttribute('rel');
  76      $node->removeAttribute('level');
  77      $node->removeAttribute('access');
  78  }
  79      define('modMainMenuXMLCallbackDefined', true);
  80  }
  81  
  82  modMainMenuHelper::render($params, 'modMainMenuXMLCallback');


Generated: Mon Nov 14 16:47:20 2011 Cross-referenced by PHPXref 0.7.1