read($pairingfile);
// From here on you can start. Please use the examples on https://github.com/jeroened/libpairtwo/wiki
// You can also use the doc/api folder to get all possible methods and fields
// Below is an example of what can be used. Feel free to modify this.
echo '' . $reader->getTournament()->getName() . '
' . PHP_EOL;
foreach ($reader->getTournament()->getRounds() as $round) {
echo 'Round ' . ($round->getRoundNo() + 1) . ': ' . $round->getDate()->format('m/d/Y') . '
' . PHP_EOL;
echo '' . PHP_EOL;
echo '' . PHP_EOL;
echo ' | White | Black | Result |
' . PHP_EOL;
echo '' . PHP_EOL;
echo '' . PHP_EOL;
foreach ($round->getGamesByBoard() as $game) {
echo '' . PHP_EOL;
echo '' . $game->getBoard() . ' | ' . PHP_EOL;
echo '' . $game->getWhite()->getPlayer()->getName() . ' | ' . PHP_EOL;
echo '' . $game->getBlack()->getPlayer()->getName() . ' | ' . PHP_EOL;
echo '' . $game->getResult()->getValue() . ' | ' . PHP_EOL;
echo '
' . PHP_EOL;
}
echo '' . PHP_EOL;
echo '
' . PHP_EOL;
echo 'Bye: ';
$bye = [];
foreach ($round->getBye() as $pairing) {
$bye[] = $pairing->getPlayer()->getName();
}
echo implode(', ', $bye);
echo '
' . PHP_EOL;
echo 'Absent: ';
$bye = [];
foreach ($round->getAbsent() as $pairing) {
$bye[] = $pairing->getPlayer()->getName();
}
echo implode('; ', $bye);
echo '
' . PHP_EOL;
}
echo 'Rankings
' . PHP_EOL;
echo '' . PHP_EOL;
echo '' . PHP_EOL;
echo ' | Name (elo) | ' . PHP_EOL;
foreach ($reader->getTournament()->getTieBreaks() as $tiebreak) {
echo '' . $tiebreak->getValue() . ' | ' . PHP_EOL;
}
echo '
' . PHP_EOL;
echo '' . PHP_EOL;
echo '' . PHP_EOL;
$rank = 1;
foreach ($reader->getTournament()->getRanking() as $player) {
echo '' . PHP_EOL;
echo '' . $rank . ' | ' . PHP_EOL;
echo '' . $player->getName() . '(' . $player->getElo($reader->getTournament()->getPriorityElo()) . ') | ' . PHP_EOL;
echo '' . implode(' | ', $player->getTiebreaks()) . ' | ' . PHP_EOL;
echo '
' . PHP_EOL;
$rank++;
}
echo '' . PHP_EOL;
echo '
' . PHP_EOL;
?>