<?php

	define('IN_HUGLO', true);
	require_once('./common.php');

	$actualites = array();

	$sql = 'SELECT * FROM ' . CATEGORY_TABLE . ' WHERE category_id = 1';
	$result = mysql_query($sql);
	$category = mysql_fetch_assoc($result);
	mysql_free_result($result);

	$sql = 'SELECT * FROM ' . ACTUALITES_TABLE . ' ORDER BY actualites_datetime DESC LIMIT 10';
	$result = mysql_query($sql);
	while($row = mysql_fetch_assoc($result)) {
		$actualites[$row['actualites_id']] = array(
			'category_id'			=>	$row['category_id'],
			'actualites_datetime'	=>	$row['actualites_datetime'],
			'actualites_title_fr'	=>	$row['actualites_title_fr'],
			'actualites_title_en'	=>	$row['actualites_title_en'],
			'actualites_text_fr'	=>	$row['actualites_text_fr'],
			'actualites_text_en'	=>	$row['actualites_text_en'],
			'actualites_flv'		=>	$row['actualites_flv']
		);
	}
	mysql_free_result($result);
	
	foreach($actualites as $key => $value) {
		
		$striped_text = strip_tags( $value['actualites_text_' . $l]   ) ;
		
		$template->assign_block_vars('acturow', array(
			'U_LINK'		=>	BASE_PATH . '/actualites.php?category_id=' . $value['category_id'] . '&amp;actualites_id=' . $key,
			'T_TEXT'		=>	substr($striped_text, 0, 300),
			'T_DATE'		=>	'', //date('j', $value['actualites_datetime']) . ' ' . $lang['MONTH'][date('n', $value['actualites_datetime'])] . ' ' . date('Y', $value['actualites_datetime']),
			'T_ID'			=>	$key
		));
	}

	$template->assign_vars(array(
		'T_NAME_PAGE'		=>	$category['category_name_' . $l],
		'C_HOME'			=>	'home',

		'L_VEILLE_TITLE'	=>	$lang['VEILLE_TITLE'],
		'L_LOGIN'			=>	$lang['LOGIN'],
		'L_PASSWORD'		=>	$lang['PASSWORD'],
		'L_SEND'			=>	$lang['SEND'],
		'L_EN'				=>	$lang['EN'],
		'L_MORE_INFO'		=>	$lang['MORE_INFO']
	));

	$template->set_filenames(array('body' => 'body_index.html'));
	$template->display('body');

	unset($actualites);
	$db->sql_close();

?>
