2019-05-18 14:55:49 +02:00
|
|
|
<?php
|
2019-06-13 13:50:17 +02:00
|
|
|
require_once '../../classes/dao.php';
|
2019-05-18 14:55:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['function'])) {
|
2019-06-13 13:50:17 +02:00
|
|
|
if ($_GET['function'] == "get_scores")
|
2019-05-18 14:55:49 +02:00
|
|
|
get_scores();
|
2019-05-19 20:04:02 +02:00
|
|
|
elseif ($_GET['function'] == "get_map_info")
|
|
|
|
get_map_info();
|
2019-05-20 17:56:19 +02:00
|
|
|
elseif ($_GET['function'] == "get_activities_of_day")
|
|
|
|
get_activities_of_day();
|
2019-05-18 14:55:49 +02:00
|
|
|
} else
|
|
|
|
show_error();
|
|
|
|
|
|
|
|
function get_scores() {
|
|
|
|
if (isset($_GET['team'])) {
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$dao = new Dao('../');
|
|
|
|
echo json_encode($dao->get_score_team($_GET['team']));
|
|
|
|
} else {
|
|
|
|
show_error();
|
|
|
|
}
|
2019-05-19 20:04:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_map_info() {
|
|
|
|
if (isset($_GET['selector'])) {
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$dao = new Dao('../');
|
|
|
|
echo json_encode($dao->get_map_info($_GET['selector']));
|
|
|
|
} else {
|
|
|
|
show_error();
|
|
|
|
}
|
|
|
|
}
|
2019-05-18 14:55:49 +02:00
|
|
|
|
|
|
|
|
2019-05-20 17:56:19 +02:00
|
|
|
function get_activities_of_day() {
|
|
|
|
if (isset($_GET['day'])) {
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$dao = new Dao('../');
|
|
|
|
echo json_encode($dao->get_activities_of_day($_GET['day']));
|
|
|
|
} else {
|
|
|
|
show_error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-19 20:04:02 +02:00
|
|
|
|
2019-05-18 14:55:49 +02:00
|
|
|
function show_error() {
|
|
|
|
echo "Échec : ";
|
|
|
|
var_dump($_GET);
|
|
|
|
}
|