This repository has been archived on 2025-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
accm-website/includes/tournaments/TournamentEntryFormatter.inc.php
2010-11-13 20:51:50 +01:00

63 lines
1.6 KiB
PHP

<?php
include_once './includes/tournaments/TournamentEntry.inc.php';
include_once './includes/tournaments/Category.inc.php';
/**
* This class allows for easy formatting of tournaments entries.
*
* @author Thomas Schwery <thomas.schwery@epfl.ch>
*/
class TournamentEntryFormatter {
public static function GetUserLine(TournamentEntry $entry) {
$tournament = $entry->getTournament();
if (!$tournament) {
return "";
}
$tournamentId = $tournament->getIdentifier();
$tournamentName = $tournament->getName();
$tournamentDate = DateFormatter::format($tournament->getDate());
$category = $entry->getCategory();
$categoryName = $category->getName();
$points = $entry->getPoints();
$rank = $entry->getRank();
$participants = $entry->getParticipants();
$content = <<<BOX
<tr>
<td>$tournamentName</td>
<td>$tournamentDate</td>
<td>$rank</td>
<td>$points</td>
<td>$participants</td>
</tr>
BOX;
return $content;
}
public static function GetTournamentLine(TournamentEntry $entry) {
$member = $entry->getMember();
$memberId = $member->getIdentifier();
$fullName = $member->getFullName();
$points = $entry->getPoints();
$rank = $entry->getRank();
$participants = $entry->getParticipants();
$content = <<<BOX
<tr>
<td>$fullName</td>
<td>$rank</td>
<td>$points</td>
<td>$participants</td>
</tr>
BOX;
return $content;
}
}
?>