Passed
Branch master (ef3387)
by Anthony
09:36
created
modules/bataille/app/views/js/construire_batiment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,4 +48,4 @@
 block discarded – undo
48 48
 			});
49 49
 		}
50 50
 	</script>
51
-<?php endif;?>
52 51
\ No newline at end of file
52
+<?php endif; ?>
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
modules/bataille/app/views/aide-detail.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php require_once("nav.php");?>
1
+<?php require_once("nav.php"); ?>
2 2
 
3 3
 <h1>Aide sur les <?=\modules\bataille\app\controller\Aide::$batiment?> de type <?=\modules\bataille\app\controller\Aide::$parametre_router?></h1>
4 4
 
5
-<?php for ($i=0 ; $i<$count ; $i++):?>
5
+<?php for ($i = 0; $i < $count; $i++):?>
6 6
 	<div>
7 7
 		<h3><?=$aide->getNomBatiment()[$i]?></h3>
8 8
 		
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 
17 17
 		<?php if (count($aide->getNomBatimentConstruire()[$i]) > 0) :?>
18 18
 			<h4>Batiments nécéssaires pour le premier niveau</h4>
19
-		<?php endif;?>
19
+		<?php endif; ?>
20 20
 
21 21
 		<?php if (count($aide->getNomBatimentConstruire()[$i]) > 1) :?>
22
-			<?php for($x=0 ; $x<count($aide->getNomBatimentConstruire()[$i]) ; $x++): ?>
22
+			<?php for ($x = 0; $x < count($aide->getNomBatimentConstruire()[$i]); $x++): ?>
23 23
 				<ul>
24 24
 					<li>Nom du batiment : <?=$aide->getNomBatimentConstruire()[$i][$x][0]?></li>
25 25
 					<li>Niveau du batiment : <?=$aide->getNiveauBatimentConstruire()[$i][$x][0]?></li>
26 26
 				</ul>
27
-			<?php endfor;?>
27
+			<?php endfor; ?>
28 28
 		<?php else: ?>
29
-			<?php for ($j=0 ; $j<count($aide->getNomBatimentConstruire()[$i]) ; $j++): ?>
29
+			<?php for ($j = 0; $j < count($aide->getNomBatimentConstruire()[$i]); $j++): ?>
30 30
 				<ul>
31 31
 					<li>Nom du batiment : <?=$aide->getNomBatimentConstruire()[$j]?></li>
32 32
 					<li>Niveau du batiment : <?=$aide->getNiveauBatimentConstruire()[$j]?></li>
33 33
 				</ul>
34
-			<?php endfor;?>
35
-		<?php endif;?>
34
+			<?php endfor; ?>
35
+		<?php endif; ?>
36 36
 	</div>
37
-<?php endfor;?>
37
+<?php endfor; ?>
Please login to merge, or discard this patch.
modules/bataille/app/views/aide.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php require_once("nav.php");?>
1
+<?php require_once("nav.php"); ?>
2 2
 
3 3
 <h1>Bienvenue sur la page d'aide</h1>
4 4
 
Please login to merge, or discard this patch.
modules/bataille/app/views/popup_listebatiments.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 <!--<p>Si vous supprimez ce module, tous les contenus, images qui y sont associés seront supprimés<br/></p>
3 3
 <p class="attention">Cette action est irréverssible !</p>-->
4 4
 
5
-<?php for ($i=0 ; $i<$all_batiment ; $i++):?>
5
+<?php for ($i = 0; $i < $all_batiment; $i++):?>
6 6
 	<div>
7 7
 		<p><?=$batiments[$i][1]?></p>
8 8
 		<ul>
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		<a nom_batiment="<?=$batiments[$i][1]?>" emplacement="<?=$_POST['emplacement']?>" nom_batiment_sql="<?=$batiments[$i][0]?>" class="construire <?=$batiments[$i][2][0][1]?> <?=$batiments[$i][2][1][1]?> <?=$batiments[$i][2][2][1]?> <?=$batiments[$i][2][3][1]?>" href="">Construire le batiment</a>
16 16
 		<hr>
