mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-16 20:07:50 +01:00
Updated Showing the pairings of a specific round (markdown)
parent
57515c7917
commit
55587a424b
@ -8,15 +8,23 @@ When you have the round object you can the `Round::GetPairings()` method to get
|
||||
|
||||
## Example
|
||||
````php
|
||||
require_once('vendor/autoload.php'');
|
||||
use JeroenED/Libpairtwo/Sws;
|
||||
<?php
|
||||
require_once('vendor/autoload.php');
|
||||
use JeroenED\Libpairtwo\Sws;
|
||||
use JeroenED\Libpairtwo\Enums\Result;
|
||||
|
||||
$sws = Sws::readSws('mycompetition.sws);
|
||||
$tournament = $sws->getTournament();
|
||||
$pairings = $tournament->getRoundByNo($_GET['round'])->getPairings();
|
||||
foreach($pairings as $pairing) {
|
||||
$player = $pairing->getPlayer()->getName();
|
||||
if (!is_null($pairing->getOpponent())) {
|
||||
$opponent = $pairing->getOpponent()->getName();
|
||||
$color = $pairing->getColor()->getKey();
|
||||
echo $player . ' against ' . $opponent . ' using ' . $color;
|
||||
echo $player . ' against ' . $opponent . ' using ' . $color . PHP_EOL;
|
||||
} elseif ($pairing->getResult() == Result::bye ) {
|
||||
echo $player . ' is bye' . PHP_EOL;
|
||||
} elseif ($pairing->getResult() == Result::absent ) {
|
||||
echo $player . ' is absent' . PHP_EOL;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user