Your IP : 216.73.216.222


Current Path : /var/www/iplanru/data/old/www/i-plan.ru/modules/mod_mosthits/
Upload File :
Current File : /var/www/iplanru/data/old/www/i-plan.ru/modules/mod_mosthits/helper.php

<?php
defined ( '_JEXEC' ) or die ( 'Restricted access' );

class modmosthitsHelper {
	public function getArticles($mosthitsCount){
		$config = &JFactory::getConfig();
		$db = &JFactory::getDBO();
/*	$query = "SELECT title, introtext, created, id FROM #__content WHERE sectionid = 1 OR sectionid = 3 ORDER BY created DESC;";
	$db->setQuery($query);
	$result = $db->loadObjectList();
	$i=1;
	foreach ( $result as $row ){
	$date1 = substr($row->introtext,strpos($row->introtext,"Дата выхода")+33, 10);
	$query = "UPDATE #__content SET created='$date1' WHERE id='$row->id'";
	$db->setQuery($query);
	}*/
	/*	$query = "SELECT title, id, sectionid FROM #__content WHERE sectionid = 1 OR sectionid = 4 ORDER BY hits DESC;";
		$db->setQuery($query);
		$result = $db->loadObjectList();
		$i=1;
		$style="";
		echo "</div>";
		foreach ( $result as $row ) {
			if($i==1){$style=" style=\"color:#70B519; font-weight:bold; font-size:11px;\"";}
			if(($i==2)||($i==3)){$style=" style=\"color:#70B519; font-weight:bold; font-size:11px;\"";}
			if($i>3){$style=" style=\"color:#111111; font-size:11px;\"";}
			echo "<p>";
			if($row->sectionid == 1){echo "<a $style href=\"bp.php?id=$row->id\">$i. $row->title</a>\n<br>";}
			else{echo "<a $style href=\"mi.php?id=$row->id\">$i. $row->title</a>\n<br>";}
			echo "</p>";
			$i++;
			if($i > $mosthitsCount){break;}
		}
		if($config->getValue('newsystem')==1){*/
			$query = "SELECT #__articles.id as id,#__articles.title as title FROM #__articles left join #__content on  #__articles.id=#__content.id where #__articles.date>DATE_SUB(CURDATE(), INTERVAL 31 DAY) ORDER BY #__content.hits DESC;";
			$db->setQuery($query);
			$result = $db->loadObjectList();
			$i=1;
			$style="";
			echo "</div>";
			foreach ( $result as $row ) {
				if($i==1){$style=" style=\"color:#70B519; font-weight:bold; font-size:11px;\"";}
				if(($i==2)||($i==3)){$style=" style=\"color:#70B519; font-weight:bold; font-size:11px;\"";}
				if($i>3){$style=" style=\"color:#111111; font-size:11px;\"";}
				echo "<p>";
				if($row->type == "bp"){echo "<a $style href=\"bp.php?id=$row->id\">$i. $row->title</a>\n<br>";}
				else{echo "<a $style href=\"mi.php?id=$row->id\">$i. $row->title</a>\n<br>";}
				echo "</p>";
				$i++;
				if($i > $mosthitsCount){break;}
			}
		//}
	}

}
?>