}); $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();
{ public $sports = array(); public function get_information() { $str_information = "<i>" . $this->name . "</i> is an athlete from " . $this->city . ". "; $str_information .= "The athlete is " . $this->age . " years old. "; $str_information .= "The athlete is good in the following sports: <br/>"; $str_information .= "<table bgcolor=#00FF00 border = 2>"; foreach ($this->sport as $one_sport) { $str_information .= "<tr><td>{$one_sport}</td></tr>"; } $str_information .= "</table>"; return $str_information; } } $person = new Person(); $person->name = "Vitosh"; $person->city = "Sofia"; $person->age = 29; //still!:) echo $person->get_information(); echo "<hr>"; $athlete = new Athlete(); $athlete->name = "Vityata"; $athlete->city = "Druzhba city"; $athlete->age = 28; $athlete->sport = array("WC3", "WC3 - TFT", "Civilization III", "Quake 3", "AOE", "Collin McRea Rally 2"); echo $athlete->get_information(); ?>