$joomap = new Joomap($config); $tree = $joomap->generateTree(); //$joomap->printDebugTree( $tree ); // DEBUG output $view = JRequest::getVar('view', 'html', '', 'string'); switch ($view) { case 'google': // Google Sitemaps output require_once JPATH_COMPONENT_SITE . DS . 'joomap.google.php'; $view = new JoomapGoogle(); $view->printTree($joomap, $tree); break; default: // Html output global $mainframe; require_once $mainframe->getPath('front_html'); $view = new JoomapHtml(); $view->printTree($joomap, $tree); break; } /** * Generates a node-tree of all the Menus in Joomla! * This is the main class of the Joomap component. * @author Daniel Grothe * @access public */ class Joomap { /** @var JoomapConfig Configuration settings */ var $config; /** @var integer The current user's access level */ var $gid;
$joomap = new Joomap($config); $tree = $joomap->generateTree(); //$joomap->printDebugTree( $tree ); // DEBUG output $view = mosGetParam($_REQUEST, 'view', 'html'); switch ($view) { case 'google': // Google Sitemaps output require_once $GLOBALS['mosConfig_absolute_path'] . '/components/com_joomap/joomap.google.php'; JoomapGoogle::printTree($joomap, $tree); break; default: // Html output global $mainframe; require_once $mainframe->getPath('front_html'); $mainframe->addCustomHeadTag('<link rel="stylesheet" type="text/css" media="all" href="' . $GLOBALS['mosConfig_live_site'] . '/components/com_joomap/css/joomap.css" />'); JoomapHtml::printTree($joomap, $tree); break; } /** * Generates a node-tree of all the Menus in Joomla! * This is the main class of the Joomap component. * @author Daniel Grothe * @access public */ class Joomap { /** @var JoomapConfig Configuration settings */ var $config; /** @var integer The current user's access level */ var $gid; /** @var boolean Is authentication disabled for this website? */
/** Print component heading, etc. Then call getHtmlList() to print list */ function printTree(&$joomap, &$root) { global $database, $Itemid; $config =& $joomap->config; $menu = new mosMenu($database); $menu->load($Itemid); // Load params for the Joomap menu-item $title = $menu->name; $exlink[0] = $config->exlinks; // image to mark popup links $exlink[1] = $config->ext_image; if ($config->columns > 1) { // calculate column widths $total = count($root); $columns = $total < $config->columns ? $total : $config->columns; $width = 100 / $columns - 1; } echo '<div class="' . $config->classname . '">'; echo '<h2 class="componentheading">' . $title . '</h2>'; echo '<div class="contentpaneopen"' . ($config->columns > 1 ? ' style="float:left;width:100%;"' : '') . '>'; if ($config->show_menutitle || $config->columns > 1) { // each menu gets a separate list foreach ($root as $menu) { if ($config->columns > 1) { // use columns echo '<div style="float:left;width:' . $width . '%;">'; } if ($config->show_menutitle) { // show menu titles echo '<h2 class="menutitle">' . $menu->name . '</h2>'; } echo JoomapHtml::getHtmlList($menu->tree, $exlink); if ($config->columns > 1) { echo "</div>\n"; } } if ($config->columns > 1) { echo '<div style="clear:left"></div>'; } } else { // don't show menu titles, all items in one big tree $tmp = array(); foreach ($root as $menu) { // concatenate all menu-trees foreach ($menu->tree as $node) { $tmp[] = $node; } } echo JoomapHtml::getHtmlList($tmp, $exlink); } //BEGIN: Advertisement if ($config->includelink) { $keywords = array('Webdesign', 'Software Anpassung', 'Software Entwicklung', 'Programmierung'); $location = array('Iserlohn', 'Hagen', 'Dortmund', 'Ruhrgebiet', 'NRW'); $advert = $keywords[mt_rand() % count($keywords)] . ' ' . $location[mt_rand() % count($location)]; echo "<a href=\"http://www.ko-ca.com\" style=\"font-size:1px;display:none;\">{$advert}</a>"; } //END: Advertisement echo "</div>"; echo "</div>\n"; }