File: /home/centralexf/www/modules/mod_scroll_ads/mod_scroll_ads_for_adsmanager.php
<?php
/**
* @version 1.5.3 09.10.2011
* @package JooTools - Scroll Ads 4 AdsManager
* @copyright Copyright (C) 2010 StefySoft.com. All rights reserved.
* @license GNU/GPL, http://www.gnu.org/copyleft/gpl.html
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Reorder date
function reorderDates( $date ){
return JHTML::_('date', $date, '%m-%d-%y');
}
// Get variabiles
$itemid = intval($params->get( 'default_itemid', JRequest::getVar('Itemid', '0', 'get') ));
$nb_ads = intval($params->get( 'nb_ads', 1 ));
$sort_sql = intval($params->get( 'random',1));
$speed = intval($params->get('speed', '1'));
$direction = $params->get('direction', '1');
$nrder = intval($params->get('nrder', '1'));
$scramount = intval($params->get('scramount', '1'));
$title = $params->get('title', '1');
$lng = intval($params->get('lng', '1'));
$lng1 = intval($params->get('lng1', '1'));
$curr = $params->get('curr', '1'); //Set Def currency
$titlealgn = intval($params->get('titlealgn', '1'));
$fntsize1 = $params->get('fntsize1', '1'); //title
$fntcolor1 = $params->get('fntcolor1', '1'); //title
$fntsize2 = $params->get('fntsize2', '1'); //price
$fntcolor2 = $params->get('fntcolor2', '1'); //price
$fntsize3 = $params->get('fntsize3', '1'); //ads title
$fntcolor3 = $params->get('fntcolor3', '1'); //ads title
$fntsize4 = $params->get('fntsize4', '1'); //category
$fntcolor4 = $params->get('fntcolor4', '1'); //category
$fntsize5 = $params->get('fntsize5', '1'); //stars
$fntcolor5 = $params->get('fntcolor5', '1'); //stars
$fntsize6 = $params->get('fntsize6', '1'); //date
$fntcolor6 = $params->get('fntcolor6', '1'); //date
$fntsize7 = $params->get('fntsize7', '1'); //desc
$fntcolor7 = $params->get('fntcolor7', '1'); //desc
$fntsize8 = $params->get('fntsize8', '1'); //city
$fntcolor8 = $params->get('fntcolor8', '1'); //city
$useprice = $params->get('useprice', '1'); //
$fiprice = $params->get('fiprice', '1'); //
$usecity = $params->get('usecity', '1'); //
$ficity = $params->get('ficity', '1'); //
$usecat = $params->get('usecat', '1'); //
$usedate = $params->get('usedate', '1'); //
$usedesc = $params->get('usedesc', '1'); //
$fidesc = $params->get('fidesc', '1'); //
$desclng = intval($params->get('desclng', '1')); //
//Setting global vars
global $mainframe;
//Setting displayed ads
switch($sort_sql)
{
// Popular
case 2:
$order_sql = "ORDER BY a.views DESC,a.date_created DESC ,a.id DESC ";
break;
// Random
case 1:
$order_sql = "ORDER BY RAND() ";
break;
// Latest
case 0:
default:
$order_sql = "ORDER BY a.date_created DESC ,a.id DESC ";
break;
}
//root url
$uri =& JURI::getInstance();
$mosConfig_live_site = $uri->root();
//Init db
$database =& JFactory::getDBO();
//Prepare query
$database->setQuery("SELECT a.$fiprice, a.$ficity, a.$fidesc, a.id, a.ad_headline, b.catid AS category, a.date_created,p.id as parentid,p.name as parent,c.id as catid, c.name as cat ".
"FROM #__adsmanager_ads as a ".
"LEFT JOIN #__adsmanager_adcat AS b ON a.id = b.adid ".
"LEFT JOIN #__adsmanager_categories as c ON b.catid = c.id ".
"LEFT JOIN #__adsmanager_categories as p ON c.parent = p.id ".
"WHERE c.published = 1 and a.published = 1 $order_sql LIMIT 0, $nb_ads");
$ads = $database->loadObjectList();
if (count($ads) > 0)
{
echo "<table align='center' width='".$lng."' height='2'>";
echo "<tr>";
if ($titlealgn == 0) {
echo "<td align='center' valign='middle'>";
echo "<font size='".$fntsize1."' color='".$fntcolor1."'>"
."<b>".$title." </b> </font></td>"; }
echo "<td valign='middle'><marquee style='width:".$lng1."px;' scrolldelay='".$speed."' loop='".$nrder."' behavior='SCROLL' title='".$title."' direction='".$direction."' onmouseover='this.stop();' onmouseout='this.start();' scrollamount='".$scramount."'>";
echo "<font size='".$fntsize5."' color='".$fntcolor5."'><b>*** </b></font>";
if(isset($ads[0])) {
foreach($ads as $row) {
$linkTarget = JRoute::_("/index.php?option=com_adsmanager&view=details&id=".$row->id."&Itemid=".$itemid);
$localitate = $row->$ficity;
echo "<a href='$linkTarget' title='".stripslashes($row->ad_headline)."'><font size='".$fntsize3."' color='".$fntcolor3."'><strong>".stripslashes($row->ad_headline)."</strong> </font></a>";
if ($usecat == 0)
echo "<font size='".$fntsize4."' color='".$fntcolor4."'>(".$row->parent." / ".$row->cat.")</font>";
if ($usedate == 0)
echo "<font size='".$fntsize6."' color='".$fntcolor6."'> ".reorderDates($row->date_created)."</font>";
if ($usedesc == 0)
{
$texta = $row->$fidesc;
if(strlen($texta) > $desclng)
{
$descr = (substr($texta, 0, $desclng))."...";
}
else
{
$descr = $texta;
}
echo "<font size='".$fntsize7."' color='".$fntcolor7."'><b> ".$descr."</b></font>";
}
if ($usecity == 0)
echo "<font size='".$fntsize8."' color='".$fntcolor8."'><b> ".$row->$ficity."</b></font>";
if ($useprice == 0)
{
$prices = $row->$fiprice;
echo "<font size='".$fntsize2."' color='".$fntcolor2."'><b> ".$prices.".-".$curr."</b></font>";
}
echo "<font size='".$fntsize5."' color='".$fntcolor5."'><b> *** </b></font>";
} }
echo "</marquee></td>";
if ($titlealgn == 1) {
echo "<td align='center' valign='middle'>";
echo "<font size='".$fntsize1."' color='".$fntcolor1."'>"
."<b>".$title." </b> </font></td>"; }
echo"</tr></table>";
}
else echo 'No Ads!'
?>