<?php
/*				Programme : consult_detail_interprete.php
				Description : Affiche le détail des informations d'un interprète sélectionné
								ainsi que la liste de oeuvres interprètées
*/
?>
<html>
<head>
<title>Consultation détaillée d'un interprète</title>
</head>
<body background="../images/fondnotes.jpg">
<?php
$id_interprete=$_GET['id_interprete'];
require "codbfile";
require "../admin/fonctions";
parametres_generaux();
//On récupère les informations du interprète
$sql="select * from interprete
where id_interprete=$id_interprete";


$result=mysql_query($sql)
		or die ("Impossible de charger les informations concernant l'interprète.");
$ligne=mysql_fetch_array($result);
extract($ligne);

//On charge la liste des catégories de l'interprète
$sql="select cat.nom_categorie_interprete
		from categorie_interprete cat, corresp_interprete_categorie c
		where cat.id_categorie_interprete=c.id_categorie_interprete
		and c.id_interprete=$id_interprete
		order by cat.nom_categorie_interprete";

$result_categorie=mysql_query($sql) or die ("Impossible de charger la liste des catégories de l'interprète.");


echo "
<div align='center'>
<h1>$nom_interprete $prenom_interprete</h1>
</div>
<hr>\n
<table width='90%' align='center' bgcolor='#EEF6FF'>
<tr><td valign='top'>Nom : $nom_interprete<br>\n
						Prénom : $prenom_interprete<p>\n";
	//On affiche la liste des catégories de l'interprète
	$nb_ligne=mysql_num_rows($result_categorie);
	if ($nb_ligne==0)
	{
		echo "Il n'y a pas de catégorie rattachée à cet interprète";
	}
	else
	{
		for ($i=1;$ligne=mysql_fetch_array($result_categorie);$i++)
		{
			extract($ligne);
			echo "$nom_categorie_interprete";
			if ($i<>$nb_ligne) {echo ",&nbsp;";}
			if ($i==3) {echo "<br>";}
		}
		echo "<br>";
	}
						if ($nationalite_interprete<>"") {echo "$nationalite_interprete<br>\n";}
						if ($date_mort_interprete<>0 or $date_naissance_interprete<>0)
						{
							echo "(";
							if ($date_naissance_interprete==0)
							{
								echo " ";
							}
							else
							{
								echo "$date_naissance_interprete";
							}
							echo " - ";
							if ($date_mort_interprete==0)
							{
								echo " ";
							}
							else
							{
								echo "$date_mort_interprete";
							}
							echo ")<br>\n";
						}
						$commentaire_interprete=nl2br($commentaire_interprete); //Permet de garder la mise en page des paragaphes
						echo "
						</td>
						<td align='center' valign='center'><a href='$path_photo_interprete$photo_interprete' target='_blank'>
						<img src='$path_photo_interprete$photo_interprete' width='100'
						 height='137' border='0'></a></td></tr>
						 <tr><td colspan='2'>Commentaire :</td></tr>
						 <tr><td colspan='2'>$commentaire_interprete</td></tr></table>\n

<table width='90%' align='center' cellspacing='0'><tr><td colspan='5' align='left'><b><font size='+1'><u>Liste des interprétations de $nom_interprete $prenom_interprete</u></font></b></td></tr>\n
<tr align='center' bgcolor='#328FC9'><td><font color='#FFFFFF'>Compositeur</font></td><td><font color='#FFFFFF'>Type d'oeuvre</font></td><td><font color='#FFFFFF'>Oeuvre</font></td><td><font color='#FFFFFF'>Classification</font></td><td><font color='#FFFFFF'>Photo</font></td></tr>";

//On charge la liste des interprétations
$sql="select distinct c.id_compositeur, c.nom_compositeur, c.prenom_compositeur, t.nom_type_oeuvre, o.id_oeuvre, o.nom_oeuvre, o.classification_oeuvre,
	cd.photo_cd, cd.id_cd, 0 as detail
	from compositeur c, type_oeuvre t, oeuvre o, cd, corresp_cd_oeuvre cco, corresp_cd_oeuvre_interprete ccoi
	where o.id_compositeur=c.id_compositeur
	and o.id_type_oeuvre=t.id_type_oeuvre
	and cd.id_cd=cco.id_cd
	and cco.id_oeuvre=o.id_oeuvre
	and ccoi.id_corresp_cd_oeuvre=cco.id_corresp_cd_oeuvre
	and ccoi.id_interprete=$id_interprete


	union

	select distinct c.id_compositeur,c.nom_compositeur, c.prenom_compositeur, t.nom_type_oeuvre, o.id_oeuvre,o.nom_oeuvre, o.classification_oeuvre,
	cd.photo_cd, cd.id_cd, 1 as detail
	from compositeur c, type_oeuvre t, oeuvre o, cd, corresp_cd_oeuvre cco, corresp_cd_oeuvre_detail_interprete ccodi
	where o.id_compositeur=c.id_compositeur
	and o.id_type_oeuvre=t.id_type_oeuvre
	and cd.id_cd=cco.id_cd
	and cco.id_oeuvre=o.id_oeuvre
	and ccodi.id_corresp_cd_oeuvre=cco.id_corresp_cd_oeuvre
	and ccodi.id_interprete=$id_interprete
	order by nom_compositeur, prenom_compositeur, nom_type_oeuvre, classification_oeuvre";


$result=mysql_query($sql)
		or die ("Impossible de charger la liste des interprétations.");


$bgcolor=$bgcolor_impaire;

$nb_ligne=mysql_num_rows($result);
if ($nb_ligne==0) { echo "<tr><td colspan='5'>Il n'y a aucune interprétation enregistrée pour cet interprète.</td></tr>"; exit;}
while ($ligne=mysql_fetch_array($result))
{
	if ($bgcolor == $bgcolor_impaire)
	{$bgcolor=$bgcolor_paire;} else { $bgcolor=$bgcolor_impaire; }

	extract ($ligne);
	echo "
	<tr bgcolor='$bgcolor'>
	<td><a href='consult_detail_compositeur.php?id_compositeur=$id_compositeur' target='_blank'>$nom_compositeur $prenom_compositeur</a></td>
	<td>$nom_type_oeuvre</td>
	<td><b>
	<a href='consult_detail_oeuvre.php?id_oeuvre=$id_oeuvre'>$nom_oeuvre</b></a>"; if ($detail==1) {echo "<i>(détail)</i>";} echo "</td>
	<td>$classification_oeuvre</td>
	<td align='center' valign='center'>";
	if ($photo_cd<>'')
	{echo"<a href='consult_detail_cd.php?id_cd=$id_cd'><img src='$path_photo_cd$photo_cd' border='0' height='30' width='30'></a>";}echo "</td></tr>";
}


echo "
</table></font>\n";





?>
</body>
</html>
