Added a function for starting a tournament (no backend yet).
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 18:44:40 +0000 (18:44 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 18:44:40 +0000 (18:44 +0000)
html/start-tournament.pl [new file with mode: 0755]
html/templates/start-tournament.tmpl [new file with mode: 0644]

diff --git a/html/start-tournament.pl b/html/start-tournament.pl
new file mode 100755 (executable)
index 0000000..e6386f1
--- /dev/null
@@ -0,0 +1,21 @@
+#! /usr/bin/perl
+
+use ccbs;
+use strict;
+use warnings;
+
+my $cgi = new CGI;
+my $id = $cgi->param('id');
+
+my $dbh = ccbs::db_connect();
+
+my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
+my $ref = $dbh->selectrow_hashref('SELECT count(*) AS num_registered FROM tournamentparticipation WHERE tournament=?', undef, $id);
+my $num_registered = $ref->{'num_registered'};
+
+ccbs::print_header();
+ccbs::process_template('start-tournament.tmpl', $tournament->{'tournamentname'}, {
+       tournament => $tournament,
+       num_registered => $num_registered
+});
+$dbh->disconnect;
diff --git a/html/templates/start-tournament.tmpl b/html/templates/start-tournament.tmpl
new file mode 100644 (file)
index 0000000..d8769f3
--- /dev/null
@@ -0,0 +1,25 @@
+[%# vim:set filetype=html: %]
+<div>
+  <p>Det er for øyeblikket <strong>[% num_registered %]</strong> spillere registrert.
+    Du burde ikke starte en turnering før registreringen er stengt -- gå til
+    <a href="registration.pl?id=[% tournament.tournament %]">registreringen</a>
+    om du ønsker å registrere flere før du starter turneringen.</p>
+
+  <p><strong>ADVARSEL:</strong> Om du bruker denne funksjonen underveis i en
+    turnering, vil alle data gå tapt! Denne funksjonen skal brukes én og bare én
+    gang i løpet av en turnering.</p>
+
+  <form method="post" action="do-start-tournament.pl">
+    <table>
+      <tr>
+        <th>Antall grupper</th>
+        <td><input name="numgroups" /></td>
+      </tr>
+      <tr>
+        <th colspan="2">
+          <input type="submit" value="Start ny turnering" />
+        </th>
+      </tr>
+    </table>
+  </form>
+</div>