//only id pour filtrer materiels $listcontratmat[$i] = odbc_result($res, 4); //only id_contratmat pour filtrer contrats $listfournimat[$i] = odbc_result($res, 5); //only id_frn pour filtrer fournisseurs } $i++; } $listid = implode(',', $listidmat); /*****************************************************************************/ switch ($entite) { /*****************************************************************************/ /* FOURNISSEUR */ /*****************************************************************************/ case "fournisseurs": $liste_fournisseur = listeFourni(); //filtre sur NOM if (isset($_POST['nom']) and $_POST['nom'] != '') { $liste_temp = array(); foreach ($liste_fournisseur as $fourni) { //print_r($fourni); if (strpos(strtolower($fourni['raison_sociale']), strtolower($_POST['nom'])) !== false) { $liste_temp[] = $fourni; } } $liste_fournisseur = $liste_temp; } //filtre sur SITE ou ZONE ou CATEGORIE ou FAMILLE ou MARQUE ou ID if (isset($_POST['site']) and $_POST['site'] != '' or isset($_POST['zone']) and $_POST['zone'] != '' or isset($_POST['categorie']) and $_POST['categorie'] != '' or isset($_POST['famille']) and $_POST['famille'] != '' or isset($_POST['marque']) and $_POST['marque'] != '') { $liste_temp = array(); foreach ($liste_fournisseur as $fourni) {
function formChar($champ, $valeur, $disabled, $classe) { $label = formatLabel($champ); switch ($champ) { case "frn_materiel": //cas particulier fournisseur $listefourni = listeFourni(); echo "<td>" . $label . " </td><td><select style='width:250' " . $disabled . " " . $classe . " name=" . $champ . " id=" . $champ . ">\r\n <option value=''>Sélection...</option>"; foreach ($listefourni as $opt) { if (trim($opt["id"]) == trim($valeur)) { $selected = "selected"; } else { $selected = ''; } echo " <option value='" . $opt["id"] . "' " . $selected . ">" . $opt["id"] . " - " . utf8_encode($opt["nom"]) . "</option>"; } echo " </select></td>"; break; /*case "marq_materiel"://cas particulier marque $listemarq = listeMarq(); echo "<td>".$label." </td><td><select style='width:250' ".$classe." name=".$champ." id=".$champ."> <option value=''>Sélection...</option>"; foreach($listemarq as $opt){ if(trim($opt["id"]) == trim($valeur)){ $selected = "selected";} else{ $selected = '';} echo " <option value='".$opt["id"]."' ".$selected.">".$opt["id"]." - ".utf8_encode($opt["nom"])."</option>"; } echo " </select></td>"; break; */ /*case "marq_materiel"://cas particulier marque $listemarq = listeMarq(); echo "<td>".$label." </td><td><select style='width:250' ".$classe." name=".$champ." id=".$champ."> <option value=''>Sélection...</option>"; foreach($listemarq as $opt){ if(trim($opt["id"]) == trim($valeur)){ $selected = "selected";} else{ $selected = '';} echo " <option value='".$opt["id"]."' ".$selected.">".$opt["id"]." - ".utf8_encode($opt["nom"])."</option>"; } echo " </select></td>"; break; */ case "poste": //cas particulier poste $listeposte = listeOdbc('informix.bas_postrav'); echo "<td>" . $label . " </td><td><select style='width:250' " . $classe . " name=" . $champ . " id=" . $champ . ">\r\n <option value=''>Sélection...</option>"; foreach ($listeposte as $opt) { if (trim($opt["id"]) == trim($valeur)) { $selected = "selected"; } else { $selected = ''; } echo " <option value='" . $opt["id"] . "' " . $selected . ">" . $opt["id"] . " - " . utf8_encode($opt["nom"]) . "</option>"; } echo " </select></td>"; break; default: if ($champ == 'tel') { echo "<td>" . $label . " </td><td><input type=text " . $disabled . " " . $classe . " name=" . $champ . " value = \"" . utf8_encode($valeur) . "\" onKeyPress='return chiffres(event);'></td>"; } else { echo "<td>" . $label . " </td><td><input type=text " . $disabled . " " . $classe . " name=" . $champ . " value = \"" . trim(utf8_encode($valeur)) . "\"></td>"; } break; } }