17 17
 	</div>
18
-<?php endfor;?>
18
+<?php endfor; ?>
19 19
 
20 20
 
21
-<?php require_once(MODULEROOT."bataille/app/views/js/construire_batiment.php");?>
22 21
\ No newline at end of file
22
+<?php require_once(MODULEROOT."bataille/app/views/js/construire_batiment.php"); ?>
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
modules/bataille/app/views/popup_unbatiment.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 <h3>Niveau : <?=Bataille::getBatiment()->getNiveau()?></h3>
4 4
 
5 5
 <hr>
6
-<?php if ($max_level == false){?>
6
+<?php if ($max_level == false) {?>
7 7
 <h2>Cout pour le prochain niveau</h2>
8
-<h3>Niveau suivant : <?=Bataille::getBatiment()->getNiveau()+1?></h3>
8
+<h3>Niveau suivant : <?=Bataille::getBatiment()->getNiveau() + 1?></h3>
9 9
 <ul>
10 10
 	<li class="<?=Bataille::getBatiment()->getRessourceConstruire()[0][1]?>">fer : <?=Bataille::getBatiment()->getRessourceConstruire()[0][0]?></li>
11 11
 	<li class="<?=Bataille::getBatiment()->getRessourceConstruire()[1][1]?>">fuel :<?=Bataille::getBatiment()->getRessourceConstruire()[1][0]?></li>
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 <p>L'addon permet d'améliorer la production de ce bâtiment !</p>
34 34
 
35 35
 <h2>Cout pour le prochain niveau</h2>
36
-<h3>Niveau suivant : <?=Bataille::getBatiment()->getNiveau()+1?></h3>
36
+<h3>Niveau suivant : <?=Bataille::getBatiment()->getNiveau() + 1?></h3>
37 37
 <ul>
38 38
 	<li class="<?=Bataille::getBatiment()->getRessourceConstruire()[0][1]?>">fer : <?=Bataille::getBatiment()->getRessourceConstruire()[0][0]?></li>
39 39
 	<li class="<?=Bataille::getBatiment()->getRessourceConstruire()[1][1]?>">fuel :<?=Bataille::getBatiment()->getRessourceConstruire()[1][0]?></li>
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 <h4><?=Bataille::getBatiment()->getInfoBatiment()?></h4>
46 46
 
47
-<a nom_batiment="<?=$_POST['nom_batiment']. " addon"?>"
47
+<a nom_batiment="<?=$_POST['nom_batiment']." addon"?>"
48 48
    emplacement="<?=$_POST['emplacement']?>"
49 49
    nom_batiment_sql="<?=Bataille::getBatiment()->getNomBatimentSql()?>"
50 50
    class="construire <?=Bataille::getBatiment()->getRessourceConstruire()[0][1]?>
@@ -57,4 +57,4 @@  discard block
 block discarded – undo
57 57
 <!-- partie quand le batiment est au lvl max -->
58 58
 <p>Le batiment a atteint son niveau maxiumum</p>
59 59
 <?php }?>
60
-<?php require_once(MODULEROOT."bataille/app/views/js/construire_batiment.php");?>
61 60
\ No newline at end of file
61
+<?php require_once(MODULEROOT."bataille/app/views/js/construire_batiment.php"); ?>
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
modules/bataille/app/controller/Bataille.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
 		public static function getTestAssezRessourceBase($nom_ressource, $ressource) {
121 121
 			$f = "get".ucfirst($nom_ressource);
122 122
 
123
-			if ($ressource >  Bataille::getRessource()->$f()) {
123
+			if ($ressource > Bataille::getRessource()->$f()) {
124 124
 				/*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/
125 125
 				return [$ressource, "rouge"];
126 126
 			}
Please login to merge, or discard this patch.
modules/bataille/app/controller/Base.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 
16 16
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
17
-		public function getBatiments(){
17
+		public function getBatiments() {
18 18
 		    return $this->batiments;
19 19
 		}
20 20
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 			$nombre_emplacement = Bataille::getNombreEmplacementBase();
68 68
 
69
-			for ($i=1 ; $i<($nombre_emplacement+1) ; $i++) {
69
+			for ($i = 1; $i < ($nombre_emplacement + 1); $i++) {
70 70
 				$query = $dbc->select()->from("_bataille_batiment")->where("ID_base", "=", Bataille::getIdBase(), "AND")
71 71
 					->where("emplacement", "=", $i)
72 72
 					->orderBy("emplacement")
Please login to merge, or discard this patch.
modules/bataille/app/controller/Ressource.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			$last_co = new \DateTime($last_co);
86 86
 			$last_co = $last_co->getTimestamp();
87 87
 
88
-			$diff_temps = $today-$last_co;
88
+			$diff_temps = $today - $last_co;
89 89
 
90 90
 			//si la derniere actualisation ou connexion est supérieur à 30 sec
91 91
 			if ($diff_temps > 180) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		private function setAddRessource($nom_ressource, $ressrouce, $diff_temps) {
106 106
 			$dbc = App::getDb();
107 107
 
108
-			$ressource = $ressrouce+(round((Bataille::getBatiment()->getProduction($nom_ressource)/3600)*$diff_temps));
108
+			$ressource = $ressrouce + (round((Bataille::getBatiment()->getProduction($nom_ressource) / 3600) * $diff_temps));
109 109
 			$stockage_max = Bataille::getBatiment()->getStockageEntrepot();
110 110
 
111 111
 			if ($ressource > $stockage_max) {
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 		public function setRetirerRessource($eau, $electricite, $fer, $fuel, $nourriture) {
134 134
 			$dbc = App::getDb();
135 135
 
136
-			$eau = $this->getEau()-$eau;
137
-			$electricite = $this->getElectricite()-$electricite;
138
-			$fer = $this->getFer()-$fer;
139
-			$fuel = $this->getFuel()-$fuel;
140
-			$nourriture = $this->getNourriture()-$nourriture;
136
+			$eau = $this->getEau() - $eau;
137
+			$electricite = $this->getElectricite() - $electricite;
138
+			$fer = $this->getFer() - $fer;
139
+			$fuel = $this->getFuel() - $fuel;
140
+			$nourriture = $this->getNourriture() - $nourriture;
141 141
 
142 142
 
143 143
 			$dbc->update("eau", $eau)
Please login to merge, or discard this patch.
modules/bataille/app/controller/Batiment.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		public function getRessourceConstruire() {
46 46
 			return $this->ressource_construire;
47 47
 		}
48
-		public function getInfoBatiment(){
48
+		public function getInfoBatiment() {
49 49
 		    return $this->info_batiment;
50 50
 		}
51 51
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			if ((is_array($query)) && (count($query) > 0)) {
78 78
 				foreach ($query as $obj) {
79 79
 					if ($obj->construction == 1) {
80
-						return $obj->niveau-1;
80
+						return $obj->niveau - 1;
81 81
 					}
82 82
 
83 83
 					return $obj->niveau;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			if ($niveau > 0) {
146 146
 				$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get();
147 147
 
148
-				if ((is_array($query)) && (count($query) > 0)){
148
+				if ((is_array($query)) && (count($query) > 0)) {
149 149
 					foreach ($query as $obj) {
150 150
 						return $obj->stockage;
151 151
 					}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 				}
184 184
 
185 185
 				if (($construction[1] == true) && ($this->niveau_batiment > 1)) {
186
-					$this->niveau_batiment = $this->niveau_batiment+1;
186
+					$this->niveau_batiment = $this->niveau_batiment + 1;
187 187
 				}
188 188
 
189 189
 				return $this->getInfoUpgradeBatiment();
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 					$id_batiment = $obj->ID_batiment;
259 259
 				}
260 260
 
261
-				if ($this->date_fin_construction-$today <= 0) {
261
+				if ($this->date_fin_construction - $today <= 0) {
262 262
 					$this->setTerminerConstruction($id_batiment);
263 263
 				}
264 264
 				else {
265
-					$this->date_fin_construction = $this->date_fin_construction-$today;
266
-					Bataille::$values = ["date_fin_construction" => $this->date_fin_construction-$today];
265
+					$this->date_fin_construction = $this->date_fin_construction - $today;
266
+					Bataille::$values = ["date_fin_construction" => $this->date_fin_construction - $today];
267 267
 				}
268 268
 
269 269
 				return 1;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			//et compare la liste des batiments qu'il faut pour construire le batiment
311 311
 			//a ceux qui sont deja construit dans la base
312 312
 			//si tous les batments qu'il faut son batis on autorise la construction du batiment
313
-			for ($i=0 ; $i<$c_all_batiment ; $i++) {
313
+			for ($i = 0; $i < $c_all_batiment; $i++) {
314 314
 				if (!in_array($all_batiment[$i], $batiment_construit)) {
315 315
 					$query = $dbc1->select("pour_construire")
316 316
 						->select("temps_construction")
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 		private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) {
376 376
 			$dbc1 = Bataille::getDb();
377 377
 
378
-			$niveau = $niveau+1;
378
+			$niveau = $niveau + 1;
379 379
 
380 380
 			$query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get();
381 381
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 		 */
409 409
 		private function getTestBatimentConstruction($nom_batiment) {
410 410
 			if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) {
411
-				return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true];
411
+				return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true];
412 412
 			}
413 413
 
414 414
 			return [$nom_batiment, false];
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			$dbc1 = Bataille::getDb();
424 424
 
425 425
 			//récupération du temps et des ressources pour construire
426
-			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get();
426
+			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get();
427 427
 
428 428
 			//si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment
429 429
 			if ((is_array($query)) && (count($query) > 0)) {
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 
435 435
 				//récupération des éléments particulier à un batiment
436 436
 				if ($this->nom_batiment_sql == "entrepot") {
437
-					$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get();
437
+					$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get();
438 438
 
439
-					if ((is_array($query)) && (count($query) > 0)){
439
+					if ((is_array($query)) && (count($query) > 0)) {
440 440
 						foreach ($query as $obj) {
441
-							$this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage;
441
+							$this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage;
442 442
 						}
443 443
 					}
444 444
 				}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 					$query = $dbc1->select("ressource_construire")
494 494
 						->select("temps_construction")
495 495
 						->from($this->nom_batiment_sql)
496
-						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)
496
+						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)
497 497
 						->get();
498 498
 
499 499
 					foreach ($query as $obj) {
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 
504 504
 					//on insere la construction dans la table batiment si new batiment
505 505
 					if ($un_batiment == 0) {
506
-						$dbc->insert("niveau", $this->niveau_batiment+1)
506
+						$dbc->insert("niveau", $this->niveau_batiment + 1)
507 507
 							->insert("emplacement", $emplacement)
508 508
 							->insert("nom_batiment", $nom_batiment)
509 509
 							->insert("nom_batiment_sql", $this->nom_batiment_sql)
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 						$this->id_batiment = $dbc->lastInsertId();
516 516
 					}
517 517
 					else {
518
-						$dbc->update("niveau", $this->niveau_batiment+1)
518
+						$dbc->update("niveau", $this->niveau_batiment + 1)
519 519
 							->update("construction", 1)
520 520
 							->from("_bataille_batiment")
521 521
 							->where("ID_batiment", "=", $this->id_batiment, "AND")
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 					$today = $today->getTimestamp();
531 531
 
532 532
 					//date de la fin de la construction en seconde
533
-					$fin_construction = $today+$temps_construction;
533
+					$fin_construction = $today + $temps_construction;
534 534
 
535 535
 					$dbc->insert("date_fin", $fin_construction)
536 536
 						->insert("emplacement_construction", $emplacement)
Please login to merge, or discard this patch.