[ Index ]

PHP Cross Reference of IEUF

title

Body

[close]

/gestion/ -> ateliers.php (source)

   1  <?php
   2  //Vérification accès
   3  require  'inc/autorisation.inc.php';
   4  if (NonCA() && !Animateur() && !ParentDAdherent () && !Participe ()) include  'inc/404.php';
   5  $where="";
   6  if (NonCA() && !Animateur()) {
   7  if (isset($_SESSION['ateliers']) && Participe ()) {
   8      foreach($_SESSION['ateliers'] as $k=>$val)
   9        $where.="'".substr($k,1)."', ";
  10      }
  11    if (isset($_SESSION['at_enfant']) && ParentDAdherent ()) {
  12      foreach($_SESSION['at_enfant'] as $k=>$val)
  13        $where.="'".substr($k,1)."', ";
  14    }
  15    if ($where !=  "") $where ="AND id in (".rtrim($where,', ').")";
  16  }
  17  $tab_jour_semaine=array("Dimanche", "Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
  18  ?>
  19  
  20  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  21  "http://www.w3.org/TR/html4/loose.dtd">
  22  <html>
  23    <head>
  24      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
  25      <meta http-equiv="Pragma" content="no-cache">
  26      <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  27      <meta http-equiv="expires" content="0">
  28      <title>
  29        Ateliers
  30      </title>
  31      <style type="text/css">
  32  body {
  33      font-family: Arial,Helvetica,sans-serif;
  34      font-size: 10pt;
  35      }
  36      .parametres {
  37      width: 200px;
  38      height: 500px;
  39      position: fixed;
  40      min-height: 500px;
  41      background-color: #666666;
  42      color: white;
  43      }
  44      .tableau {
  45      margin-left: 205px;
  46      }
  47      .lien {
  48      color : blue;
  49      cursor: pointer;
  50      border-color: black;
  51      }
  52      .lien:hover {
  53      background-color: #DEE9FF;
  54      }
  55      #lst_rec {
  56      position: relative;
  57      background-color: #cccccc;
  58      color: black;
  59      font-style: italic;
  60      height: 100pt;
  61      max-height: 100pt;
  62      overflow: auto;
  63      }
  64  
  65      </style>
  66      <script language="JavaScript" type="text/JavaScript">
  67  <!--
  68      tab_pers = new Array();
  69      <?php
  70      include  "../inclus/connect_bd.inc.php";
  71  
  72      $liste_choix=array();
  73      $requete="SELECT DATE_FORMAT(date_deb,'%Y%m') as date_deb_session, DATE_FORMAT(date_deb,'%m') as date_mois, DATE_FORMAT(date_deb,'%Y') as date_an
  74                FROM atelier GROUP BY date_deb_session ORDER BY date_deb_session";
  75      $recherche=mysql_query($requete);
  76      if ($recherche === false) die( mysql_error());  
  77      while ($col= mysql_fetch_assoc($recherche)) {
  78        extract($col);
  79        if ($date_mois > 8) $date_an++;
  80        $liste_choix[$date_an]= "";
  81        $ind_selection= $date_an;
  82      }
  83     
  84      if (isset ($_POST['choix']))
  85        $ind_selection= $_POST['choix'];
  86      ?>
  87  
  88      function Ouvrefiche(id) {
  89          open("f_atelier.php?id="+id,"_blank","width=1000,height=700,left=320,top=0,resizable=yes,scrollbars=yes").focus();
  90      }
  91      function Liste_participants(id) {
  92          open("l_participants.php?id="+id,"_blank","width=1000,height=700,left=320,top=0,resizable=yes,scrollbars=yes").focus();
  93      }
  94      //-->
  95      </script>
  96    </head>
  97    <body>
  98      <?php if (!NonCA()) { ?>
  99      <div class="parametres" style="height: 21px;">
 100        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" name="parametres" id="parametres">
 101          Sélection :<br>
 102          <select name="choix" onchange="document.parametres.submit()">
 103              <?php
 104                  foreach ($liste_choix as $idx=>$lc) {
 105                      $sel= $ind_selection == $idx ? " selected='selected'" : '';
 106                      echo "
 107                      <option value='$idx' $sel>
 108                          Saison : ".($idx-1)." - $idx
 109                       </option>";
 110                  }
 111              ?>
 112          </select>
 113          <br>
 114          <br>
 115          <input name="Creation" value="Ajout d'un atelier" type="button" onclick="Ouvrefiche(0)">
 116        </form>
 117      </div>
 118      <?php } ?>
 119      <table id="liste" class="tableau" border="1" cellpadding="2" cellspacing="2" >
 120        <tbody>
 121          <tr>
 122            <td align="left" width="120">
 123              Intitulé
 124            </td>
 125            <td width="200">
 126              Lieu
 127            </td>
 128            <td width="150">
 129              Jour et horaire
 130            </td>
 131            <td width="30">
 132              Participants
 133            </td>
 134          </tr>
 135            <?php
 136            $date_debut= ($ind_selection-1)."-08-31";
 137            $date_fin= ($ind_selection)."-09-01";
 138            $requete="SELECT id, lettre, intitule, lieu_nom, lieu_rue, lieu_compl, lieu_cp, lieu_ville, nb_max,
 139                DATE_FORMAT(heure_deb,'%kh %i') as heure_deb, DATE_FORMAT(heure_fin,'%kh %i') as heure_fin, jour_repet
 140              FROM atelier WHERE date_deb>'$date_debut' AND date_deb<'$date_fin' $where";
 141            $recherche=mysql_query($requete);
 142            if ($recherche === false) die( mysql_error());  
 143            while ($col= mysql_fetch_assoc($recherche)) {
 144              extract($col);
 145              $roquette= "SELECT count(*) as n_insc FROM participe, adhesion
 146                WHERE id_adh=adhesion.id AND id_atelier='$id' AND date_adhesion > '$date_debut'";
 147              $res=mysql_query($roquette);
 148              extract(mysql_fetch_assoc($res));
 149              mysql_free_result($res);
 150              $roquette= "SELECT count(*) as n_attente FROM attente WHERE id_atelier=$id AND date_ins > '$date_debut'";
 151              $res=mysql_query($roquette);
 152              extract(mysql_fetch_assoc($res));
 153              mysql_free_result($res);
 154              echo "<tr>";
 155              if (NonCA()) echo "<td> $lettre<br>$intitule</td>";
 156              else echo "<td onclick='Ouvrefiche($id)' class='lien'> $lettre<br>$intitule</td>";
 157              echo "<td>$lieu_nom<br>$lieu_rue<br>$lieu_compl<br>$lieu_cp $lieu_ville</td>";
 158              echo "<td>$tab_jour_semaine[$jour_repet]<br>De $heure_deb à $heure_fin</td>";
 159              echo "<td align='center'> <button onclick='Liste_participants($id)'> Liste </button>
 160                <br>Inscrits: $n_insc <br>Attente: $n_attente<br>Max: $nb_max</td>";
 161              echo "</tr>";           
 162            }
 163            ?>
 164        </tbody>
 165      </table>
 166      
 167    </body>
 168  </html>


Generated: Fri Jan 31 19:59:00 2014 Cross-referenced by PHPXref 0.7.1