1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
| <?php
include('_entete.php');
//si on veut supprimer le modele en cours de visionnage
if (isset($_POST['id_suppression']) ) {include('register.php'); }
//id du modele qu'on veut voir ,envoyé soit par le formulaire, soit par get quand on vient de modifier le modéle (res de ma recherche)
if(isset($_POST["REQ_resultat"])) {$REQ_resultat = $_POST["REQ_resultat"];}
else if (isset($_GET["REQ_resultat"])) {$REQ_resultat = $_GET["REQ_resultat"];}
else {$REQ_resultat = "";}
//message d'erreur pour la modification d'un modéle
$texte = ( isset($_GET['prob_devant']) and $_GET['prob_devant'] == 1 )? "photo de devant " : "" ;
$texte .= ($texte == "") ? "" : " et " ;
$texte .= (isset($_GET['prob_maille'])and $_GET['prob_maille'] == 1 )? "photo de maille " : "" ;
$texte .= ($texte == "") ? "" : " et " ;
$texte .= (isset($_GET['prob_detail'])and $_GET['prob_detail'] == 1 )? "photo de detail " : "" ;
$texte .= ($texte == "") ? "" : " non modifiée(s) " ;
if($texte != "" ) Message($texte,"SQL_KO3");
//critere de recherche : première fois qu'on traite cette recherche ou déjà fait recherche donc résultats dans var de session
$REQ_WHERE_condition = isset($_SESSION['query']) ? $_SESSION['query'] : "";
// critères de recherche demandé par l'utilisateur (cf. formulaire de "search.php")
if (isset($_POST['REC_Recherche']))
{
//si on est dans une recherche interstyl :
if(isset($_POST['rech_tout']) )
{
$_SESSION['saison'] = $_POST['saison'];
$_SESSION['client'] = $_POST['client'];
}
// sauvegarde des critères de la page "search.php"
$_SESSION['nom'] = $_POST['nom'];
$_SESSION['theme'] = $_POST['theme'];
$_SESSION['categorie'] = $_POST['categorie'];
$_SESSION['type'] = $_POST['type'];
$_SESSION['col'] = $_POST['col'];
$_SESSION['maille'] = $_POST['maille'];
$_SESSION['jauge'] = $_POST['jauge'];
$_SESSION['manche'] = $_POST['manche'];
$_SESSION['emman'] = $_POST['emman'];
$_SESSION['facon'] = $_POST['facon'];
$_SESSION['echantillon1'] = $_POST['echantillon1'];
// Chargement de la requete
$REQ_WHERE_condition = "WHERE mode.nom like '%" . $_POST['nom'] . "%'";
if(isset($_POST['rech_tout']) )
{
$REQ_WHERE_condition .= $_POST['saison'] == -1 ? "" : " and mode.saison = '" . $_POST['saison'] . "'";
$REQ_WHERE_condition .= $_POST['client'] == -1 ? "" : " and mode.client = '" . $_POST['client'] . "'";
}
$REQ_WHERE_condition .= " and mode.theme like '%" . $_POST['theme'] . "%'";
$REQ_WHERE_condition .= $_POST['type'] == -1 ? "" : " and mode.type = '" . $_POST['type'] . "'";
$REQ_WHERE_condition .= $_POST['col'] == -1 ? "" : " and mode.col = '" . $_POST['col'] . "'";
$REQ_WHERE_condition .= $_POST['maille'] == -1 ? "" : " and mode.maille = '" . $_POST['maille'] . "'";
$REQ_WHERE_condition .= $_POST['jauge'] == -1 ? "" : " and mode.jauge = '" . $_POST['jauge'] . "'";
$REQ_WHERE_condition .= $_POST['manche'] == -1 ? "" : " and mode.manche = '" . $_POST['manche'] . "'";
$REQ_WHERE_condition .= $_POST['emman'] == -1 ? "" : " and mode.emmanchure = '" . $_POST['emman'] . "'";
$REQ_WHERE_condition .= $_POST['facon'] == -1 ? "" : " and mode.facon = '" . $_POST['facon'] . "'";
$REQ_WHERE_condition .= $_POST['categorie'] == -1 ? "" : " and T.categorie = '" . $_POST['categorie'] . "'";
$REQ_WHERE_condition .= " and mode.echantillon1 like '%" . $_POST['echantillon1'] . "%' ORDER BY mode.nom";
//on met dans une session les criteres de recherche demandés par l'utilisateur
$_SESSION['query'] = $REQ_WHERE_condition;
}
// Requete pour affichage du modèle (soit sélectionné, soit 1er de la recherche)
$REQ_requete1 = "
SELECT mode.*, S.saison as S_saison, C.nom as C_client, T.type as T_type, col.col as Col_col, Ma.maille as Ma_maille, Man.manche as Man_manche, Em.emman as Em_emman, Fa.facon as Fa_facon, Ja.valeur as Ja_valeur
FROM mode
left join saison S on mode.saison = S.id
left join client C on mode.client = C.id
left join type T on mode.type = T.id
left join col on mode.col = col.id
left join maille Ma on mode.maille = Ma.id
left join manche Man on mode.manche = Man.id
left join emman Em on mode.emmanchure = Em.id
left join facon Fa on mode.facon = Fa.id
left join jauge Ja on mode.jauge = Ja.id
";
$REQ_requete1 .= ($REQ_resultat == "") ? $REQ_WHERE_condition : "where mode.id = $REQ_resultat ";
echo '<p>'.$REQ_requete1.'</p>';
$resultat = mysql_query($REQ_requete1) or die(mysql_error()) ;
$count_REQUETE_joach_thib=mysql_num_rows($resultat);
// echo $count_REQUETE_joach_thib;
if( $count_REQUETE_joach_thib> 0)
{
//recuperation de l'id des mod après celui affiché
$mod_sui = 0;
$joach_array=array();
$joach_array_select=array();
while ($aff_res = mysql_fetch_array($resultat) )
{
if($mod_sui == 0){
//photo
$chemin1 = $aff_res['ph_devant'];
$chemin2 = $aff_res['ph_maille'];
$chemin3 = $aff_res['ph_detail'];
////photo
$nom=strtoupper($aff_res['nom']);
$S_saison=$aff_res['S_saison'];
$C_client=$aff_res['C_client'];
$theme=$aff_res['theme'];
$T_type=$aff_res['T_type'] ;
$Col_col=$aff_res['Col_col'] ;
$Man_manche=$aff_res['Man_manche'];
$Em_emman=$aff_res['Em_emman'];
$Ma_maille=$aff_res['Ma_maille'];
$Ja_valeur=$aff_res['Ja_valeur'];
$Fa_facon=$aff_res['Fa_facon'];
$echantillon1=$aff_res['echantillon1'];
$id_res=$aff_res['ID'];
}
if($count_REQUETE_joach_thib>1){
$joach_array[]=$aff_res['ID'];
$joach_array_select[$aff_res['ID']]=$aff_res['nom'];
}
$mod_sui++ ;
}
if($count_REQUETE_joach_thib>1){
$_SESSION['joach_array_id']=$joach_array;
$_SESSION['count_joach']=count($joach_array);
$_SESSION['joach_array_select']=$joach_array_select;
}
if (isset($_POST['REC_Recherche']) || $REQ_resultat==='')
$_SESSION['joach_suivant']=1;
else{
$key = array_search($REQ_resultat, $_SESSION['joach_array_id']);
$_SESSION['joach_suivant']=$key+1;
$_SESSION['joach_precedant']=$key-1;
}
// print_r($_SESSION['joach_array_id']);
// print_r($joach_array_select);die();
// echo $_SESSION['joach_array_id'][$_SESSION['joach_suivant']];
if(isset($_SESSION['joach_array_id'][$_SESSION['joach_suivant']]))
$fl_gauche=$_SESSION['joach_array_id'][$_SESSION['joach_suivant']];
else
$fl_gauche='';
if(isset($_SESSION['joach_array_id'][$_SESSION['joach_precedant']]))
$fl_precedant=$_SESSION['joach_array_id'][$_SESSION['joach_precedant']];
else
$fl_precedant='';
?>
<SCRIPT language="Javascript">
function confirmsubmit()
{
choix = confirm("ATTENTION ! Ce modéle sera définitivement supprimer de votre bibliothéque . Etes vous sûr de votre choix ? ");
if(choix==true){document.forms.form_sup.submit(); return true;}
else { return false; }
}
</script>
<table width=100% cellspacing=6 cellpadding=1 >
<colgroup>
<col width=30%/>
<col width=70%/>
</colgroup>
<tr height='2'> <td colspan=2 > </td> </tr>
<tr>
<td colspan=2>
<table width=100% cellspacing=1 class=ficheresultat>
<colgroup>
<col width=50%/> <col width=50%/>
</colgroup>
<tr class=res>
<td class=label_gauche>
<?php if($fl_precedant!=''){?><a href='requete.php?REQ_resultat=<?php echo $fl_precedant; ?> '><img src="image/fleche-gauche.png" ></a> <?php }else{echo'sorry, there\'s nothing here for you';}?>
</td>
<td class=resultat>
<?php
echo $_SESSION['count_joach'] . " resultat" . ($_SESSION['count_joach'] > 1 ? "s" : "") . " à votre recherche"; ?>
<form name="REQ_Form" action='requete.php' method="post">
<?php
CreerSelectjoach("REQ_resultat", $_SESSION['joach_array_select'], $REQ_resultat, false, "document.forms.REQ_Form.submit();");
?>
</form>
</td>
<td class=val_res>
</td>
<td class=label>
<?php if(isset($fl_gauche)){?><a href='requete.php?REQ_resultat=<?php echo $fl_gauche; ?> '><img src="image/fleche.png" ></a> <?php }else{echo'sorry, there\'s nothing here for you';}?>
</td>
</tr>
</table>
</td>
</tr>
<tr height='13'> <td colspan=2 > </td> </tr>
<tr valign=top border='1'>
<td>
<!-- aperçu de la fiche enregistré -->
<table width=100% cellspacing=4 class=fichemodele>
<colgroup>
<col width=50%/>
<col width=50%/>
</colgroup>
<tr height=60px class=entete><th colspan='2'><?php echo $nom ; ?></th></tr>
<?php
if(isset($_POST['rech_tout']) )
{ ?>
<tr>
<td class=label><label>saison</label></td>
<td class=valeur><?php echo $S_saison ; ?></td>
</tr>
<tr>
<td class=label><label>client</label> </td>
<td class=valeur><?php echo $C_client ; ?></td>
</tr>
<?php } ?>
<tr>
<td class=label><label>theme</label> </td>
<td class=valeur><?php echo $theme; ?></td>
</tr>
<tr>
<td class=label><label>type de modèle</label></td>
<td class=valeur><?php echo $T_type ; ?></td>
</tr>
<tr>
<td class=label><label>col</label></td>
<td class=valeur><?php echo $Col_col ; ?></td>
</tr>
<tr>
<td class=label><label>manche</label></td>
<td class=valeur><?php echo $Man_manche ; ?></td>
</tr>
<tr>
<td class=label><label>emmanchure</label></td>
<td class=valeur><?php echo $Em_emman ; ?></td>
</tr>
<tr>
<td class=label><label>maille</label></td>
<td class=valeur><?php echo $Ma_maille ; ?></td>
</tr>
<tr>
<td class=label><label>jauge</label></td>
<td class=valeur><?php echo $Ja_valeur ; ?></td>
</tr>
<tr>
<td class=label><label>façons</label></td>
<td class=valeur><?php echo $Fa_facon ; ?></td>
</tr>
<tr>
<td class=label><label>n° echantillon</label></td>
<td class=valeur><?php echo $echantillon1; ?></td>
</tr>
<tr height='3 px' ><td colspan='2'></td></tr>
</table>
<table width=100% cellspacing=3 >
<tr height='1 px' ><td colspan='3'></td></tr>
<tr>
<td > <a href='changer.php?idu=<?php echo $id_res; ?> ' class=dessin > <img src="image/edit.png" ></a></td>
<td >
<form name='form_sup' method='POST' action='requete.php' onsubmit='return confirmsubmit()'>
<input type='hidden' name='id_suppression' value='<?php echo $id_res;?>' />
<input name='SUP_Bouton' src='image/suppression.png' type='image' Value='submit' />
</form>
</td>
<td> <?php $rech = isset($_POST['rech_tout']) ? "1" : "0"; ?>
<a href='imprim.php?id_imp=<?php echo $id_res; ?>&rech=<?php echo $rech; ?> ' target=_blank class=dessin >
<img src="image/imprimer.png" ></a></td>
</tr>
<tr height='2 px' ><td colspan='3'></td></tr>
</table>
<!-- photo détail -->
<table width=100% cellspacing=3px >
<?php
if(isset($_POST['rech_tout'])) { echo"<tr height='10 px' ><td></td></tr> "; }
else { echo"<tr height='40 px' ><td></td></tr> "; }
?>
<tr>
<td class=label2><label>Photo de détail</label><br><br>
<?php
if( file_exists($chemin3) )
{
echo "<a href='photo.php?chemin=$chemin3' target=_blank>
<img src='$chemin3?".time()."' width='300'> </a>";
}
else echo"<h3> Pas de photo </h3>";
?>
</td>
</tr>
</table>
</td>
<td>
<!-- COLONNE PHOTO -->
<table height=100% width=100%>
<th colspan='2' class=entete> PHOTOS </th>
<tr height='5 px' ><td colspan='2'></td></tr>
<tr valign=top style="text-align: center;">
<td><br><br>
<?php
if(file_exists($chemin1) )
{
echo "<a href='photo.php?chemin=$chemin1' target=_blank>
<img src='$chemin1?".time()."' width='400'> </a>";
}
else echo"<h3> Pas de photo </h3>";
?>
</td>
<td><br><br>
<?php
if(file_exists($chemin2))
{
echo "<a href='photo.php?chemin=$chemin2' target=_blank>
<img src='$chemin2?".time()."' width='400'> </a>";
}
else echo"<h3> Pas de photo </h3>";
?>
</td>
</tr>
<tr height='5 px' ><td colspan='2'></td></tr>
</table>
</td>
</tr>
</table>
<?php
}
else
{
$texte = "Votre recherche n'a aucun résultat ";
message($texte,'SQL_KO3');
}
include('_fin.php');
?> |
Partager