Пример #1
0
        /* No scope so respond with 401 Unauthorized */
        echoRespnse(401, $response);
    }
});
/**
 * Gets a specific competition round
 * method GET
 * url /competition-rounds/:competitionRoundID
 */
$app->get('/competition-rounds/:competitionRoundID', function ($competitionRoundID) {
    global $user_id;
    $response = array();
    $db = new DbHandler();
    $competitionRoundResult = $db->getCompetitionRound($competitionRoundID);
    // fetching all matches for the given competition round
    $matchesResult = $db->getSoccerMatchesByCompetitionRound($competitionRoundID);
    $response["Error"] = false;
    $soccerMatches = array();
    // looping through result and preparing soccer matches array
    while ($match = $matchesResult->fetch_assoc()) {
        array_push($soccerMatches, $match);
    }
    $competitionRound = $competitionRoundResult->fetch_assoc();
    $competitionRound["SoccerMatches"] = $soccerMatches;
    $response["CompetitionRound"] = $competitionRound;
    echoRespnse(200, $response);
});
$app->get('/competitions/:id/teams', function ($competitionID) {
    global $user_id;
    $response = array();
    $db = new DbHandler();