<?php

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

	$members = array();

	$sql = 'SELECT c2.category_id, c2.category_parent_id, c1.category_name_fr , c2.category_name_fr AS category_s_name_fr, c1.category_name_en , c2.category_name_en AS category_s_name_en, c2.category_bg_img, c2.category_bg_color FROM ' . CATEGORY_TABLE . ' c1 LEFT JOIN ' . CATEGORY_TABLE . ' c2 ON c2.category_parent_id = c1.category_id WHERE c2.category_id = 14';
	$result = mysql_query($sql);
	$category = mysql_fetch_assoc($result);
	mysql_free_result($result);

	$sql = 'SELECT * FROM ' . CONTENT_TABLE . ' WHERE content_id = 3';
	$result = mysql_query($sql);
	$content = mysql_fetch_assoc($result);
	mysql_free_result($result);

	$sql = 'SELECT mo.mozaic_id, me.members_id, me.members_name, me.members_job_fr, me.members_job_en, me.members_img, moc.mozaic_colors_code FROM ' . MOZAIC_TABLE . ' mo LEFT OUTER JOIN ' . MEMBERS_TABLE . ' me ON me.members_id = mo.members_id RIGHT JOIN ' . MOZAIC_COLORS_TABLE . ' moc ON moc.mozaic_colors_id = mo.mozaic_colors_id WHERE mo.category_id = 14 ORDER BY mo.mozaic_id ASC';
	$result = mysql_query($sql);
	while($row = mysql_fetch_assoc($result)) {
		$members[$row['mozaic_id']] = array(
			'members_id'			=>	$row['members_id'],
			'members_name'			=>	$row['members_name'],
			'members_job_fr'		=>	$row['members_job_fr'],
			'members_job_en'		=>	$row['members_job_en'],
			'members_img'			=>	$row['members_img'],
			'mozaic_colors_code'	=>	$row['mozaic_colors_code']
		);
	}
	mysql_free_result($result);

	foreach($members as $key => $value) {
		$template->assign_block_vars('mozaicrow', array(
			'T_M_COLOR'	=>	$value['mozaic_colors_code'],
			'V_IS_D'	=>	($value['members_id']) ? true : false,
			'U_LINK'	=>	BASE_PATH . '/membres.php?members_id=' . $value['members_id'] . '&amp;associes=' . htmlspecialchars($value['members_name']),
			'T_NAME'	=>	$value['members_name'],
			'T_IMG'		=>	$value['members_img']
		));
	}


	$template->assign_vars(array(
		'T_TEXT'			=>	$content['content_text_' . $l],
		'T_M_NAME'			=>	'',
		'T_M_JOB'			=>	'',
		'T_M_CONTACT'		=>	'',
		'T_M_INTRO'			=>	'',
		'T_M_CV'			=>	'',


		'T_NAME_PAGE'		=>	$category['category_s_name_' . $l],
		'V_C_NAME'			=>	$category['category_s_name_' . $l],
		'V_BG'				=>	true,
		'V_BG_IMG'			=>	$category['category_bg_img'],
		'V_BG_COLOR'		=>	$category['category_bg_color'],
		
	));

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

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

?>
