<?php
include ('logue.php'); 
include ('entete2.php');
include ('ressource.php');
include ('entete.php');
echo"
<STYLE TYPE=text/css>
.Style1 {color: #0000FF}
.Style2 {color: #FF0000}
input {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
textarea {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
select, option {
background-color:#000000;
color:white;
}
</STYLE>";
echo"<div align=\"center\"><form name=\"colo\" method=\"post\" action=\"colonie.php\" target=\"_parent\">
<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
   <tr>
     <td width=\"100\" rowspan=\"2\" valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"" . $PHP_SELF . "\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
include ('colo2.php'); 

$sql2 = "SELECT ally,statut FROM matgraph_users WHERE id='$idlogin'";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2); 

$sql_options = "SELECT admin FROM matgraph_ally_statut WHERE id='$row2[statut]'";
$res_options = db_mysql_Query($sql_options)or die('erreur sql<br>'.$sql_options.'<br>'.mysql_error());
$row_options = mysql_fetch_array($res_options);

if($row2[ally] == "no") {
	echo '<script language="javascript" type="text/javascript">
	<!--
	window.location.replace("ally_index.php");
	-->
	</script>';
	exit;
}

$sql = "SELECT * FROM matgraph_ally WHERE id='$row2[ally]'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res);

if($row2[statut] !== "0" AND $row_options[admin] == "1" OR $row2[statut] == "-1") {

	echo"<div align=\"left\"><a href=\"ally_index.php\" target=\"_parent\"> Retour</a></div><br>";
	echo"<table width=\"618\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" bordercolor=\"#000000\" style=\"font-family:trebuchet ms,sans-serif; font-size: 9pt ;\">
	  <tr style =\"background-color:#222222;\">
	  <td align=\"center\" width=\"30\">Edit</td>
	    <td width=\"25\">Del</td>
	    <td align=\"center\">Nom</td>
	    <td align=\"center\">G&eacute;rer recrutement</td>
	    <td align=\"center\">Voir liste membres</td>
	    <td align=\"center\">Administrer texte </td>
	    <td align=\"center\">Voir online </td>
	    <td align=\"center\">Mail collectif </td>
	    <td align=\"center\">Admin</td>
	  </tr>";
	  
	$req = "SELECT * FROM matgraph_ally_statut WHERE idally=$row[id] ORDER BY id ASC";
	$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
	$num = mysql_num_rows($res);

	if ( $num > 0 ) {
		While ( $row = mysql_fetch_array($res) ) {  
			echo"<tr";
			// gère le quadrillage du tableau
			if (($i/2) == ceil($i/2)) {
				echo' style ="background-color:#111111;"' ;
			}
			echo">
			<form name=\"suprimer\" method=\"post\" action=\"ally_statut_edit.php\" target=\"_parent\">
			<input type=\"hidden\" name=\"id\" value=\"$row[id]\">
			<td><input type=\"image\" src=\"imgs/edit.gif\" width=\"30\" Style=\"border:0px solid #7E7E7E;\">
			</td></form>
			<form name=\"suprimer\" method=\"post\" action=\"ally_statut_del.php\" target=\"_parent\">
			<input type=\"hidden\" name=\"id\" value=\"$row[id]\">
			<td><input type=\"image\" src=\"imgs/del.gif\" width=\"25\" Style=\"border:0px solid #7E7E7E;\">
			</td></form>
			<td align=\"center\">".htmlentities($row[nom])."</td>
			<td align=\"center\">";
			
			if($row[recrutement] == "1") {
				echo"<font color=\"00CC00\">Oui</font>"; 
			} 
			else {
				echo"<font color=\"FF0000\">Non</font>";
			} 
			echo"</td>
			<td align=\"center\">";
			
			if($row[listemembres] == "1") {
				echo"<font color=\"00CC00\">Oui</font>"; 
			}
			else {
				echo"<font color=\"FF0000\">Non</font>";
			}
			echo"</td>
			<td align=\"center\">";
			
			if($row[administrer] == "1") {
				echo"<font color=\"00CC00\">Oui</font>";
			}
			else {
				echo"<font color=\"FF0000\">Non</font>";
			}
			echo"</td>
			<td align=\"center\">";
			
			if($row[online] == "1") {
				echo"<font color=\"00CC00\">Oui</font>";
			}
			else {
				echo"<font color=\"FF0000\">Non</font>";
			}
			echo"</td>
			<td align=\"center\">";
			
			if($row[mailcollectif] == "1") {
				echo"<font color=\"00CC00\">Oui</font>";
			}
			else {
				echo"<font color=\"FF0000\">Non</font>";
			}
			echo"</td>
			<td align=\"center\">";
			
			if($row[admin] == "1") {
				echo"<font color=\"00CC00\">Oui</font>";
			}
			else {
				echo"<font color=\"FF0000\">Non</font>";
			}
			echo"</td>
			</tr>"; 
		}
	}

	echo"</table>";
	echo"<br><br><form name=\"form1\" method=\"post\" action=\"ally_statut_creer.php\" target=\"_parent\">
	  <table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" bordercolor=\"#000000\" style=\"font-family:trebuchet ms,sans-serif; font-size: 9pt ;\">
	    <tr style =\"background-color:#222222;\">
	      <td>Nom du statut : </td>
	      <td><div align=\"center\">
	        <input name=\"nom\" type=\"text\" id=\"nom\">
	      </div></td>
	    </tr>
	    <tr style =\"background-color:#111111;\">
	      <td height=\"35\" colspan=\"2\"><div align=\"center\">
	        <input type=\"submit\" name=\"Submit\" value=\"cr&eacute;er\">
	      </div></td>
	    </tr>
	  </table>
	</form>";
}
else {
	echo '<script language="javascript" type="text/javascript">
	<!--
	window.location.replace("ally_index.php");
	-->
	</script>';
}
?>

