<?php 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// HamLogWeb
//
// Par F5AGL - GRIP 2008
//
// Email : f5agl@zapgillou.fr
//
// Cette création est mise à disposition selon le Contrat Paternité-Pas d'Utilisation Commerciale-Pas de Modification 2.0 France 
// disponible en ligne http://creativecommons.org/licenses/by-nc-nd/2.0/fr/ 
// ou par courrier postal à Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
// 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Fichier : diplomes.php 
//
// Description : Affichage page des diplomes
//
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


// Connexion au serveur MySQL
$link = @mysql_connect($db_host,$db_login,$db_psw) or AfficherErreur(1,"[qslcards.php] - Impossible de se connecter au serveur MySQL : " . mysql_error());

// Connexion à la base MySQL
$db_selected = mysql_select_db($db_base, $link); if (!$db_selected) { AfficherErreur(1,"[qslcards.php] - Impossible de sélectionner la base de données : " . mysql_error()); }

// Liste des bandes
$HFBandes = array( 		1  => "MIXED",
				2  => "160M",
				3  => "80M",
				4  => "40M",
				5  => "30M",
				6  => "20M",
				7  => "17M",
				8  => "15M",
				9  => "12M",
				10 => "10M",
				11 => "6M",
				12 => "2M"
			);

$HFBandesVar = array( 		1  => "DXCC_BAND_MIXED",
				2  => "DXCC_BAND_160M",
				3  => "DXCC_BAND_80M",
				4  => "DXCC_BAND_40M",
				5  => "DXCC_BAND_30M",
				6  => "DXCC_BAND_20M",
				7  => "DXCC_BAND_17M",
				8  => "DXCC_BAND_15M",
				9  => "DXCC_BAND_12M",
				10 => "DXCC_BAND_10M",
				11 => "DXCC_BAND_6M",
				12 => "DXCC_BAND_2M"
			);

$HFModes = array(		1  => "ALL",
				2  => "PHONE",
				3  => "CW",
				4  => "RTTY"
			);

$HFModesVar = array( 		1  => "DXCC_MODE_ALL",
				2  => "DXCC_MODE_PHONIE",
				3  => "DXCC_MODE_CW",
				4  => "DXCC_MODE_RTTY"
			);



// on récupère le filtre éventuel
$Filtre_DXCC  = $_POST["Filtre_DXCC"];
$i=1;
while ($i<109)
	{
	${$HFBol[$i]} = $_POST[$HFBol[$i]];
	$i=$i+1;
	}


?>
<br>
<table style="width: 95%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<div style="text-align: center;"><img style="width: 250px;" alt="" src="./img/dxcccert.jpg"></div></table>
<br>
<form method="post" action="index.php?langue=<?php echo $langue; ?>&contenu=diplomes.php">
<div style="text-align: center;"><select name="Filtre_DXCC" WIDTH="35%" STYLE="width: 35%">
<?php
if ($Filtre_DXCC=="")
	{
	?><option selected=\"selected\" value=""><?php echo $lg_diplomes_selectdxcc; ?></option><?php
	$Filtre_Bande="";
	$Filtre_Mode="";
	}
else
	{
	?><option value=""><?php echo $lg_diplomes_selectdxcc; ?></option><?php
	}
	
$num=1;
$i=1;

while ($i<13)
	{
	if (${$HFBandesVar[$i]}=="true") 
		{
		$j=1;
		while ($j<5)
			{
			if (${$HFModesVar[$j]}=="true") 
				{
				if ($num==$Filtre_DXCC)
					{
					?><option selected=\"selected\" value="<?php echo $num; ?>"><?php echo "DXCC ".$HFBandes[$i]." ".$HFModes[$j]; ?></option><?php
					$Filtre_Bande=$i;
					$Filtre_Mode=$j;
					}
				else
					{
					?><option value="<?php echo $num; ?>"><?php echo "DXCC ".$HFBandes[$i]." ".$HFModes[$j]; ?></option><?php
					}
				$num=$num+1;
				}
			$j=$j+1;
			}
		}
	$i=$i+1;
	}


?>
</select><small><small><small><small>&nbsp;&nbsp;</small></small></small></small>
<input src="img/go.png" name="ok" title="<?php echo $lg_Filtrage_InfobulleShow; ?>" type="image" width="30"><br><small><small><small>&nbsp; &nbsp;</small></small></small></div>
<br>

<?php

// RESTITUTION

