@@ -3,7 +3,6 @@ |
||
| 3 | 3 | use core\App; |
| 4 | 4 | use core\functions\ChaineCaractere; |
| 5 | 5 | use core\HTML\flashmessage\FlashMessage; |
| 6 | - use Nette\Utils\DateTime; |
|
| 7 | 6 | |
| 8 | 7 | class Batiment { |
| 9 | 8 | //pour quand on recup un batiment |
@@ -122,8 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | if ($id_base === null) { |
| 124 | 124 | $query = $dbc->select()->from("_bataille_last_connexion")->where("ID_identite", "=", self::getIdIdentite())->get(); |
| 125 | - } |
|
| 126 | - else { |
|
| 125 | + } else { |
|
| 127 | 126 | $query = $dbc->select("_bataille_last_connexion.last_connexion")->from("_bataille_base") |
| 128 | 127 | ->from("_bataille_last_connexion") |
| 129 | 128 | ->from("identite") |
@@ -242,7 +241,9 @@ discard block |
||
| 242 | 241 | ->get(); |
| 243 | 242 | |
| 244 | 243 | if ((is_array($query)) && (count($query) == 1)) { |
| 245 | - foreach ($query as $obj) return $obj->ID_base; |
|
| 244 | + foreach ($query as $obj) { |
|
| 245 | + return $obj->ID_base; |
|
| 246 | + } |
|
| 246 | 247 | } |
| 247 | 248 | |
| 248 | 249 | return 0; |
@@ -260,11 +261,12 @@ discard block |
||
| 260 | 261 | |
| 261 | 262 | if ($id_base === null) { |
| 262 | 263 | $id_identite = self::getIdIdentite(); |
| 263 | - } |
|
| 264 | - else { |
|
| 264 | + } else { |
|
| 265 | 265 | $query = $dbc->select("ID_identite")->from("_bataille_base")->where("ID_base", "=", $id_base)->get(); |
| 266 | 266 | |
| 267 | - foreach ($query as $obj) $id_identite = $obj->ID_identite; |
|
| 267 | + foreach ($query as $obj) { |
|
| 268 | + $id_identite = $obj->ID_identite; |
|
| 269 | + } |
|
| 268 | 270 | } |
| 269 | 271 | |
| 270 | 272 | $dbc->update("last_connexion", date("Y-m-d H:i:s")) |
@@ -1,4 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | - $marche = new \modules\bataille\app\controller\Marche(); |
|
| 2 | + $marche = new \modules\bataille\app\controller\Marche(); |
|
| 3 | 3 | |
| 4 | 4 | $marche->setCommencerTransport($_POST['eau'], $_POST['electricite'], $_POST['fer'], $_POST['fuel'], $_POST['nourriture'], $_POST['posx'], $_POST['posy']); |
| 5 | 5 | \ No newline at end of file |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | echo $this->date_arrivee."<br>"; |
| 59 | 59 | |
| 60 | 60 | //on test si déja arrivé à destination |
| 61 | - if (($this->aller == 1) && (($this->date_arrivee-$today) <= 0)) { |
|
| 61 | + if (($this->aller == 1) && (($this->date_arrivee - $today) <= 0)) { |
|
| 62 | 62 | $this->setLivrerRessource(); |
| 63 | 63 | |
| 64 | 64 | //on calcul la date d'arrivée du retour |
| 65 | - $date_retour = Bataille::getDureeTrajet($this->id_base_dest)+$this->date_arrivee; |
|
| 65 | + $date_retour = Bataille::getDureeTrajet($this->id_base_dest) + $this->date_arrivee; |
|
| 66 | 66 | |
| 67 | 67 | //si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour |
| 68 | 68 | if ($date_retour < $today) { |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | else { |
| 72 | 72 | $this->setTrajetRetour($date_retour); |
| 73 | - $this->duree_restante_trajet = $date_retour-$today; |
|
| 73 | + $this->duree_restante_trajet = $date_retour - $today; |
|
| 74 | 74 | $set_array = true; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | - else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) { |
|
| 77 | + else if (($this->aller == 0) && (($this->date_arrivee - $today) <= 0)) { |
|
| 78 | 78 | $this->setTerminerTransport(); |
| 79 | 79 | } |
| 80 | 80 | else { |
| 81 | - $this->duree_restante_trajet = $this->date_arrivee-$today; |
|
| 81 | + $this->duree_restante_trajet = $this->date_arrivee - $today; |
|
| 82 | 82 | $set_array = true; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | //si pas assez de ressources dispo dans la base pour l'envoi on renvoi erreur |
| 156 | 156 | foreach ($ressource as $tab) { |
| 157 | - if (in_array("rouge", $tab)) {echo $posy;echo $posx; |
|
| 157 | + if (in_array("rouge", $tab)) {echo $posy; echo $posx; |
|
| 158 | 158 | FlashMessage::setFlash("Vous n'avez pas autant de ressources disponibles à l'envoi"); |
| 159 | 159 | return false; |
| 160 | 160 | }; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | //sinon initialise le transport |
| 164 | 164 | //on recup la date d'arrivee dans la base de destintation |
| 165 | - $date_arrivee = Bataille::getDureeTrajet($id_base_dest)+Bataille::getToday(); |
|
| 165 | + $date_arrivee = Bataille::getDureeTrajet($id_base_dest) + Bataille::getToday(); |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | echo("<pre>"); |