| [ Index ] |
PHP Cross Reference of IEUF |
[Summary view] [Print] [Text view]
1 <?php 2 require_once '../../inclus/connect_bd.inc.php'; 3 include_once ('../../inclus/utilitaire.inc.php'); 4 include_once ('../../gestion/inc/autorisation.inc.php'); 5 if (isset($_GET['id']) && $_GET['id']!=0) 6 $id_representation = $_GET['id']; 7 else 8 echo "appel incorrect"; 9 include_once ('medias.inc.php'); 10 @session_start(); 11 header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 12 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé 13 ?> 14 <!DOCTYPE html> 15 <html> 16 <head> 17 <meta content="text/html; charset=iso-8859-1" http-equiv="content-type"> 18 <meta http-equiv="Pragma" content="no-cache"> 19 <meta http-equiv="Cache-Control" content="no-cache, must-revalidate"> 20 <meta http-equiv="expires" content="0"> 21 <title>Il était une fois : media</title> 22 <link rel="stylesheet" href="../ttes_pages.css" type="text/css"> 23 <link rel="stylesheet" href="../sp_ttes_pages.css" type="text/css"> 24 <link media="print" rel="stylesheet" href="../print.css" type="text/css"> 25 <style type="text/css"> 26 button, input[type='button'] { 27 cursor: pointer; 28 } 29 #banniere { 30 position: absolute; 31 top: 5px; 32 left: 0px; 33 right: 70px; 34 height: 50px; 35 font-size: 12pt; 36 text-align: center; 37 } 38 #btferme { 39 position: absolute; 40 display:inline-block; 41 right:5px; 42 width:60px; 43 top:8px; 44 background-color: red; 45 color: white; 46 font-weight: bold; 47 } 48 #btajouter_i, #btajouter_v { 49 position: absolute; 50 display:inline-block; 51 width:100px; 52 bottom:5px; 53 text-align: center; 54 font-size: 12px; 55 } 56 #btajouter_i { 57 left:50px; 58 } 59 #btajouter_v { 60 left:155px; 61 } 62 #image { 63 position: absolute; 64 top: 50px; 65 left: 310px; 66 right: 5px; 67 height: <?php echo $hauteurMoyennes+30; ?>px; 68 padding: 10px; 69 background-color: #222222; 70 text-align: center; 71 font-size: 20px; 72 } 73 #lien_grande, #btmodifier, #btsuppr { 74 position: absolute; 75 } 76 #btmodifier, #btsuppr { 77 top: 0px; 78 font-size: 12px; 79 } 80 #lien_grande { 81 top: <?php echo $hauteurMoyennes+100; ?>px; 82 height: 30px; 83 left: 310px; 84 right: 5px; 85 background-color: #222222; 86 text-align: center; 87 font-size: 16px; 88 } 89 #btmodifier { 90 left: 10px; 91 } 92 #btsuppr { 93 right: 10px; 94 } 95 #commentaire { 96 position: absolute; 97 top: <?php echo $hauteurMoyennes+130; ?>px; 98 left: 310px; 99 right: 5px; 100 bottom: 5px; 101 padding: 10px; 102 overflow: auto; 103 background-color: #222222; 104 color: #eeeeee; 105 font-size: 10pt; 106 } 107 #public { 108 position : absolute; 109 top : 55px; 110 right : 10px; 111 color : white; 112 113 } 114 #div_liste { 115 top: 50px; 116 left: 4px; 117 position: absolute; 118 bottom: 60px; 119 width: 300px; 120 overflow: auto; 121 } 122 #liste { 123 width: 100%; 124 border-collapse: collapse; 125 } 126 #liste tr { 127 cursor: pointer; 128 } 129 #liste tr:hover { 130 background-color: #880000; 131 } 132 .lst_titre { 133 font-size: 12pt; 134 text-align: left; 135 padding: 5px; 136 } 137 .lst_img { 138 text-align: right; 139 padding: 5px; 140 } 141 142 </style> 143 <script> 144 liste_medias=new Array(); //titre, chemin, commentaire, indicateur (0=image grande, 1=image non grande, 2=vidéo), id, public ou non 145 <?php 146 $requete="SELECT id, titre, public, chemin, commentaire 147 FROM media WHERE id_representation='$id_representation'"; 148 if ($_SESSION['nom']=='') 149 $requete.= " AND public='1'"; 150 $requete .= "ORDER BY chemin"; 151 $repres=mysql_query($requete); echo mysql_error(); 152 while ($champ= mysql_fetch_assoc($repres)) { 153 foreach($champ as $k => $v) 154 $champ[$k] = str_replace(array("\n", "\r"), array("<br>",""), htmlentities($v, ENT_QUOTES, "iso-8859-1")); 155 extract($champ); 156 if (file_exists($repGrandes.$chemin)) $ind= 0; 157 else if (file_exists($repVideo.$chemin)) $ind= 2; 158 else $ind= 1; 159 echo "liste_medias.push(['$titre', '$chemin', '$commentaire', $ind, $id, $public]);\n"; 160 } 161 ?> 162 </script> 163 </head> 164 <body> 165 <div id="banniere"> 166 <?php 167 $requete="SELECT spectacle.titre AS titre_spec, ville AS ville_rep, date AS date_rep FROM spectacle, representation 168 WHERE representation.id='$id_representation' AND representation.id_spectacle = spectacle.id"; 169 $repres=mysql_query($requete); echo mysql_error(); 170 if ($champ= mysql_fetch_assoc($repres)) { 171 foreach($champ as $k => $v) 172 $champ[$k] = htmlentities($v, ENT_QUOTES, "iso-8859-1"); 173 extract($champ); 174 $date_rep= dateheurefr($date_rep); 175 echo "\"<i>$titre_spec\",</i> représentation du <i>$date_rep</i> à <i>$ville_rep</i>\r\n"; 176 } 177 ?> 178 </div> 179 <button id="btferme" onclick="window.close()">Fermer</button> 180 <div id="div_liste"> 181 <table> 182 <tbody id="liste"> 183 184 </tbody> 185 </table> 186 </div> 187 <?php if (!NonCA()) { ?> 188 <input type="button" id="btajouter_i" value="Ajouter image" onclick="ajout_media('i')"> 189 <input type="button" id="btajouter_v" value="Ajouter vidéo" onclick="ajout_media('v')"> 190 <?php } ?> 191 <div id="image"> 192 <h2>Sélectionnez un média dans la liste de gauche</h2> 193 </div> 194 <div id="lien_grande"> </div> 195 <div id="commentaire"> </div> 196 <div id="public"> </div> 197 <script> 198 for (i in liste_medias){ 199 miniature = liste_medias[i][3] == 2 ? liste_medias[i][1]+".jpg" : liste_medias[i][1]; 200 document.getElementById("liste").insertAdjacentHTML("beforeEnd", 201 "<tr id='lig"+i+"' onclick=\"affiche("+i+")\"><td class='lst_titre'>"+liste_medias[i][0]+"</td><td class='lst_img'><img src='<?php echo $repPetites; ?>"+miniature+"'></td></tr>"); 202 } 203 lig_sel= 0; 204 function affiche(i) { 205 document.getElementById("lig"+lig_sel).style.backgroundColor= ""; 206 document.getElementById("lig"+i).style.backgroundColor= "#666666"; 207 lig_sel= i; 208 if (liste_medias[i][3] == 2) { 209 document.getElementById("image").innerHTML=liste_medias[i][0]+"<br>" 210 +"<video controls = 'true' width = '500' height='<?php echo $hauteurMoyennes; ?>'" 211 +"src='<?php echo $repVideo; ?>"+liste_medias[i][1]+"' " 212 +"poster='<?php echo $repMoyennes; ?>"+liste_medias[i][1]+".jpg" 213 +"'>Votre navigateur ne prend pas en charge la vidéo</video>"; 214 document.getElementById("lien_grande").innerHTML= ""; 215 } 216 else { 217 document.getElementById("image").innerHTML= liste_medias[i][0]+"<br><img src='<?php echo $repMoyennes; ?>"+liste_medias[i][1]+"'>"; 218 document.getElementById("lien_grande").innerHTML= liste_medias[i][3] == 0 ? "<a href='javascript:afficheGrande("+i+")'>Cliquer pour agrandir</a>" : ""; 219 220 } 221 document.getElementById("commentaire").innerHTML= liste_medias[i][2]; 222 document.getElementById("public").innerHTML= liste_medias[i][5]==0 ? '(Réservée adhérents)' : '(Publique)'; 223 <?php if (!NonCA()) { ?> 224 var id= liste_medias[i][4]; 225 document.getElementById("lien_grande").innerHTML += 226 '<input type="button" id="btmodifier" value="Modifier" onclick="modif_media('+id+', '+liste_medias[i][3]+')">' 227 +'<input type="button" id="btsuppr" value="Supprimer" onclick="suppr_media('+id+', '+liste_medias[i][3]+')">'; 228 <?php } ?> 229 } 230 231 function afficheGrande(i) { 232 open("<?php echo $repGrandes; ?>"+liste_medias[i][1], "IEUF_MEDIA_GRAND","height=600, width=800").focus(); 233 } 234 235 <?php if (!NonCA()) { ?> 236 function ajout_media(type) { 237 nom_fic= type== "v" ? 'media_video' : 'media_image'; 238 open(nom_fic+".php?id_rep=<?php echo $id_representation; ?>", "gestion_media", "top=100,left=50,height=450,width=900,scrollbars=yes").focus(); 239 } 240 function modif_media(id_med, type) { 241 nom_fic= type== 2 ? 'media_video' : 'media_image'; 242 open(nom_fic+".php?id_rep=<?php echo $id_representation; ?>&id_med="+id_med, "gestion_media", "top=100,left=50,height=200,width=900,scrollbars=yes").focus(); 243 } 244 245 function suppr_media(id) { 246 var eltImage= document.getElementById("image"); 247 var svCouleur= eltImage.style.backgroundColor; 248 eltImage.style.backgroundColor= "#ff0000"; 249 if (!window.confirm("Etes-vous sûr de supprimer ce document ?")) { 250 eltImage.style.backgroundColor= svCouleur; 251 return; 252 } 253 eltImage.innerHTML= "<h2>Suppression en cours</h2>"; 254 var xhr= new XMLHttpRequest(); 255 xhr.open("GET", "supprime.xhr.php?id_med="+id, false); 256 xhr.send(); 257 if(xhr.status == 200) {// Réponse OK 258 rep= xhr.responseText; 259 if (rep != "") alert("Erreur : "+rep); 260 } 261 else 262 alert("Erreur serveur n° : "+xhr.status); 263 window.location.reload(); 264 } 265 <?php } ?> 266 </script> 267 </body> 268 </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 |