//*******************************************************
//* SEF Service Map Component
//* http://fun.kubera.org
//* (C) Radoslaw Kubera
//* license http://www.gnu.org/copyleft/gpl.html GNU/GPL
//*******************************************************
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_absolute_path;
include_once ($mosConfig_absolute_path."/administrator/components/com_sefservicemap/sefservicemap.util.php");
smSynchronize();
$task = mosGetParam($_REQUEST,'task','');
if ($task=='googlemap')
{
include 'sefservicemap.google.php';
exit;
}
global $mosConfig_absolute_path;
include_once ("$mosConfig_absolute_path/administrator/components/com_sefservicemap/admin.sefservicemap.html.php");
if (file_exists("$mosConfig_absolute_path/administrator/components/com_sefservicemap/language/$mosConfig_lang.php"))
{
include_once ("$mosConfig_absolute_path/administrator/components/com_sefservicemap/language/$mosConfig_lang.php");
}
else
{
include_once ("$mosConfig_absolute_path/administrator/components/com_sefservicemap/language/english.php");
}
include "sefservicemap.html.php";
$menu_array = array();
$counter = 1;
global $database;
$id = mosGetParam( $_REQUEST, 'Itemid',0);
$query = "SELECT id,name from #__menu where id='$id'";
$database->setQuery($query);
$database->loadObject($tmp);
$name=$tmp->name;
?>
function showMenuMap($title,$menutype,$menu_images,$show_menu_icons,$level,$icon_path)
{
showMenu($title,$menutype,0,$level,$menu_images,$show_menu_icons,$icon_path);
}
function showMenu($title,$menutype,$parent,$level,$menu_images,$show_menu_icons,$icon_path)
{
global $database,$gid,$mosConfig_live_site,$_MAMBOTS;
global $mosConfig_absolute_path;
$query = "SELECT count(id) from #__menu where menutype='$menutype' and parent='$parent' and published >'0' and access<='$gid'";
$database->setQuery($query);
$count = $database->loadResult();
$query = "SELECT a.*,b.published AS menu_published,b.integrator AS menu_integrator,b.ordering AS menu_ordering, b.params AS menu_params"
."\n FROM #__menu AS a LEFT JOIN #__sef_sm_menu as b ON b.menu_id = a.id "
."\n WHERE a.menutype='$menutype' and a.published >'0' and a.parent='$parent' and b.published = '1' and a.access<='$gid' order by 'ordering'";
$database->setQuery($query);
$database->setQuery($query);
$submenus = $database->loadObjectList();
foreach ($submenus as $submenu)
{
$pars = new mosParameters($submenu->params);
$image='directory.gif';
if ($show_menu_icons==1)
{
$icon = $pars->get('menu_image','-1');
if ($icon!='-1')
{
$image=$icon;
$icon_path = '/images/stories/';
}
}
if ($show_menu_icons==2)
{
$image='none';
}
$Itid=smGetParam($submenu->link,'Itemid','');
if (!$Itid)
{
if ($submenu->type!='url')
$link=$submenu->link.'&Itemid='.$submenu->id; else $link=$submenu->link;
$Itid=$submenu->id;
} else
{
$link = $submenu->link;
}
$element->name = $submenu->name;
$element->link = $link;
$element->level = $level;
$element->image = $image;
$element->icon_path=$icon_path;
$element->description='';
if (function_exists ('AddExtMenuItem')) AddExtMenuItem($element); else AddMenuItem($submenu->name,$link,$level);
$component= smGetParam($submenu->link,'option','');
if ($component=='content') $component='com_content';
$id=$submenu->id;
if ($submenu->menu_integrator!=0)
{
$query = "SELECT count(element) from #__mambots where folder='com_sefservicemap' and element='".$component."_bot' and published='1' and access<='$gid'";
$database->setQuery($query);
$integrator = $database->loadResult();
} else $integrator=0;
if ($integrator && $submenu->menu_integrator!=0)
{
if(method_exists($_MAMBOTS,"loadBot")) $_MAMBOTS->loadBot('/com_sefservicemap',$component."_bot",1);
else
{
include_once "$mosConfig_absolute_path/mambots/com_sefservicemap/".$component."_bot.php";
}
$func=$component.'_bot';
if ($submenu->menu_integrator==2)
{
$pars = new mosParameters( $submenu->menu_params);
}
else
{
$query = "SELECT params from #__mambots where folder='com_sefservicemap' and element='".$component."_bot' and published='1' and access<='$gid'";
$database->setQuery($query);
$parameters = $database->loadResult();
$pars= new mosParameters ($parameters);
}
if (function_exists($func)) $func($level,$submenu->link,$Itid,$pars);
}
$lev=$level+1;
showMenu($submenu->name,$menutype,$submenu->id,$lev,$menu_images,$show_menu_icons,$icon_path);
}
}
global $database,$gid,$mosConfig_live_site;
if (!$task)
{
$query = "select name as title,ordering AS menu_ordering ,published AS menu_published, params FROM #__sef_sm_menus WHERE published='1' order by ordering";
$database->setQuery($query);
$menus=$database->LoadObjectList();
$params= smGetComponentParams();
$menu_titles=$params->get( 'menu_titles', '1' );
$show_menu_icons= intval($params->get('show_menu_icons','0'));
$icon_path = $params->get('icon_path','');
$show_module_icons = intval($params->get('show_module_icons','1'));
if ($icon_path=='') $icon_path ='/components/com_sefservicemap/images';
foreach ($menus as $menu)
{
global $menu_array;
global $counter;
$level=0;
$pars = new mosParameters($menu->params);
$title = $menu->title;
$menutype=$menu->title;
$menu_images = intval($pars->get('menu_images','0'));
if ($menu_titles)
{
$query = "SELECT * "
. "\n FROM #__modules"
. "\n WHERE module = 'mod_mainmenu'"
. "\n ORDER BY title"
;
$database->setQuery( $query );
$modMenus = $database->loadObjectList();
foreach ( $modMenus as $modMenu )
{
mosMakeHtmlSafe( $modMenu) ;
$modParams = mosParseParams( $modMenu->params );
$menuType = @$modParams->menutype;
if (!$menuType) {
$menuType = 'mainmenu';
}
if ($menuType==$menu->title) $id=$modMenu->id;
}
$database->setQuery("select * from #__modules where id='$id'");
$database->loadObject($module);
$level=1;
$menu_array[$counter]->link='';
$menu_array[$counter]->name=$module->title;
$menu_array[$counter]->level=0;
if ($show_module_icons) $menu_array[$counter]->image='menu.gif'; else $menu_array[$counter]->image='none';
$menu_array[$counter]->icon_path=$icon_path;
$menu_array[$counter]->description = '';
$counter++;
}
showMenuMap($title,$menutype,$menu_images,$show_menu_icons,$level,$icon_path);
if ($menu_titles)
{
$menu_array[$counter]->name= ' ';
$menu_array[$counter]->link='';
$menu_array[$counter]->level=10;
$menu_array[$counter]->image='none';
$menu_array[$counter]->icon_path=$icon_path;
$menu_array[$counter]->description = '';
$counter++;
}
}
$query= "select value from #__sef_sm_settings where variable='version'";
$database->setQuery($query);
$version = $database->loadResult();
if ($version) $version = ' v.'.$version;
HTML_sefservicemap::RenderMap($version);
}
?>




