Revert change to wrong branch.
[ccbs] / html / registration.pl
1 #! /usr/bin/perl
2
3 use ccbs;
4 use strict;
5 use warnings;
6
7 my $cgi = new CGI;
8 my $id = $cgi->param('id');
9 my $selected_player = $cgi->param('player');
10
11 my $dbh = ccbs::db_connect();
12
13 my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
14 my $registered = ccbs::db_fetch_all($dbh, 'SELECT * FROM tournamentparticipation NATURAL JOIN players WHERE tournament=? ORDER BY LOWER(nick)', $id);
15 my $available = ccbs::db_fetch_all($dbh, 'SELECT * FROM players WHERE player NOT IN ( SELECT player FROM tournamentparticipation WHERE tournament=? ) ORDER BY LOWER(nick)', $id);
16
17 ccbs::print_header();
18 ccbs::process_template('registration.tmpl', $tournament->{'tournamentname'}, {
19         tournament => $tournament,
20         registered => $registered,
21         available => $available,
22         selected_player => $selected_player
23 });
24 $dbh->disconnect;