diff --git a/admin.php b/admin.php index c2990d9..49290fc 100644 --- a/admin.php +++ b/admin.php @@ -76,6 +76,7 @@ $match_types = array( "4" => "Petite finale", "5" => "Huitième de finale", "6" => "Seizième de finale", + "7" => "Poules 2", ); ?> diff --git a/score.php b/score.php index 456595b..bbcf838 100644 --- a/score.php +++ b/score.php @@ -18,9 +18,11 @@ } $allteams = $db->getTeams(); - $teams_poules = array(); + $teams_poules1 = array(); + $teams_poules2 = array(); - $matchs_poules = array(); + $matchs_poules1 = array(); + $matchs_poules2 = array(); $matchs_eight = array(); $matchs_quarters = array(); $matchs_semis = array(); @@ -103,7 +105,7 @@ if(strtolower($match["sport_name"]) == strtolower($sport)){ switch($match["type"]){ case 0: - array_push($matchs_poules, $match); + array_push($matchs_poules1, $match); break; case 1: array_push($matchs_final, $match); @@ -117,6 +119,9 @@ case 4: array_push($matchs_little_final, $match); break; + case 7: + array_push($matchs_poules2, $match); + break; default: break; } @@ -125,14 +130,23 @@ } foreach($allteams as $team){ - $found = false; - foreach($matchs_poules as $match){ + $found1 = false; + $found2 = false; + foreach($matchs_poules1 as $match){ if(json_decode($match["teams_id"])[0] == $team["id"] || json_decode($match["teams_id"])[1] == $team["id"]){ - $found = true; + $found1 = true; } } - if($found){ - array_push($teams_poules, $team); + foreach($matchs_poules2 as $match){ + if(json_decode($match["teams_id"])[0] == $team["id"] || json_decode($match["teams_id"])[1] == $team["id"]){ + $found2 = true; + } + } + if($found1){ + array_push($teams_poules1, $team); + } + if($found2){ + array_push($teams_poules2, $team); } } ?> @@ -861,9 +875,9 @@ - + ".$team["name"].""; } ?> @@ -873,18 +887,70 @@ "; echo ""; - foreach($teams_poules as $team2){ + foreach($teams_poules1 as $team2){ echo ""; + } + echo ""; + $i++; + } + ?> + +
Poule A ".$team["name"].""; if($team2 != $team){ $found = false; - foreach($matchs_poules as $match){ + foreach($matchs_poules1 as $match){ + if(json_decode($match["teams_id"])[1] == $team["id"] && json_decode($match["teams_id"])[0] == $team2["id"]){ + echo json_decode($match["scores"])[1]." - ".json_decode($match["scores"])[0]; + $found = true; + } + if(json_decode($match["teams_id"])[0] == $team["id"] && json_decode($match["teams_id"])[1] == $team2["id"]){ + echo json_decode($match["scores"])[0]." - ".json_decode($match["scores"])[1]; + $found = true; + } + } + if(!$found){ + echo "-"; + } + } + else{ + echo "X"; + } + echo "
+ + + + + + ".$team["name"].""; + } + ?> + + + + + "; + echo ""; + foreach($teams_poules2 as $team2){ + echo "
Poule B
".$team["name"].""; + if($team2 != $team){ + $found = false; + foreach($matchs_poules2 as $match){ if(json_decode($match["teams_id"])[1] == $team["id"] && json_decode($match["teams_id"])[0] == $team2["id"]){ echo json_decode($match["scores"])[1]." - ".json_decode($match["scores"])[0]; $found = true; diff --git a/sql/data.sql b/sql/data.sql index c1c8ee2..4b9c18b 100644 --- a/sql/data.sql +++ b/sql/data.sql @@ -64,58 +64,58 @@ INSERT INTO teams ("id", "name") VALUES ALTER SEQUENCE matches_id_seq RESTART; INSERT INTO matches ("id", "sport_id", "type", "date") VALUES ('1', '6', '0', '2022-10-17T19:10'), -('2', '6', '0', '2022-10-17T19:19'), +('2', '6', '7', '2022-10-17T19:19'), ('3', '6', '0', '2022-10-17T19:28'), -('4', '6', '0', '2022-10-17T19:37'), +('4', '6', '7', '2022-10-17T19:37'), ('5', '6', '0', '2022-10-17T19:46'), -('6', '6', '0', '2022-10-17T19:55'), +('6', '6', '7', '2022-10-17T19:55'), ('7', '6', '0', '2022-10-17T20:04'), -('8', '6', '0', '2022-10-17T20:13'), +('8', '6', '7', '2022-10-17T20:13'), ('9', '6', '0', '2022-10-17T20:22'), -('10', '6', '0', '2022-10-17T20:31'), +('10', '6', '7', '2022-10-17T20:31'), ('11', '6', '0', '2022-10-17T20:40'), -('12', '6', '0', '2022-10-17T20:49'), +('12', '6', '7', '2022-10-17T20:49'), ('13', '6', '0', '2022-10-17T20:58'), -('14', '6', '0', '2022-10-17T21:07'), +('14', '6', '7', '2022-10-17T21:07'), ('15', '6', '0', '2022-10-17T21:16'), -('16', '6', '0', '2022-10-17T21:25'), +('16', '6', '7', '2022-10-17T21:25'), ('17', '6', '0', '2022-10-17T21:34'), -('18', '6', '0', '2022-10-17T21:43'), +('18', '6', '7', '2022-10-17T21:43'), ('19', '6', '0', '2022-10-17T21:52'), -('20', '6', '0', '2022-10-17T22:01'), +('20', '6', '7', '2022-10-17T22:01'), -('21', '1', '0', '2022-10-17T22:15'), +('21', '1', '7', '2022-10-17T22:15'), ('22', '1', '0', '2022-10-17T22:28'), -('23', '1', '0', '2022-10-17T22:40'), +('23', '1', '7', '2022-10-17T22:40'), ('24', '1', '0', '2022-10-17T22:52'), -('25', '1', '0', '2022-10-18T18:25'), +('25', '1', '7', '2022-10-18T18:25'), ('26', '1', '0', '2022-10-18T18:36'), ('27', '1', '0', '2022-10-18T18:47'), ('28', '1', '0', '2022-10-18T18:58'), ('29', '1', '0', '2022-10-18T19:09'), ('30', '2', '0', '2022-10-18T19:50'), -('31', '2', '0', '2022-10-18T20:02'), +('31', '2', '7', '2022-10-18T20:02'), ('32', '2', '0', '2022-10-18T20:14'), -('33', '2', '0', '2022-10-18T20:26'), +('33', '2', '7', '2022-10-18T20:26'), ('34', '2', '0', '2022-10-18T20:38'), -('35', '2', '0', '2022-10-18T20:50'), +('35', '2', '7', '2022-10-18T20:50'), ('36', '2', '0', '2022-10-18T21:02'), ('37', '2', '0', '2022-10-18T21:14'), ('38', '2', '0', '2022-10-18T21:26'), ('39', '5', '0', '2022-10-18T22:14'), -('40', '5', '0', '2022-10-18T22:14'), +('40', '5', '7', '2022-10-18T22:14'), ('41', '5', '0', '2022-10-18T22:26'), -('42', '5', '0', '2022-10-18T22:26'), +('42', '5', '7', '2022-10-18T22:26'), ('43', '5', '0', '2022-10-18T22:38'), -('44', '5', '0', '2022-10-18T22:38'), +('44', '5', '7', '2022-10-18T22:38'), ('45', '5', '0', '2022-10-18T22:50'), -('46', '5', '0', '2022-10-18T22:50'), +('46', '5', '7', '2022-10-18T22:50'), ('47', '5', '0', '2022-10-18T23:02'), -('48', '5', '0', '2022-10-18T23:02'), +('48', '5', '7', '2022-10-18T23:02'), ('49', '5', '0', '2022-10-18T23:14'), -('50', '5', '0', '2022-10-18T23:14'), +('50', '5', '7', '2022-10-18T23:14'), ('51', '3', '6', '2022-10-17T18:25'), ('52', '3', '6', '2022-10-17T18:25'), @@ -129,7 +129,7 @@ INSERT INTO matches ("id", "sport_id", "type", "date") VALUES -- Populate participations table ALTER SEQUENCE participations_id_seq RESTART; INSERT INTO participations ("match_id", "team_id") VALUES -('1', '2'), +('1', '3'), ('1', '12'), ('2', '24'), ('2', '28'),