Ejemplo n.º 1
0
});
$app->get('/athlete/:id', function ($request, $response, $args) {
    require_once 'athlete.inc.php';
    return Athlete::getOne($request, $response, $args, $this);
});
$app->post('/athlete', function ($request, $response, $args) {
    require_once 'athlete.inc.php';
    return Athlete::post($request, $response, $args, $this);
});
$app->put('/athlete/:id', function ($request, $response, $args) {
    require_once 'athlete.inc.php';
    return Athlete::put($request, $response, $args, $this);
});
$app->delete('/athlete/:id', function ($request, $response, $args) {
    require_once 'athlete.inc.php';
    return Athlete::delete($request, $response, $args, $this);
});
/***********************************************************************************************************************
******************************************************** Etc ***********************************************************
***********************************************************************************************************************/
$app->get('/list/', function ($request, $response, $args) {
    $db = $this->dbConnection;
    $sql = "SELECT *\n        FROM list_participants AS t2 JOIN competition_list AS t1\n        ON ( t1.meeting_id = t2.meeting_id AND t1.type = t2.type\n            AND t1.type = :comp_type AND t1.competition_nr = t2.competition_nr )\n        RIGHT JOIN competition_participant AS t3\n        ON ( t2.STNO = t3.STNO AND t2.competition_nr=t3.competition_nr AND t2.meeting_id=t3.meeting_id )\n        JOIN participant AS t4 ON (t3.stno = t4.stno AND t3.meeting_id=t4.meeting_id)\n        JOIN club AS t5 ON (t4.clubno=t5.club_nr AND t4.ra_index=t5.ra_index AND t4.meeting_id=t5.meeting_id)\n        JOIN regional_association AS t6 ON (t5.ra_index=t6.ra_index)\n        WHERE ( t3.meeting_id =:meeting_id AND t3.competition_nr =:comp_nr );";
    $pdo = $db->prepare($sql);
    $pdo->bindValue(":meeting_id", $this->meetingId, PDO::PARAM_INT);
    $pdo->bindValue(":comp_type", 'FINAL', PDO::PARAM_STR);
    $pdo->bindValue(":comp_nr", 1, PDO::PARAM_INT);
    $pdo->execute();
    $participants = $pdo->fetchAll(PDO::FETCH_ASSOC);
    foreach ($participants as $participant) {
        /*$tmp = array();