<?php
// $Id: mod_archive.php,v 1.9 2004/04/07 11:56:03 rcastley Exp $
/**
* Archive Module
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.9 $
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $mosConfig_offset;

$count = @$params->count ? intval( $params->count ) : 10;

$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 );

$query = "SELECT MONTH(created) AS created_month, created, id, sectionid, title, YEAR(created) AS created_year FROM #__content"
. "\nWHERE (state='-1' AND checked_out='0' AND sectionid > '0')"
. "\nGROUP BY created_year DESC, created_month DESC LIMIT $count";
$database->setQuery( $query );
$rows = $database->loadObjectList();

?>
<table cellpadding="1" cellspacing="1" border="0">
<?php foreach ($rows as $row) {
	$arrDateTime = explode(" ", $row->created);
	$arrDate = explode("-", $arrDateTime[0]);
	$arrTime = explode(":", $arrDateTime[1]);
	$created_month = strftime ("%m", mktime ($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]) + $mosConfig_offset*60*60);
	$month_name = strftime ("%B", mktime ($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]) + $mosConfig_offset*60*60);
	$created_year = strftime ("%Y", mktime ($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]) + $mosConfig_offset*60*60);
?>
	<tr>
	  <td valign="top"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/arrow.png" alt="" /></td>
	  <td><a href="index.php?option=content&task=archivecategory&year=<?php echo $created_year;?>&month=<?php echo $created_month;?>"><?php echo $month_name;?>, <?php echo $created_year;?></a></td>
	</tr>
<?php
}
?>
</table>
