function selectDbMicheline($id_objet_depart, $id_objet_arrivee, $type_objet_depart, $type_objet_arrivee) { global $db_vue_rm; $id_objet = $id_objet_depart; $type_objet = $type_objet_depart; for ($i = 0; $i <= 1; $i++) { if ($i == 1) { $id_objet = $id_objet_arrivee; $type_objet = $type_objet_arrivee; $x1 = $x; $y1 = $y; $z1 = $z; $nom1 = $nom; } switch ($type_objet) { case "troll": $res = selectDbTrolls($id_objet); $res = $res[1]; if (!userIsGroupSpec() && $res[maj_groupe_spec_troll] == 'oui') { $res[x_troll] = 0; $res[y_troll] = 0; $res[z_troll] = 0; } $x = $res[x_troll]; $y = $res[y_troll]; $z = $res[z_troll]; $nom = $res[nom_troll]; break; case "monstre": $res = selectDbRechercheMonstres($id_objet); $x = $res[x_monstre]; $y = $res[y_monstre]; $z = $res[z_monstre]; $nom = $res[nom_monstre]; break; case "lieux": $res = selectDbLieux($id_objet); $x = $res[x_lieu]; $y = $res[y_lieu]; $z = $res[z_lieu]; $nom = $res[nom_lieu]; break; case "champignons": $res = selectDbRechercheChampignons($id_objet); $x = $res[x_champi]; $y = $res[y_champi]; $z = $res[z_champi]; $nom = $res[nom_champi]; break; } } $tab[0]['x'] = $x1; $tab[0]['y'] = $y1; $tab[0]['z'] = $z1; $tab[0]['nom'] = $nom1; $tab[1]['x'] = $x; $tab[1]['y'] = $y; $tab[1]['z'] = $z; $tab[1]['nom'] = $nom; return $tab; }
function afficherRechercheChampignonsResultat($id_champi, $nom_champi, $x_champi, $y_champi, $z_champi, $limite, $is_seen_champi, $lesChampignons = "") { if (!isset($lesChampignons)) { $lesChampignons = selectDbRechercheChampignons($id_champi, $nom_champi, $x_champi, $y_champi, $z_champi, $limite, $is_seen_champi); } $nbChampignons = count($lesChampignons); usort($lesChampignons, "callbackSortDistancePa"); ?> <br> <table border='0' cellpadding='0' cellspacing='2' class='mh_tdborder' align='center'width='100%'> <tr class='mh_tdtitre'> <td align='center' colspan='15'> <?php echo "Résultat de la recherche sur les Champignons: {$nbChampignons} trouvé(s). Position départ : "; echo " X={$x_champi}/Y={$y_champi}/Z={$z_champi}"; ?> </td> </tr> <?php if ($nbChampignons == 0) { echo "</table>"; return; } echo "<tr class='mh_tdtitre'>"; echo "<td>Distance</td>"; echo "<td>Nom</td>"; echo "<td colspan=3>Position</td>"; echo "<td>Vu </td>"; echo "<td>Date de Mise à jour </td>"; echo "<td> </td>"; for ($i = 1; $i <= $nbChampignons; $i++) { $res = $lesChampignons[$i]; echo "<tr class='mh_tdpage'>"; if (is_numeric($x_champi) && is_numeric($y_champi) && is_numeric($z_champi)) { echo "<td width='1%'>{$res['distance_pa']}</td>"; } echo "<td>" . htmlentities($res[nom_champi]) . " ({$res['nombre_champi']})</td>"; echo "<td width=10>X={$res['x_champi']}</td>"; echo "<td width=10>Y={$res['y_champi']}</td>"; echo "<td width=40>N={$res['z_champi']}</td>"; echo "<td width=40>N={$res['is_seen_champi']}</td>"; echo "<td>{$res['date_champi']}</td>"; $lien_vue2d = "href='cockpit.php?cX={$res['x_champi']}&cY={$res['y_champi']}&cZ={$res['z_champi']}'"; $lien_gps_adv = "href='gps_advanced.php?taille_map=600&vue=40&x={$res['x_champi']}&y={$res['y_champi']}'"; echo "<td>accès : <a {$lien_vue2d}>vue 2d</a>,<a {$lien_gps_adv}> GPS</a></td>"; echo "</tr>"; if ($i > 99) { echo "</tr><tr><td colspan=10>Il n'y a que les 100 premiers résultats d'affichés, affinez votre recherche si vous voulez...</td></tr>"; break; } } echo "</table>"; }
function recherche_champi($val) { $s = split(",", $val); $x_champi = $this->troll->get_x_troll(); $y_champi = $this->troll->get_y_troll(); $z_champi = $this->troll->get_z_troll(); for ($i = 0; $i <= count($s); $i++) { if (preg_match("/vue=/", $s[$i])) { // vue : oui, non $r = split("=", $s[$i]); // $r[1] $is_seen_champi = $r[1]; } else { if (!is_numeric($s[0]) && $i == 0) { // nom du champi $nom_champi = $s[0]; } elseif (is_numeric($s[$i])) { // position $x_champi = $s[$i]; $y_champi = $s[$i + 1]; $z_champi = $s[$i + 2]; break; } } } if ($is_seen_champi == "") { $is_seen_champi = "oui"; } $lesChampignons = selectDbRechercheChampignons($id_champi, $nom_champi, $x_champi, $y_champi, $z_champi, $limite, $is_seen_champi); afficherRechercheChampignonsResultat($id_champi, $nom_champi, $x_champi, $y_champi, $z_champi, $limite, $is_seen_champi, $lesChampignons); }