Sitemap

Main Menu
//*******************************************************
//* SEF Service Map Component Integrator
//* http://www.joomprod.com
//* (C) Thomas Papin
//* 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.' );
function adsmanager_show_category($catid,$level,$Itemid,$params)
{
global $database,$my,$mosConfig_absolute_path;
$show_mode=intval($params->get( 'show_mode', '1' )) ;
$ads_limit=intval($params->get( 'ads_limit', '-1' )) ;
$show_cat_icons=intval($params->get( 'show_cat_icons', '1' )) ;
$show_cat_desc=intval($params->get( 'show_cat_desc', '1' )) ;
$show_ad_icons=intval($params->get( 'show_ad_icons', '1' )) ;
$show_ad_desc=intval($params->get( 'show_ad_desc', '1' )) ;
$lev=$level;
$lev++;
$database->setQuery( "SELECT c.id, c.name,c.parent,c.description ".
" FROM #__adsmanager_categories as c ".
"WHERE c.published = 1 ORDER BY c.parent,c.ordering");
$listcats = $database->loadObjectList();
$cats = array();
$ordercats = array();
// first pass - collect children
if(isset($listcats))
{
foreach ($listcats as $c ) {
$pt = $c->parent;
$list_temp = @$cats [$pt] ? $cats [$pt] : array();
array_push( $list_temp, $c );
$cats [$pt] = $list_temp;
$ordercats[$c->id] = $c;
}
}
if ($show_mode == 1)
{
$database->setQuery( "SELECT a.id, a.ad_headline,a.ad_text,a.category ".
" FROM #__adsmanager_ads as a ".
" LEFT JOIN #__adsmanager_categories as c ON a.category = c.id ".
" WHERE a.published = 1 AND c.published = 1".
" ORDER BY a.date_created DESC ,a.id DESC");
$listads = $database->loadObjectList();
$ads = array();
// first pass - collect children
if(isset($listads))
{
foreach ($listads as $a ) {
$pt = $a->category;
$list_temp = @$ads [$pt] ? $ads [$pt] : array();
array_push( $list_temp, $a );
$ads [$pt] = $list_temp;
}
}
}
if (isset($ordercats[$catid]))
{
$row = $ordercats[$catid];
adsmanager_recursecategories($row->id, $lev,$cats,$ads,$Itemid,$show_cat_icons,$show_cat_desc,$show_ad_icons,$show_ad_desc,$ads_limit);
if (isset($ads[$row->id]))
{
$i = 0;
foreach($ads[$row->id] as $ad)
{
$i++;
if ($i > $ads_limit)
break;
$element->name = $ad->ad_headline;
$link = "index.php?option=com_adsmanager&page=show_ad&adid=".$ad->id."&Itemid=".$Itemid;
$element->link = $link;
$element->level = $level + 1 ;
if ($show_ad_icons == 2)
{
if (($ad->id == 0)||(!file_exists($mosConfig_absolute_path."/images/com_adsmanager/ads/".$ad->id."a_t.jpg")))
{
$element->image = 'nopic.gif';
$element->icon_path='/components/com_adsmanager/images/';
}
else
{
$element->image = $ad->id.'a_t.jpg';
$element->icon_path='/images/com_adsmanager/ads/';
}
}
else if ($show_ad_icons == 1)
{
$element->image = 'adsmanager_ad.gif';
$element->icon_path='/mambots/com_sefservicemap/';
}
else
{
$element->image = 'none';
}
if ($show_ad_desc)
$element->description=$ad->ad_text;
if (function_exists ('AddExtMenuItem'))
AddExtMenuItem ($element);
else
AddMenuItem($ad->ad_headline,$link, $level+1);
}
}
}
}
function adsmanager_recursecategories($id, $level, $cats,$ads,$Itemid,$show_cat_icons,$show_cat_desc,$show_ad_icons,$show_ad_desc,$ads_limit) {
global $mosConfig_absolute_path;
if (@$cats[$id]) {
foreach ($cats[$id] as $row) {
$element->name = $row->name;
$link = "index.php?option=com_adsmanager&page=show_category&catid=".$row->id."&Itemid=".$Itemid;
$element->link = $link;
$element->level = $level;
if ($show_cat_icons == 2)
{
if (($row->id == 0)||(!file_exists($mosConfig_absolute_path.'/images/com_adsmanager/categories/'.$row->id.'cat_t.jpg')))
{
$element->image = 'default.gif';
$element->icon_path='/components/com_adsmanager/images/';
}
else
{
$element->image = $row->id.'cat_t.jpg';
$element->icon_path='/images/com_adsmanager/categories/';
}
}
else if ($show_cat_icons == 1)
{
$element->image = 'adsmanager_cat.gif';
$element->icon_path='/mambots/com_sefservicemap/';
}
else
{
$element->image = 'none';
}
if ($show_cat_desc)
$element->description=$row->description;
if (function_exists ('AddExtMenuItem'))
AddExtMenuItem ($element);
else
AddMenuItem($row->title,$link, $level);
adsmanager_recursecategories($row->id, $level + 1, $cats,$ads,$Itemid,$show_cat_icons,$show_cat_desc,$show_ad_icons,$show_ad_desc,$ads_limit);
if (isset($ads[$row->id]))
{
$i = 0;
foreach($ads[$row->id] as $ad)
{
$i++;
if ($i > $ads_limit)
break;
$element->name = $ad->ad_headline;
$link = "index.php?option=com_adsmanager&page=show_ad&adid=".$ad->id."&Itemid=".$Itemid;
$element->link = $link;
$element->level = $level + 1 ;
if ($show_ad_icons == 2)
{
if (($ad->id == 0)||(!file_exists($mosConfig_absolute_path."/images/com_adsmanager/ads/".$ad->id."a_t.jpg")))
{
$element->image = 'nopic.gif';
$element->icon_path='/components/com_adsmanager/images/';
}
else
{
$element->image = $ad->id.'a_t.jpg';
$element->icon_path='/images/com_adsmanager/ads/';
}
}
else if ($show_ad_icons == 1)
{
$element->image = 'adsmanager_ad.gif';
$element->icon_path='/mambots/com_sefservicemap/';
}
else
{
$element->image = 'none';
}
if ($show_ad_desc)
$element->description=$ad->ad_text;
if (function_exists ('AddExtMenuItem'))
AddExtMenuItem ($element);
else
AddMenuItem($ad->ad_headline,$link, $level+1);
}
}
}
}
}
function adsmanager_show_all($level,$Itemid,$params)
{
global $database,$my;
$show_mode=intval($params->get( 'show_mode', '1' )) ;
$ads_limit=intval($params->get( 'ads_limit', '-1' )) ;
$show_cat_icons=intval($params->get( 'show_cat_icons', '1' )) ;
$show_cat_desc=intval($params->get( 'show_cat_desc', '1' )) ;
$show_ad_icons=intval($params->get( 'show_ad_icons', '1' )) ;
$show_ad_desc=intval($params->get( 'show_ad_desc', '1' )) ;
$lev=$level;
$lev++;
$database->setQuery( "SELECT c.id, c.name,c.parent,c.description ".
" FROM #__adsmanager_categories as c ".
"WHERE c.published = 1 ORDER BY c.parent,c.ordering");
$listcats = $database->loadObjectList();
$cats = array();
// first pass - collect children
if(isset($listcats))
{
foreach ($listcats as $c ) {
$pt = $c->parent;
$list_temp = @$cats [$pt] ? $cats [$pt] : array();
array_push( $list_temp, $c );
$cats [$pt] = $list_temp;
}
}
if ($show_mode == 1)
{
$database->setQuery( "SELECT a.id, a.ad_headline,a.ad_text,a.category ".
" FROM #__adsmanager_ads as a ".
" LEFT JOIN #__adsmanager_categories as c ON a.category = c.id ".
" WHERE a.published = 1 AND c.published = 1".
" ORDER BY a.date_created DESC ,a.id DESC");
$listads = $database->loadObjectList();
$ads = array();
// first pass - collect children
if(isset($listads))
{
foreach ($listads as $a ) {
$pt = $a->category;
$list_temp = @$ads [$pt] ? $ads [$pt] : array();
array_push( $list_temp, $a );
$ads [$pt] = $list_temp;
}
}
}
adsmanager_recursecategories(0, $lev,$cats,$ads,$Itemid,$show_cat_icons,$show_cat_desc,$show_ad_icons,$show_ad_desc,$ads_limit);
}
function com_adsmanager_bot ($level,$link,$Itemid,$params)
{
$task = smGetParam($link,'page','show_all');
$sectionid = smGetParam($link,'sectionid','');
$catid = smGetParam($link,'catid','');
$adid = smGetParam($link,'adid','');
switch ($task)
{
case 'show_category':
adsmanager_show_category($catid,$level,$Itemid,$params);
break;
case 'show_all':
adsmanager_show_all($level,$Itemid,$params);
break;
default:
break;
}
}
?>

footer menu

Top Menu
LatestThe latest news from the Joomla! Team