if (!($Filtre_Bande==""))
{

?>

<div align="center">
<table style="width: 60%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="1">
<tbody>
<tr>
<td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_Bandeau_Fond; ?>; width: 55%;">DXCC</td>
<?php
if ($DXCC_SHOW_NOTCONTACTED=="true")
	{ ?> <td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_Bandeau_Fond; ?>; width: 15%;"><?php echo $lg_notworked; ?></td> <?php } ?>
<td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_Bandeau_Fond; ?>; width: 15%;"><?php echo $lg_worked; ?></td>
<td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_Bandeau_Fond; ?>; width: 15%;"><?php echo $lg_confirmed; ?></td>
</tr>

<?php
$alternat_couleur=0;
$nbnotcontacted=0;
$nbcontacted=0;
$nbconfirmed=0;
$sql = 'SELECT `NUM` , `ALL` , `160M` , `80M` , `40M` , `30M` , `20M` , `17M` , `15M` , `12M` , `10M` , `6M` , `2M`, `UK` FROM `'.$db_table.'_DXCC` ORDER BY `UK` ASC ';	
$result = @mysql_query($sql); if (!$result) { AfficherErreur(1,"[admin.php] - Problème d'accès à la table ".$db_table."_DXCC  - Message système MySQL : " . mysql_error());  }
while ($ligne=@mysql_fetch_row($result))
		{
		// Faut-il afficher ce DXCC ?
		$car1=substr($ligne[$Filtre_Bande],0,1);
		$car2=substr($ligne[$Filtre_Bande],1,1);
		$car3=substr($ligne[$Filtre_Bande],2,1);
		$car4=substr($ligne[$Filtre_Bande],3,1);
		if (($DXCC_SHOW_NOTCONTACTED=="true") or
		    (($Filtre_Mode==1) and (($car1=="W") or ($car1=="C"))) or
		    (($Filtre_Mode==2) and (($car2=="W") or ($car2=="C"))) or
		    (($Filtre_Mode==3) and (($car3=="W") or ($car3=="C"))) or
		    (($Filtre_Mode==4) and (($car4=="W") or ($car4=="C"))))
			{
			if (($Filtre_Mode==1) and ($car1=="-")) { $car="-"; }
			if (($Filtre_Mode==1) and ($car1=="W")) { $car="W"; }
			if (($Filtre_Mode==1) and ($car1=="C")) { $car="C"; }
			if (($Filtre_Mode==2) and ($car2=="-")) { $car="-"; }
			if (($Filtre_Mode==2) and ($car2=="W")) { $car="W"; }
			if (($Filtre_Mode==2) and ($car2=="C")) { $car="C"; }
			if (($Filtre_Mode==3) and ($car3=="-")) { $car="-"; }
			if (($Filtre_Mode==3) and ($car3=="W")) { $car="W"; }
			if (($Filtre_Mode==3) and ($car3=="C")) { $car="C"; }
			if (($Filtre_Mode==4) and ($car4=="-")) { $car="-"; }
			if (($Filtre_Mode==4) and ($car4=="W")) { $car="W"; }
			if (($Filtre_Mode==4) and ($car4=="C")) { $car="C"; }



			// sélection de la couleur de la ligne et gestion de l'alternat de couleur
			if ($alternat_couleur==0) { $rgb=$Coul_Log_Alternat0; $alternat_couleur=1; }
					else	  { $rgb=$Coul_Log_Alternat1; $alternat_couleur=0; }

			?>
		
      			<tr>
        		<td colspan="1" rowspan="1" style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 372px;"><font size="-1"><?php echo $ligne[13]; ?></font></td>

			<?php

			if ($Filtre_Bande==1) { $FFB=""; } else { $FFB=$HFBandes[$Filtre_Bande]; }

			if ($DXCC_SHOW_NOTCONTACTED=="true")
				{ 
				if ($car=="-")
					{ ?> <td style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 200px;"><font size="-1"><img style="width: 14px; height: 14px;" alt="" src="./img/NOTWORKED.GIF"></font></td> <?php 
					$nbnotcontacted=$nbnotcontacted+1;
					}
				else
					{ ?> <td style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 200px;"><font size="-1"></font></td> <?php }
				}
			if (($car=="W") or ($car=="C"))
					{ ?> <td style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 200px;"><font size="-1"><a href="./index.php?PageNumero=0&langue=<?php echo $langue; ?>&contenu=logbook.php&QSL=&FL=<?php echo $logbook_principal; ?>&FC=&FB=<?php echo $FFB; ?>&FM=&FD=<?php echo $ligne[0]; ?>&FQ="><img style="border: 0px solid ; width: 14px; height: 14px;" alt="" src="./img/WORKED.GIF"></a></font></td> <?php 
					$nbcontacted=$nbcontacted+1;
					}
				else
					{ ?> <td style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 200px;"><font size="-1"><?php echo $car1; ?></font></td> <?php }
			if ($car=="C")
					{ ?> <td style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 200px;"><font size="-1"><a href="./index.php?PageNumero=0&langue=<?php echo $langue; ?>&contenu=logbook.php&QSL=Y&FL=<?php echo $logbook_principal; ?>&FC=&FB=<?php echo $FFB; ?>&FM=&FD=<?php echo $ligne[0]; ?>&FQ="><img style="border: 0px solid ; width: 14px; height: 14px;" alt="" src="./img/CONFIRMED.GIF"></a></font></td> <?php 
					$nbconfirmed=$nbconfirmed+1;
					}
				else
					{ ?> <td style="font-family: Arial; font-weight: bold; text-align: center; background-color: <?php echo $rgb; ?>; width: 200px;"><font size="-1"></font></td> <?php }
        		?>
      			</tr>
			<?php

			}
		}

?>
	
<tr>
<td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_BandeauMois_Fond; ?>; color: <?php echo $Coul_Log_BandeauMois_Texte; ?>; width: 55%;"><?php echo $lg_totaux; ?></td>
<?php
if ($DXCC_SHOW_NOTCONTACTED=="true")
	{ ?> <td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_BandeauMois_Fond; ?>; color: <?php echo $Coul_Log_BandeauMois_Texte; ?>; width: 15%;"><?php echo $nbnotcontacted; ?></td> <?php } ?>			
<td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_BandeauMois_Fond; ?>; color: <?php echo $Coul_Log_BandeauMois_Texte; ?>; width: 15%;"><?php echo $nbcontacted; ?></td>
<td style="font-weight: bold; text-align: center; font-family: Arial; background-color: <?php echo $Coul_Log_BandeauMois_Fond; ?>; color: <?php echo $Coul_Log_BandeauMois_Texte; ?>; width: 15%;"><?php echo $nbconfirmed; ?></td>
</tr>
</tbody>
</table>
</div>

<BR>
	
<?php 

}

// fermeture session sur le serveur MySQL
@mysql_close($link);



