function htmlEquipement($idTroll, $type, $flag) { $retour = ""; $options = ""; $equipedCarac = ""; // Création de l'objet DOM et charge le fichier xml du troll $dom = getDom(); $dom->preserveWhiteSpace = false; $dom->load("trolls/" . $idTroll . ".xml"); // Ajoute l'option de l'objet équipé foreach ($dom->getElementsByTagName("Equipements")->item(0)->childNodes as $eq) { if ($eq->getAttribute("type") == $type) { $options .= htmlOptionEquipements($idTroll, $eq, $type, "selected"); $equipedCarac .= getItemCarac($eq); } } // Charge le fichier xml des objets de tanieres $dom->load("tanieres/" . $type . ".xml"); // Parcours chaques objets et les ajoutent au select foreach ($dom->getElementsByTagName("Element") as $item) { $options .= htmlOptionEquipements($idTroll, $item, $type); } if ($flag > 0) { $retour .= "<tr><td></td></tr>"; } $retour .= "<tr height='50px;'>\n\t\t\t\t\t\t<td colspan='2' style='border-top: 1px solid #F9BB2F;border-left: 1px solid #F9BB2F;border-right: 1px solid #F9BB2F;'>" . htmlGetFilters($idTroll, $type) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr height='75px;'>\n\t\t\t\t\t\t<td style='border-bottom: 1px solid #F9BB2F;border-left: 1px solid #F9BB2F;'>\n\t\t\t\t\t\t\t<select class='pmtEquipement' id='{$type}' onClick=\"updateTroll({$idTroll});\" >\n\t\t\t\t\t\t\t\t<option value='0' onMouseOver=\"getItemCarac( {$idTroll}, 0,'{$type}');\">" . str_replace("_", " ", $type) . "</option>\n\t\t\t\t\t\t\t\t{$options}\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width='500px;' style='border-bottom: 1px solid #F9BB2F;border-right: 1px solid #F9BB2F;'>\n\t\t\t\t\t\t\t<span class='pmtSpan' id='span_{$type}' style='font-size:15;'>{$equipedCarac}</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; return $retour; }
<?php header('Content-Type: text/html; charset=iso-8859-1'); require_once "functions_pmt.php"; echo "<option onMouseOver=\"getItemCarac(0,'" . $_POST["type"] . "');\" value=\"0\">" . str_replace("_", " ", $_POST["type"]) . "</option>"; // Création de l'objet DOM et chargement du fichier xml du troll $dom = getDom(); $dom->load("trolls/" . $_POST["idTroll"] . ".xml"); // Parcours la liste d'équipement du Troll et affiche une option si l'objet correspond au critère de recherche foreach ($dom->getElementsByTagName("Equipements")->item(0)->childNodes as $item) { if ($item->getAttribute("type") == $_POST["type"] && preg_match("#.*" . $_POST["nom"] . ".*" . $_POST["template"] . ".*" . $_POST["mithril"] . "#i", stripslashes($item->nodeValue))) { echo htmlOptionEquipements($_POST["idTroll"], $item, $_POST["type"]); } } // Chargement du fichier d'objet des tanieres $dom->load("tanieres/" . $_POST["type"] . ".xml"); // Parcours la liste d'objet des tanieres et affiche une option si l'objet correspond au critère de recherche foreach ($dom->getElementsByTagName("Element") as $item) { if (preg_match("#.*" . $_POST["nom"] . ".*" . $_POST["template"] . ".*" . $_POST["mithril"] . "#i", stripslashes($item->nodeValue))) { echo htmlOptionEquipements($_POST["idTroll"], $item, $_POST["type"]); } }