6 use POSIX qw
/strftime/;
8 $SIG{__WARN__
} = sub { cluck
$_[0] };
10 my $ctx = ASR
::Ladder
->new;
12 $ctx->header('Player Info');
14 my $prec = $ctx->db_selectrow("SELECT * FROM player_info WHERE id = ?", {}, $ctx->param('pid'));
16 print $ctx->p("Player not found.");
21 print $ctx->p("Player <strong>$prec->{nick}</strong> ($prec->{score}) with id $prec->{id}. KGS games last refreshed on $prec->{last_update}");
24 <h2>Ladder Games List</h2>
26 <tr><th>White</th><th>Black</th><th>Date</th><th>Score\Δ</th></tr>
28 my $q = $ctx->{dbi
}->prepare("SELECT * FROM player_game WHERE bid = ? OR wid = ?");
29 $q->execute($prec->{id
}, $prec->{id
});
30 while (my $r = $q->fetchrow_hashref) {
31 my $class = ($r->{winid
} == $prec->{id
} ?
'winner' : 'loser');
32 print "<tr class=\"$class\"><td>".$ctx->plink($r->{'wid'}, $r->{'wnick'})."</td><td>".$ctx->plink($r->{'bid'}, $r->{'bnick'})."</td><td><a href=\"$r->{url}\">$r->{date}</a></td><td>".($class eq 'winner' ?
'+'.$r->{scoredelta
} : 0)."</td></tr>\n";