function validerSaisieEchantillons(&$choixMedicament, &$qteOfferte) { $valid = array("choixMedicament" => 1, "qteOfferte" => 1); if (is_null($choixMedicament) || is_null($qteOfferte)) { $valid["choixMedicament"] = 0; $valid["qteOfferte"] = 0; } else { if (!is_array(GsbModele::getLeMedicamentDetails($choixMedicament))) { $valid["choixMedicament"] = 0; } if (intval($qteOfferte) != $qteOfferte) { $valid["qteOfferte"] = 0; } else { if ($qteOfferte <= 0 || $qteOfferte > 500) { $valid["qteOfferte"] = 0; } } } return $valid; }
case "liste": Vue::$title = "Consulter les médicaments"; Vue::configToDataTable("DataTableMedicaments"); $lesMedicaments = GsbModele::getLesMedicaments(); $lesMedicamentsSontVide = count($lesMedicaments) == 0; Controleur::composeVue("vues/medicament/liste.php"); break; case "details": $lesMedicaments = GsbModele::getLesMedicaments(); $lesMedicamentsSontVide = count($lesMedicaments) == 0; $leMedicament = null; $leMedicamentDepot = null; $leMedicamentPrecedant = null; $leMedicamentSuivant = null; if (isset($_GET["depot"])) { $leMedicament = GsbModele::getLeMedicamentDetails($_GET["depot"]); if ($leMedicament && $lesMedicaments) { $leMedicamentDepot = $leMedicament["MED_DEPOTLEGAL"]; $lesMedicamentsTaille = count($lesMedicaments); for ($i = 0; $i < $lesMedicamentsTaille; $i++) { if ($leMedicament["MED_DEPOTLEGAL"] == $lesMedicaments[$i]["MED_DEPOTLEGAL"]) { if ($i > 0) { $leMedicamentPrecedant = $lesMedicaments[$i - 1]; } if ($i + 1 < $lesMedicamentsTaille) { $leMedicamentSuivant = $lesMedicaments[$i + 1]; } break; // Arrète le FOR } }