<?php

function dispTableMembers($tab) {
  $cpt = 0;
  $str = "";
  $width = ($_SESSION["user_right"] >= $GLOBALS["EPISUB"]) ? "25%" : "33%";
  while ($tab[$cpt]) {
    $result = getOneUserByID($tab[$cpt]);
    $member = mysql_fetch_array($result);
    $str .= "<tr><td width='$width'><b>".$member["user_pseudo"]."</b></td><td width='$width'>(".$member["user_login"].")</td>";
    if ($member["user_statut"] == "0")
      $str .= "<td width='$width'>Nouveau</td>";
    else
      $str .= "<td width='$width'>".$member["user_statut"]."</td>";
    if ($_SESSION["user_right"] >= $GLOBALS["EPISUB"])
      $str .= "<td width='$width'><i>".$member["user_tel"]."</i></td>";
    $cpt++;
  }
  return $str;
  }

function dispMembers() {

  $str = '
<!-- main body -->
<div id="main_body">
	<div id="left_side">
		<div id="newsbox">
			<h1><img alt="" src="images/puce.png" /> <strong>Membres</strong></h1>
			<ul>
';
  /****************/
  /* Print bureau */
  /****************/

  $str .= dispTableBegin("B u r e a u", "100", 1);
 
  $cpt = 0;
  // President
  $result = getUsersByStatut("President");
  while ($member = mysql_fetch_array($result))
      $tab[$cpt++] = $member["user_id"];

  // Secretaire
  $result = getUsersByStatut("Secretaire");
  while ($member = mysql_fetch_array($result))
      $tab[$cpt++] = $member["user_id"];

  // Tresorier
  $result = getUsersByStatut("Tresorier");
  while ($member = mysql_fetch_array($result))
      $tab[$cpt++] = $member["user_id"];

  $str .= dispTableMembers($tab);	
  $str .= dispTableEnd();	

  /****************/
  /* Print Staff */
  /****************/

  $cpt = 0;
  $tab = Array();
  $str .= dispTableBegin("S t a f f", "100", 1);

  $result = getUsersByStatut("Membre");
  while ($member = mysql_fetch_array($result))
      $tab[$cpt++] = $member["user_id"];

  $str .= dispTableMembers($tab);	
  $str .= dispTableEnd();	


  /*****************/
  /* Print Anciens */
  /*****************/

  $cpt = 0;
  $tab = Array();
  $str .= dispTableBegin("A n c i e n s", "100", 1);

  $result = getUsersByStatut("Ancien");
  while ($member = mysql_fetch_array($result))
      $tab[$cpt++] = $member["user_id"];

  $str .= dispTableMembers($tab);	
  $str .= dispTableEnd();	

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

  $str .= '
				<div id="right_side">
					<div class="rightbox">
						<h1><img alt="" src="images/puce.png" /> <strong>L&acute;association</strong></h1>
						<ul>
							<li><p>Si vous voulez participer a la vie associative et que vous aimez le montage n&acute;hesitez pas a nous contacter</p></li>
						</ul>
					  </div>
   				</div>
				  
        		<div class="clr">&nbsp;</div>
		    </div>';
			
			

		echo $str;
}


?>