public function generatePlanning() { $this->supprimerCreneau(); $this->connexion(); $statement = $this->connexion->prepare("DELETE FROM creneau;"); $statement->execute(); $arrayNbCreneaux = $this->getNbCreneaux(); $creneauMatin = $arrayNbCreneaux[0]; $creneauAprem = $arrayNbCreneaux[1]; $nbCreneaux = $creneauMatin + $creneauAprem; $listeDepartement = array("LP IDEB", " LP SEICOM", "DUT GEII", "LP I2P", "LP EAS", "DUT GMP", "LP IMOC", "LP D2M", "DUT SGM", "LP SIL", "DUT INFO", "LP FICA", "LP LOGIQUAL", "DUT QLIO en 2 ans", "DUT QLIO en 1 an", "DCG"); foreach ($listeDepartement as $departement) { $Etudiants = array(); $Choix = array(); $Entreprises = array(); $Creneaux = array(); $LiensEntrCren = array(); $Formations = array(); $listeEtu = $this->getEtudiants($departement); //On s'occupe de $Etudiants $cmp = 0; foreach ($listeEtu as $etu) { $Etudiants[$cmp + 1] = $etu["IDEtu"]; $Choix[] = explode(",", $etu["listeChoixEtu"]); $cmp++; } //On s'occupe de $Entreprises, $Creneaux et $LiensEntrCren $listeEnt = $this->getEntreprises(); foreach ($listeEnt as $ent) { $Entreprises[] = $ent["IDEnt"]; } $listeFormation = $this->getFormations($departement); foreach ($Entreprises as $IDent) { $LiensEntrCren[$IDent][0] = 0; } $cmp = 0; foreach ($listeFormation as $form) { $tmp = array(); $Formations[] = $form["IDformation"]; $LiensEntrCren[$form["entPropose"]][0]++; $LiensEntrCren[$form["entPropose"]][$LiensEntrCren[$form["entPropose"]][0]] = $cmp; for ($i = 0; $i < $nbCreneaux; $i++) { $tmp[] = 0; } for ($i = $form["creneauDebut"] - 1; $i <= $form["creneauFin"]; $i++) { $tmp[$i] = 1; } $Creneaux[] = $tmp; $cmp++; } $jobMeeting = new jobMeeting($Etudiants, $Choix, $Entreprises, $Creneaux, $LiensEntrCren, $Formations, $nbCreneaux); $jobMeeting->appli(); } $this->deconnexion(); }
$tmp = array(); switch ($form["disponibilite"]) { case 'matin': for ($i = 0; $i < $creneauMatin; $i++) { $tmp[] = 1; } for ($i = 0; $i < $creneauAprem; $i++) { $tmp[] = 0; } break; case 'apres_midi': for ($i = 0; $i < $creneauMatin; $i++) { $tmp[] = 0; } for ($i = 0; $i < $creneauAprem; $i++) { $tmp[] = 1; } break; //Journee //Journee default: for ($i = 0; $i < $nbCreneaux; $i++) { $tmp[] = 1; } break; } $Creneaux[] = $tmp; $cmp++; } $jobMeeting = new jobMeeting($Etudiants, $Choix, $Entreprises, $Creneaux, $LiensEntrCren, $Formations, $nbCreneaux); $jobMeeting->appli();