[ Index ]

PHP Cross Reference of IEUF

title

Body

[close]

/gestion/ -> productions.php (source)

   1  <?php
   2  //Vérification accès
   3  require  'inc/autorisation.inc.php';
   4  if (NonCA()) include  'inc/404.php';
   5  include  "../inclus/connect_bd.inc.php";
   6  ?>
   7  
   8  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   9  "http://www.w3.org/TR/html4/loose.dtd">
  10  <html>
  11    <head>
  12      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
  13      <meta http-equiv="Pragma" content="no-cache">
  14      <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  15      <meta http-equiv="expires" content="0">
  16      <title>
  17        Productions
  18      </title>
  19      <style type="text/css">
  20  body {
  21      font-family: Arial,Helvetica,sans-serif;
  22      font-size: 12pt;
  23      }
  24      input {
  25        width: 180px;
  26        margin-left: 10px;
  27        border-radius: 10px;
  28      }
  29      input:hover {
  30        background-color: white;
  31        box-shadow: 5px 5px 10px black;
  32      }
  33      a {
  34        text-decoration: none;
  35      }
  36      a:hover {
  37        background-color: #ccccff;
  38        color: red;
  39      }
  40      .parametres {
  41        width: 200px;
  42        height: 500px;
  43        position: fixed;
  44        min-height: 500px;
  45        background-color: #666666;
  46        color: white;
  47      }
  48      .tableau {
  49        margin-left: 205px;
  50        border-collapse: separate;
  51        border-spacing: 2px 5px;
  52      }
  53      .tableau tr:nth-child(odd){
  54        background-color: #dddddd;
  55      }
  56      .tableau tr:nth-child(even){
  57        background-color: #eeeeee;
  58      }
  59      .tableau tr:nth-child(1){
  60        background-color: #666666;
  61        color: white;
  62        font-size: 14pt;
  63        font-weight: bold;
  64      }
  65      .tableau p {
  66        margin-top: 4px;
  67        margin-bottom: 4px;
  68      }
  69      </style>
  70    </head>
  71    <body>
  72      <div class="parametres" style="height: 21px;">
  73        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" name="parametres" id="parametres">
  74          <p>Sélection :</p>
  75          <select name="choix" onchange="document.parametres.submit()">
  76          <?php
  77          $datdeb=$datfin=date('n')>8?date('Y')+1:date('Y');
  78          // liste des années de représentations
  79          $requete="SELECT DATE_FORMAT(date,'%Y')as an,DATE_FORMAT(date,'%m') as mois FROM representation ORDER BY date ASC limit 1";
  80          $recherche=mysql_query($requete);
  81          if ($recherche === false) die( mysql_error());
  82          if ($col= mysql_fetch_assoc($recherche)) {
  83            extract($col);
  84            $datdeb=$mois>8?$an+1:$an;
  85          }
  86          $requete="SELECT DATE_FORMAT(date,'%Y')as an,DATE_FORMAT(date,'%m') as mois FROM representation ORDER BY date DESC limit 1";
  87          $recherche=mysql_query($requete);
  88          if ($recherche === false) die( mysql_error());
  89          if ($col= mysql_fetch_assoc($recherche)) {
  90            extract($col);
  91            $datfin=$mois>8?$an+1:$an;
  92          }
  93           if (isset ($_POST['choix']))
  94            $an_select= $_POST['choix'];
  95           else
  96            $an_select=$datfin;
  97  
  98          for ($i=$datdeb;$i<=$datfin;$i++) {
  99            $sel= $an_select == $i ? " selected='selected'" : '';
 100            echo "
 101            <option value='$i' $sel>
 102                Saison : ".($i-1)."-$i
 103            </option>";
 104          }
 105              ?>
 106          </select>
 107          <div style="position: absolute; bottom: 20px; text-align: center">
 108            <p><input name="CreeProd" value="Ajout d'une production" type="button" onclick="OuvreProd(0)"></p>
 109            <p><input name="CreeSpect" value="Ajout d'un spectacle" type="button" onclick="OuvreSpec(0)"></p>
 110            <p><input name="CreeRepr" value="Ajout d'une représentation" type="button" onclick="OuvreRepres(0)"></p>
 111            <p>&nbsp;</p>
 112          </div>
 113        </form>
 114      </div>
 115      <table id="liste" class="tableau">
 116        <tbody>
 117          <tr>
 118            <td width="300">
 119              Productions
 120            </td>
 121            <td width="300">
 122              Spectacles
 123            </td>
 124            <td width="300">
 125              Représentations
 126            </td>
 127          </tr>
 128            <?php
 129            $requete="SELECT production.id as pr_id, production.titre as pr_tit
 130                      FROM production LEFT JOIN passe ON production.id=passe.id_prod
 131                      WHERE passe.id_prod is NULL";
 132            $recherche=mysql_query($requete);
 133            if ($recherche === false) die( mysql_error());
 134            while ($col= mysql_fetch_assoc($recherche))
 135              echo "<tr><td><a href='javascript:OuvreProd({$col['pr_id']});'>{$col['pr_tit']}</a></td><td></td><td></td></tr>";
 136              mysql_freeresult($recherche);
 137              
 138            $debut_saison=($an_select-1)."-09-01";
 139            $fin_saison=$an_select."-08-31";
 140            $t_spect=array();
 141            if ($an_select == $datfin) {
 142              $requete="SELECT spectacle.id as sp_id, titre FROM spectacle LEFT JOIN representation ON spectacle.id=representation.id_spectacle
 143                        WHERE representation.id_spectacle is NULL";
 144              $recherche=mysql_query($requete);
 145              if ($recherche === false) die( mysql_error());
 146              while ($col= mysql_fetch_assoc($recherche))
 147                array_push($t_spect, $col);
 148              mysql_freeresult($recherche);
 149            }
 150            $requete="SELECT spectacle.id as sp_id, titre FROM spectacle, representation WHERE spectacle.id=representation.id_spectacle
 151                      AND date between '$debut_saison' AND '$fin_saison' GROUP BY spectacle.id";
 152            $recherche=mysql_query($requete);
 153            if ($recherche === false) die( mysql_error());  
 154            while ($col= mysql_fetch_assoc($recherche))
 155              array_push($t_spect, $col);
 156            mysql_freeresult($recherche);
 157            foreach ($t_spect as $col) {
 158              extract($col);
 159              echo "<tr>";
 160              echo "<td>";
 161              $requete= "SELECT production.id as pr_id, production.titre AS pr_tit FROM production, spectacle, passe
 162                WHERE spectacle.id = $sp_id AND spectacle.id = id_spectacle AND production.id = id_prod";
 163              $recherche=mysql_query($requete);
 164              if ($recherche === false) die( mysql_error());
 165              while ($col= mysql_fetch_assoc($recherche))
 166                echo "<p><a href='javascript:OuvreProd({$col['pr_id']});'>{$col['pr_tit']}</a></p>";
 167              mysql_freeresult($recherche);
 168              echo "</td>";
 169              echo "<td><a href='javascript:OuvreSpec($sp_id);'>$titre</a></td>";
 170              echo "<td>";
 171              $requete= "SELECT representation.id as re_id, DATE_FORMAT(representation.date,'%d/%m/%Y') AS re_dat, representation.ville AS re_vil
 172              FROM representation, spectacle
 173                WHERE spectacle.id = $sp_id AND spectacle.id = id_spectacle AND date between '$debut_saison' AND '$fin_saison'";
 174              $recherche=mysql_query($requete);
 175              if ($recherche === false) die( mysql_error());
 176              while ($col= mysql_fetch_assoc($recherche))
 177                echo "<p><a href='javascript:OuvreRepres({$col['re_id']});'>".$col['re_dat']." - {$col['re_vil']}</a></p>";
 178              mysql_freeresult($recherche);
 179              echo "</td>";
 180              echo "</tr>";           
 181            }
 182            ?>
 183        </tbody>
 184      </table>
 185      <script language="JavaScript" type="text/JavaScript">
 186  <!--
 187      tab_pers = new Array();
 188  
 189      function OuvreProd(id) {
 190          open("f_production.php?id="+id+"&an="+<?php echo $an_select;?>,"_blank","width=1010,height=418,left=320,top=0,resizable=yes,scrollbars=yes").focus();
 191      }
 192      function OuvreSpec(id) {
 193          open("f_spectacle.php?id="+id+"&an="+<?php echo $an_select;?>,"_blank","width=1010,height=450,left=320,top=0,resizable=yes,scrollbars=yes").focus();
 194      }
 195      function OuvreRepres(id) {
 196          open("f_representation.php?id="+id,"_blank","width=750,height=460,left=320,top=0,resizable=yes,scrollbars=yes").focus();
 197      }
 198      //-->
 199      </script>
 200    </body>
 201  </html>


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