<?php
	include("../M0/session_start.php") ;
?>

<?php
	include("../M0/communs_en_tete_HTML.html") ;
?>
    
<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

<table align="center" width="<?php echo $tables_width ; ?>"  border="2" cellspacing="2" cellpadding="2" bordercolor="#ffffff" bgcolor="#000033">	
	
	<?php
		include('../M0/titre_jaune.php');
		$sous_menu_titre = "-&nbsp;&nbsp;sondes AQCM05&nbsp;&nbsp;-";
		affiche_titre_jaune_simple($sous_menu_titre);
	?>
	
</table>

<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

<?php
	$return_path = "/M2/gestion_users.php" ;
	include('../M0/display_user_site_without_BAT_NIV.php'); 
?>

<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

<form name="form2" id="form2" method="post" action="">

<table align="center" width="<?php echo $tables_width ; ?>"  border="2" cellspacing="2" cellpadding="2" bordercolor="#ffffff" bgcolor="#000033">	

	<tr align="center">
		<td colspan="2">
		
			<table width="98%">
			
				<tr align="center">
					<td align="center" colspan="2">
					
						<font size="4" color="white" face="Arial, Helvetica, sans-serif">
								suppression d'un utilisateur
						</font>	
						
					</td>
				</tr>

			</table>
			
		</td>
	</tr>
			
	<tr align="center">
		<td colspan="2">
		
			<table width="98%" align="center">
			
				<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
				
				<tr>
				
					<td align="right"  width="18%" >
						<label>
							user :&nbsp;
						</label>
					</td>
					
					<td align="left">
					
						<?php

							$p_aqcm_SITE_ID = $_SESSION['SITE_ID'] ;
							include('../M0/get_users_of_1_site.php');
							
							if ( $get_users_of_one_site_erreur == 0 ) {
								
								if ( sizeof($aqcm_USER_ID) >= 1 ) {
									
									echo( '<select name="select_user_id" id="select_user_id" size="1" class="txtField_A" style="width:330px;" >' ) ;
									
									for ($i = 0; $i < sizeof($aqcm_USER_ID); $i++) {
										
										if ( $aqcm_USER_ID[$i] != $_SESSION["login"] ) {
											
											echo( '<option' ) ;
											echo( '>' ) ;
											echo( $aqcm_USER_ID[$i] ) ;
											echo( '</option>' ) ;
										
										}

									}
									echo( '</select>' ) ;
									
								}
								else {
								echo( '<label>' ) ;
								echo( 'erreur : liste des utilisateurs vide !!!' ) ;
								echo( '</label>' ) ;
								}
								
							}
							else {
								echo( '<label>' ) ;
								echo( 'erreur (' . strval( $get_users_of_one_site_erreur ) . ') !!!' ) ;
								echo( '</label>' ) ;
							}

						?>
						
					</td>
					
				</tr>
				
				<tr>
					<td colspan="2">
						<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
					</td>
				</tr>

				<tr align="left">
					
					<td align="right">
						<input id="modify_on_all_sites" name="modify_on_all_sites" type="checkbox"
						<?php if ( $_SESSION['user_type'] != "super_user" ) echo('disabled'); ?> 
						>
						&nbsp;:&nbsp;
					</td>
					<td align="left">
						<label for="modify_on_all_sites"  class="txtField_C" >
							supprimer sur tous les sites
						</label>
					</td>
					
				</tr>
				<tr>
					<td align="center" colspan="2">
						<label>
							&nbsp;
						</label>
					</td>
				</tr>
				
				<tr>
					<td align="center" colspan="2">
					
						<?php

							if ( $get_users_of_one_site_erreur == 0 ) {
								echo( '<input type="submit" onclick="my_confirm_function()" value="supprimer l\'utilisateur sélectionné" class="button_A" >' ) ;
							}
						?>
							
					</td>
				</tr>
				
			</table>
			
			<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
			
		</td>
	</tr>
	
</table>

</form>

<?php include('../M0/communs_bouton_retour_index_M2.html'); ?>

<script>

function my_confirm_function() {
	var x = document.getElementById("modify_on_all_sites");
	var msg="attention : voulez-vous vraiment détruire l'utilisateur sépectionné ?";
	var txt;
	var r = confirm(msg);
	if (r == true) {
		if (x.checked) {
			txt = "./delete_user_from_all_sites_target_execute.php";
		} else {
			txt = "./delete_user_of_one_site_target_execute.php";
		}
	} else {
		txt = "./delete_user_of_one_site_target.php";
	}
	document.getElementById("form2").action = txt;

}

</script>


 </body>
</html>