<?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;
    }
}
?>
