| [ Index ] |
PHP Cross Reference of IEUF |
[Summary view] [Print] [Text view]
1 <?php 2 //Vérification accès 3 require 'inc/autorisation.inc.php'; 4 if (NonCA()) include 'inc/404.php'; 5 include "../inclus/connect_bdi.inc.php"; 6 ?> 7 8 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 9 <html> 10 <head> 11 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> 12 <title> Gestion des spectacles </title> 13 <link rel="stylesheet" href="formulaire.css" type="text/css"> 14 <style type="text/css"> 15 body { 16 background-color: #999999; 17 } 18 label { 19 display: inline-block; 20 width: 110px; 21 text-align: right; 22 vertical-align: top; 23 height: 30px; 24 padding-right: 5px; 25 } 26 27 input, select, textarea { 28 margin-left: 4px; 29 } 30 ul { 31 margin-left: 2px; 32 padding-left: 15px; 33 } 34 li { 35 margin-top: 2px; 36 margin-bottom: 5px; 37 } 38 .panneaux { 39 height: 340px; 40 padding-left:0px; 41 } 42 43 </style> 44 <?php 45 if (isset ($_POST['id'])) { 46 if (get_magic_quotes_gpc() == 0) 47 foreach ($_POST as $i=>$n) 48 if (is_string($n))$_POST[$i]= addslashes($n); 49 echo "<pre>",print_r ($_POST),"</pre>"; //exit; 50 extract ($_POST); 51 $set="SET titre='$titre', resume='$resume', compl_info='$compl_info', commentaire='$commentaire', reservation='$reservation', media='$media' "; 52 if ($id==0) { 53 if(!$mysqli->query("INSERT spectacle $set")) die($mysqli->error); 54 $id=$mysqli->insert_id; 55 } 56 else { 57 if(!$mysqli->query("UPDATE spectacle $set WHERE id=$id")) die($mysqli->error); 58 } 59 $requete="DELETE FROM passe WHERE id_spectacle=$id"; 60 $mysqli->query($requete); 61 if (isset($prod)) { 62 $requete="INSERT INTO passe (id_prod, id_spectacle) VALUES"; 63 foreach ($prod as $val) 64 $requete.=" ($val,$id),"; 65 $requete= trim($requete,","); 66 if(!$mysqli->query($requete)) die($mysqli->error); 67 } 68 echo "<script type='text/JavaScript'> 69 if (opener && opener.document.parametres) opener.document.parametres.submit(); 70 window.close(); 71 </script>"; 72 exit; 73 } 74 75 /*** PARTIE SAISIE ***/ 76 $id= 0; 77 $an=date('n')>8?date('Y')+1:date('Y'); 78 $titre= $resume= $commentaire= $compl_info= $media= ""; 79 $reservation='x'; 80 if (isset($_GET['id']) && !empty($_GET['id'])) { 81 $id=$_GET['id']; 82 $an=$_GET['an']; 83 $requete="SELECT id, titre, resume, commentaire, compl_info, reservation, media FROM spectacle WHERE id='$id'"; 84 $recherche=$mysqli->query($requete); 85 if ($recherche === false) die($mysqli->error); 86 if (($col=$recherche->fetch_assoc())) { 87 foreach($col as $i=>$v) 88 if (is_string($v)) 89 $col[$i]= htmlspecialchars ($v, ENT_QUOTES, "ISO-8859-1"); 90 extract($col); 91 } 92 $recherche->free(); 93 } 94 if (isset($_GET['an']) && !empty($_GET['an'])) 95 $an=$_GET['an']; 96 $debut_saison=($an-2)."-09-01"; 97 $fin_saison=$an."-08-31"; 98 ?> 99 </head> 100 <body> 101 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="spect" id="spect" onsubmit="return Controle()"> 102 <input name="id" type="hidden" value="<?php echo $id; ?>"> 103 <div class="panneaux" id="lst_prod" style="left:0px;width:230px;"> 104 <h2>Productions :</h2> 105 <?php 106 $t_prod= array(); 107 $requete= "SELECT id_prod FROM passe WHERE id_spectacle=$id"; 108 $recherche=$mysqli->query($requete); if ($recherche === false) die($mysqli->error); 109 while (($col=$recherche->fetch_assoc())) 110 $t_prod[]= $col['id_prod']; 111 $recherche->free(); 112 $requete="SELECT production.id, production.titre FROM production, atelier 113 WHERE atelier.id=production.id_atelier AND atelier.date_deb>'$debut_saison' ORDER BY atelier.date_deb DESC"; 114 $recherche=$mysqli->query($requete); 115 if ($recherche === false) die($mysqli->error); 116 while (($col=$recherche->fetch_assoc())) { 117 $sel= in_array($col['id'], $t_prod) ? " checked" : ""; 118 echo "<input type='checkbox' name='prod[]' value='{$col['id']}'$sel> {$col['titre']}<br>"; 119 } 120 $recherche->free(); 121 ?> 122 </div> 123 <div class="panneaux" style="left:240px;"> 124 <label for="titre">Titre :</label> <input maxlength="254" size="40" name="titre" value="<?php echo $titre;?>"><br> 125 <label for="resume">Résumé :</label> <textarea cols="45" rows="5" name="resume"><?php echo $resume;?></textarea><br> 126 <label for="commentaire">Commentaires :</label> <textarea cols="45" rows="5" name="commentaire"><?php echo $commentaire;?></textarea> 127 <label for="compl_info">Informations complémentaires :</label> <textarea cols="45" rows="5" name="compl_info"><?php echo $compl_info;?></textarea> 128 <label for="reservation">Réservation :</label> 129 <input name="reservation" value="i" type="radio" <?php if ($reservation=='i') echo "checked"; ?>>Indispensable 130 <input name="reservation" value="p" type="radio" <?php if ($reservation=='p') echo "checked"; ?>>Possible 131 <input name="reservation" value="x" type="radio" <?php if ($reservation=='x') echo "checked"; ?>>Pas de réservation 132 </div> 133 <div class="panneaux" id="lst_repr" style="left:730px;width:230px;"> 134 <h2>Représentations :</h2> 135 <ul> 136 <?php 137 $representations=false; 138 $requete="SELECT salle, lieu, ville, DATE_FORMAT(date,'le %e-%c-%Y à %Hh%i') as date FROM representation WHERE id_spectacle=$id ORDER BY date DESC"; 139 $recherche=$mysqli->query($requete); 140 if ($recherche === false) die($mysqli->error); 141 while (($col=$recherche->fetch_assoc())) { 142 extract ($col); 143 $representations=true; 144 echo "<li>$ville $lieu $salle<br>$date</li>"; 145 } 146 $recherche->free(); 147 ?> 148 </ul> 149 </div> 150 <div class="panneaux" style="top:370px; height: 20px; width:90%; left:5%;"> 151 <div style="width:70%; margin-left:auto; margin-right: auto;"> 152 <label for="media">Média associé</label> 153 <select name="media" id="media"> 154 <option> </option> 155 <?php 156 $rep="../media/depliant/"; 157 foreach (glob("$rep*.pdf") as $nomfic) { 158 $nom=substr($nomfic, strlen($rep)); 159 $sel= $nom==$media ? " selected='selected'" : ""; 160 // $nom=substr($nom,0,-4); 161 echo "<option value=\"$nom\"$sel>".$nom."</option>\r\n"; 162 } 163 ?> 164 </select> 165 <input type="button" value="Charger un document média" onclick="ChargeMedia()"> 166 </div> 167 </div> 168 <p style="position:absolute; top:410px; text-align: center; width: 100%"> 169 <input type="submit" value="VALIDER"> 170 <input type="button" value="Abandonner" onclick="self.close()"> 171 <?php if (!$representations && $id!=0) { ?> 172 <input type="button" value="Supprimer" onclick="Supprimer()"> 173 <?php } ?> 174 </p> 175 </form> 176 <script type="text/javascript"> 177 function Controle() { 178 message =""; 179 if (document.spect.titre.value =="") message += "Titre non saisi\n"; 180 if (message!="") { 181 alert(message); 182 return false; 183 } 184 return true; 185 } 186 function Supprimer() { 187 if (confirm("Voulez-vous vraiment supprimer ce ragoûtant, remarquable, beau et merveilleux spectacle ?")) 188 location.replace("suppr_spect.php?id=<?php echo $id; ?>"); 189 } 190 function ChargeMedia() { 191 open ("charge_media.php","chargemedia","width=900,height=250,left=400,top=200,resizable=yes,scrollbars=yes").focus(); 192 } 193 function inser_media(nom) { 194 var insere= false; 195 for (var elt=document.getElementById("media").firstChild; elt; elt=elt.nextSibling) 196 if (elt.firstChild){ 197 elt.removeAttribute("selected"); 198 if (elt.innerHTML==nom) { 199 elt.setAttribute("selected","selected"); 200 insere= true; 201 } 202 else if (!insere && elt.innerHTML > nom) { 203 elt.insertAdjacentHTML("beforebegin", "<option selected='selected'>"+nom+"</option>"); 204 insere= true; 205 } 206 } 207 if (!insere) 208 document.getElementById("media").insertAdjacentHTML("beforeend", "<option selected='selected'>"+nom+"</option>"); 209 } 210 </script> 211 </body> 212 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 31 19:59:00 2014 | Cross-referenced by PHPXref 0.7.1 |