separate group phases in 2 groups

This commit is contained in:
Vazelek
2022-10-17 15:37:56 +02:00
committed by Vazelek
parent c5b0bf8951
commit 1cf581553f
3 changed files with 103 additions and 36 deletions

View File

@@ -76,6 +76,7 @@ $match_types = array(
"4" => "Petite finale", "4" => "Petite finale",
"5" => "Huitième de finale", "5" => "Huitième de finale",
"6" => "Seizième de finale", "6" => "Seizième de finale",
"7" => "Poules 2",
); );
?> ?>

View File

@@ -18,9 +18,11 @@
} }
$allteams = $db->getTeams(); $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_eight = array();
$matchs_quarters = array(); $matchs_quarters = array();
$matchs_semis = array(); $matchs_semis = array();
@@ -103,7 +105,7 @@
if(strtolower($match["sport_name"]) == strtolower($sport)){ if(strtolower($match["sport_name"]) == strtolower($sport)){
switch($match["type"]){ switch($match["type"]){
case 0: case 0:
array_push($matchs_poules, $match); array_push($matchs_poules1, $match);
break; break;
case 1: case 1:
array_push($matchs_final, $match); array_push($matchs_final, $match);
@@ -117,6 +119,9 @@
case 4: case 4:
array_push($matchs_little_final, $match); array_push($matchs_little_final, $match);
break; break;
case 7:
array_push($matchs_poules2, $match);
break;
default: default:
break; break;
} }
@@ -125,14 +130,23 @@
} }
foreach($allteams as $team){ foreach($allteams as $team){
$found = false; $found1 = false;
foreach($matchs_poules as $match){ $found2 = false;
foreach($matchs_poules1 as $match){
if(json_decode($match["teams_id"])[0] == $team["id"] || json_decode($match["teams_id"])[1] == $team["id"]){ if(json_decode($match["teams_id"])[0] == $team["id"] || json_decode($match["teams_id"])[1] == $team["id"]){
$found = true; $found1 = true;
} }
} }
if($found){ foreach($matchs_poules2 as $match){
array_push($teams_poules, $team); 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 @@
<table class="color-main"> <table class="color-main">
<thead> <thead>
<tr class="bgcolor-tableprimary"> <tr class="bgcolor-tableprimary">
<th class="bordercolor-main bold"></th> <th class="bordercolor-main bold">Poule A</th>
<?php <?php
foreach ($teams_poules as $team) { foreach ($teams_poules1 as $team) {
echo "<th class=\"bordercolor-main\">".$team["name"]."</th>"; echo "<th class=\"bordercolor-main\">".$team["name"]."</th>";
} }
?> ?>
@@ -873,18 +887,70 @@
<?php <?php
$i = 0; $i = 0;
foreach ($teams_poules as $team) { foreach ($teams_poules1 as $team) {
$color = "primary"; $color = "primary";
if($i%2 == 0){ if($i%2 == 0){
$color = "secondary"; $color = "secondary";
} }
echo "<tr class=\"bgcolor-table".$color."\">"; echo "<tr class=\"bgcolor-table".$color."\">";
echo "<td class=\"bordercolor-main bold\">".$team["name"]."</td>"; echo "<td class=\"bordercolor-main bold\">".$team["name"]."</td>";
foreach($teams_poules as $team2){ foreach($teams_poules1 as $team2){
echo "<td class=\"bordercolor-main\">"; echo "<td class=\"bordercolor-main\">";
if($team2 != $team){ if($team2 != $team){
$found = false; $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 "</td>";
}
echo "</tr>";
$i++;
}
?>
</tbody>
</table>
<table class="color-main">
<thead>
<tr class="bgcolor-tableprimary">
<th class="bordercolor-main bold">Poule B</th>
<?php
foreach ($teams_poules2 as $team) {
echo "<th class=\"bordercolor-main\">".$team["name"]."</th>";
}
?>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($teams_poules2 as $team) {
$color = "primary";
if($i%2 == 0){
$color = "secondary";
}
echo "<tr class=\"bgcolor-table".$color."\">";
echo "<td class=\"bordercolor-main bold\">".$team["name"]."</td>";
foreach($teams_poules2 as $team2){
echo "<td class=\"bordercolor-main\">";
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"]){ 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]; echo json_decode($match["scores"])[1]." - ".json_decode($match["scores"])[0];
$found = true; $found = true;

View File

@@ -64,58 +64,58 @@ INSERT INTO teams ("id", "name") VALUES
ALTER SEQUENCE matches_id_seq RESTART; ALTER SEQUENCE matches_id_seq RESTART;
INSERT INTO matches ("id", "sport_id", "type", "date") VALUES INSERT INTO matches ("id", "sport_id", "type", "date") VALUES
('1', '6', '0', '2022-10-17T19:10'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('26', '1', '0', '2022-10-18T18:36'),
('27', '1', '0', '2022-10-18T18:47'), ('27', '1', '0', '2022-10-18T18:47'),
('28', '1', '0', '2022-10-18T18:58'), ('28', '1', '0', '2022-10-18T18:58'),
('29', '1', '0', '2022-10-18T19:09'), ('29', '1', '0', '2022-10-18T19:09'),
('30', '2', '0', '2022-10-18T19:50'), ('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'), ('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'), ('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'), ('36', '2', '0', '2022-10-18T21:02'),
('37', '2', '0', '2022-10-18T21:14'), ('37', '2', '0', '2022-10-18T21:14'),
('38', '2', '0', '2022-10-18T21:26'), ('38', '2', '0', '2022-10-18T21:26'),
('39', '5', '0', '2022-10-18T22:14'), ('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'), ('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'), ('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'), ('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'), ('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'), ('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'), ('51', '3', '6', '2022-10-17T18:25'),
('52', '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 -- Populate participations table
ALTER SEQUENCE participations_id_seq RESTART; ALTER SEQUENCE participations_id_seq RESTART;
INSERT INTO participations ("match_id", "team_id") VALUES INSERT INTO participations ("match_id", "team_id") VALUES
('1', '2'), ('1', '3'),
('1', '12'), ('1', '12'),
('2', '24'), ('2', '24'),
('2', '28'), ('2', '28'),