<?



function dispPhotos() {


(isset($_GET['year_page'])) ? ($curyear = " ".$_GET['year_page']) : ($curyear = " 2006");

$str = '
	<!-- main body -->
    <div id="main_body">
    	<div id="left_side">
            <div id="newsbox">
                <h1><img alt="" src="images/puce.png" /> <strong>Photos'.$curyear.'</strong></h1>
                <ul>';
								
	$str .=dispPhotosYear();

	$str .= '
            </ul></div>
	    </div>

        <div id="right_side">
            <div class="rightbox">
                <h1><img alt="" src="images/puce.png" /> <strong>Ann&eacute;es</strong></h1>
                ';
		
	$str .= dispPhotosMenu();	

	$str .= '
            </div>
        </div>
        <div class="clr">&nbsp;</div>
    </div>
</div>';


echo $str;
}


function dispPhotosMenu(){
$str = '';
$str .= '
	<ul>
		<li><a href="index.php?section=Photos&year_page=2006" class="texte_link">2006</a></li>
		<li><a href="index.php?section=Photos&year_page=2005" class="texte_link">2005</a></li>
		<li><a href="index.php?section=Photos&year_page=2004" class="texte_link">2004</a></li>
		<li><a href="index.php?section=Photos&year_page=2003" class="texte_link">2003</a></li>
		<li><a href="index.php?section=Photos&year_page=2002" class="texte_link">2002</a></li>
		<li><a href="index.php?section=Photos&year_page=2001" class="texte_link">avant</a></li>
	</ul>
	';

	return ($str);
}


function dispPhotosYear(){

	if ($_GET['year_page']) {
		$year_page = $_GET['year_page'];
	}
	else
	{
		$year_page = 2006;
	}	

	if ($_SESSION["user_right"] >= $GLOBALS["PRIV_GUEST"] ) {	
		$result_prod = getPhotosByYearAndTypeAndTendu($year_page, "eptvprod", 2);
		$result_bonus = getPhotosByYearAndTypeAndTendu($year_page, "eptvbonus", 2);
		$result_adm = getPhotosByYearAndTypeAndTendu($year_page, "eptv.adm", 2);
	}
	else if ($_SESSION["user_right"] >= $GLOBALS["GUEST"] ) {	
		$result_prod = getPhotosByYearAndTypeAndTendu($year_page, "eptvprod", 1);
		$result_bonus = getPhotosByYearAndTypeAndTendu($year_page, "eptvbonus", 1);
		$result_adm = getPhotosByYearAndTypeAndTendu($year_page, "eptv.adm", 1);
	}
	else {
		$result_prod = getPhotosByYearAndTypeAndTendu($year_page, "eptvprod", 0);
		$result_bonus = getPhotosByYearAndTypeAndTendu($year_page, "eptvbonus", 0);
		$result_adm = getPhotosByYearAndTypeAndTendu($year_page, "eptv.adm", 0);
	}
	

	if (mysql_num_rows($result_prod)) {
		$str .= dispPhotosByType($result_prod, "&nbsp;e p t v &nbsp; p r o d u c t i o n");	
	}
	
	if (mysql_num_rows($result_bonus)) {
		$str .= dispPhotosByType($result_bonus, "&nbsp;e p t v &nbsp b o n u s");
	}

	if (mysql_num_rows($result_adm)) {
		$str .= dispPhotosByType($result_adm, "&nbsp;e p t v . a d m");
	}


return ($str);
}


function dispPhotosByType($result, $photo_type) {
 
	$str = '		
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#111111">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr>
			<td>
				<b>
				<font color="#666666">
				'.$photo_type.'
				</font>
				</b> 
			</td>
			</tr>
						
			<tr>
			<td bgcolor="#282828">
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">

		';

		while ($photo = mysql_fetch_array($result)) {
 
			$str .= dispWhenTendu($photo["photo_tendu"]);

			$str .= '&nbsp;<a href="http://www.eptv.fr/index.php?section=PhotosShow&action=
					'.$photo["photo_path"].'
					" class="texte_link" ';
					
			if ($photo["photo_comment"]) {
			$str .= '	ONMOUSEOVER="popup(\'<font>'.$photo["photo_comment"].'</font>\', \'lightgray\')" ONMOUSEOUT="removeBox()"';
			}			
			$str .= '>
					'.$photo["photo_name"].'
					</a>
				</TD>
				<TD>
					'.$photo["photo_date"].'
				</TD>
				<TD align=center><strong>
					'.$photo["photo_size"].' Img</strong>
				</TD>
			</TR>';
		}

$str .= '
					</table>
					</td>
					</tr>
				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		<br>
	';

	return ($str);

}

?>
