function xmapShowNavigatorLinks($config) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapNav.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapPlugins.php'; require_once JPATH_SITE . DS . 'includes' . DS . 'application.php'; # DEBUG ini_set('display_errors', 1); error_reporting(E_ALL); # DEBUG $sitemapid = JRequest::getInt('sitemap', 0); $link = urldecode(JRequest::getVar('link', '')); $name = JRequest::getCmd('e_name', ''); $Itemid = JRequest::getInt('Itemid'); if (!$sitemapid) { $sitemapid = $config->sitemap_default; } $sitemap = new XmapSitemap($database); if (!$sitemap->load($sitemapid)) { echo _XMAP_INVALID_SITEMAP; return false; } $menus = $sitemap->getMenus(); $list = array(); // Show the menu items if (!$link && !$Itemid) { foreach ($menus as $menutype => $menu) { $node = new stdclass(); $menu->id = 0; $menu->menutype = $menutype; $node->uid = $menu->uid = "menu" . $menu->id; $node->menutype = $menutype; $node->ordering = $menu->ordering; $node->priority = $menu->priority; $node->changefreq = $menu->changefreq; $node->browserNav = 3; $node->type = 'separator'; if (!($node->name = getMenuTitle($menutype, @$menu->module))) { $node->name = $menutype; } $node->link = '-menu-' . $menutype; $node->expandible = true; $node->selectable = false; //$node->name = $this->getMenuTitle($menutype,@$menu->module); // get the mod_mainmenu title from modules table $list[] = $node; } } else { $nav = new XmapNav($config, $sitemap); $extensions = XmapPlugins::loadAvailablePlugins(); $parent = new stdClass(); if ($Itemid) { $items =& JSite::getMenu(); $item =& $items->getItem($Itemid); if (isset($menus[$item->menutype])) { $parent->name = $item->name; $parent->id = $item->id; $parent->uid = 'itemid' . $item->id; $parent->link = $link; $parent->type = $item->type; $parent->browserNav = $item->browserNav; $parent->priority = $menus[$item->menutype]->priority; $parent->changefreq = $menus[$item->menutype]->changefreq; $parent->menutype = $item->menutype; $parent->selectable = false; $parent->expandible = true; } } else { $parent->id = 0; $parent->link = $link; } $list = $nav->expandLink($parent, $extensions); } XmapAdminHtml::showNavigatorLinks($sitemapid, $list, $name); }
/** Generate a full website tree */ function generateSitemap($type, &$config, &$cache) { $menus = $this->sitemap->getMenus(); $extensions = XmapPlugins::loadAvailablePlugins(); $root = array(); $this->startOutput($menus, $config); foreach ($menus as $menutype => $menu) { if ($type == 'html' && !$menu->show || $type == 'xml' && !$menu->showXML) { continue; } $node = new stdclass(); $menu->id = 0; $menu->menutype = $menutype; $node->uid = $menu->uid = "menu" . $menu->id; $node->menutype = $menutype; $node->ordering = $menu->ordering; $node->priority = $menu->priority; $node->changefreq = $menu->changefreq; $node->browserNav = 3; $node->type = 'separator'; $node->name = $this->getMenuTitle($menutype, @$menu->module); // get the mod_mainmenu title from modules table $this->startMenu($node); $this->printMenuTree($menu, $cache, $extensions); $this->endMenu($node); } $this->endOutput($menus); return true; }