| 46 |
- |
1 |
#!/usr/bin/perl
|
|
|
2 |
|
|
|
3 |
use strict;
|
|
|
4 |
use cPanelUserConfig;
|
|
|
5 |
use RollerCon;
|
|
|
6 |
use WebDB;
|
|
|
7 |
use tableViewer;
|
|
|
8 |
use CGI;
|
|
|
9 |
use CGI::Cookie;
|
|
|
10 |
use DateTime;
|
|
|
11 |
|
|
|
12 |
my $cookie_string = authenticate(2) || die;
|
|
|
13 |
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
|
|
14 |
my $user = getUser($EML);
|
|
|
15 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
|
|
16 |
|
|
|
17 |
my $date = param ("date");
|
|
|
18 |
my $dt;
|
|
|
19 |
if ($date =~ /^\d{4}-\d{2}-\d{2}$/) {
|
|
|
20 |
my ($YYYY, $MM, $DD) = split /-/, $date;
|
|
|
21 |
$dt = DateTime->new(
|
|
|
22 |
year => $YYYY,
|
|
|
23 |
month => $MM,
|
|
|
24 |
day => $DD
|
|
|
25 |
);
|
|
|
26 |
} else {
|
|
|
27 |
$dt = DateTime->today;
|
|
|
28 |
$date = $dt->date;
|
|
|
29 |
}
|
|
|
30 |
my $day = $dt->day_name;
|
|
|
31 |
|
|
|
32 |
my %class = qw(
|
|
|
33 |
U Unrestricted
|
|
|
34 |
M Mens
|
|
|
35 |
W Womens
|
|
|
36 |
SS Single-Gender
|
|
|
37 |
);
|
|
|
38 |
|
|
|
39 |
my $dbh = WebDB::connect ();
|
|
|
40 |
|
|
|
41 |
print CGI::header(-cookie=>$RCAUTH_cookie);
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
print<<output;
|
|
|
47 |
<html><head><title>RollerCon VORC - Daily Announcer Schedule - $day ($date)</title>
|
|
|
48 |
<link rel="stylesheet" type="text/css" href="/rollercon.css">
|
|
|
49 |
</head>
|
|
|
50 |
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
|
|
51 |
output
|
|
|
52 |
|
|
|
53 |
my $gcount = 1; my $tcount = '';
|
|
|
54 |
my $sth = $dbh->prepare("select distinct teams, track, level, time, gtype, restrictions from v_shift_announcer where date = ? order by track, time");
|
|
|
55 |
my $crewhan = $dbh->prepare("select role, derby_name from v_shift_announcer where date = ? and track = ? and time = ?");
|
|
|
56 |
my $leadhan = $dbh->prepare("select location, time, derby_name from v_shift where dept = 'ANN' and date = ? order by location, time");
|
|
|
57 |
my $openshifthan = $dbh->prepare("select time, level, restrictions, gtype, teams, tla, name from v_shift_announcer where tla <> 'ALT' and isNull(derby_name) = 1 and date = ? and track = ? order by time");
|
|
|
58 |
|
|
|
59 |
my @leads = ("<table>\n", "<tr><td colspan=5><b>Lead Shifts</b></td></tr>\n");
|
|
|
60 |
$leadhan->execute($date);
|
|
|
61 |
my $tc = 'C1';
|
|
|
62 |
while (my $lshift = $leadhan->fetchrow_hashref()) {
|
|
|
63 |
if ($tc ne $lshift->{location}) {
|
|
|
64 |
push @leads, "<tr><td colspan=5> </td></tr>\n";
|
|
|
65 |
$tc = $lshift->{location};
|
|
|
66 |
}
|
|
|
67 |
push @leads, "<tr><td>$lshift->{location}</td><td> </td><td>$lshift->{time}</td><td> </td><td>$lshift->{derby_name}</td></tr>\n";
|
|
|
68 |
}
|
|
|
69 |
push @leads, "</table>\n";
|
|
|
70 |
|
|
|
71 |
$sth->execute($date);
|
|
|
72 |
while (my $g = $sth->fetchrow_hashref()) {
|
|
|
73 |
if ($tcount ne $g->{track}) { #pagebreak whenever we change tracks
|
|
|
74 |
print "<div class='pagebreak'><hr></div>\n" unless !$tcount;
|
|
|
75 |
print @leads;
|
|
|
76 |
|
|
|
77 |
my @openshifts = ("<table>\n", "<tr><td colspan=5><b>Open Shifts on $g->{track}</b></td></tr>\n");
|
|
|
78 |
$openshifthan->execute($date, $g->{track});
|
|
|
79 |
while (my @oshift = $openshifthan->fetchrow_array()) {
|
|
|
80 |
my $sh = join "</td><td> </td><td>", @oshift;
|
|
|
81 |
push @openshifts, "<tr><td>$sh</td></tr>\n";
|
|
|
82 |
}
|
|
|
83 |
push @openshifts, "</table>\n";
|
|
|
84 |
print "<br><br><br><br>";
|
|
|
85 |
print @openshifts;
|
|
|
86 |
|
|
|
87 |
print "<div class='pagebreak'><hr></div>\n";
|
|
|
88 |
$gcount = 1;
|
|
|
89 |
$tcount = $g->{track};
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
$g->{gtype} = join '', map { ucfirst lc } split /(\s+)/, $g->{gtype}; # Capitalize the game time to look nicer
|
|
|
93 |
|
|
|
94 |
my %crew;
|
|
|
95 |
$crewhan->execute($date, $g->{track}, $g->{time});
|
|
|
96 |
while (my ($k, $v) = $crewhan->fetchrow_array()) {
|
|
|
97 |
$crew{$k} = $v;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
my $A = '';
|
|
|
101 |
if (defined $crew{'ALT'}) {
|
|
|
102 |
$A = "ALT:";
|
|
|
103 |
} else {
|
|
|
104 |
$crew{'ALT'} = '';
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
print<<game;
|
|
|
108 |
<table>
|
|
|
109 |
<tr><td>Date:</td><td>$day ($date)</td><td> </td><td>Track:</td><td>$g->{track}</td></tr>
|
|
|
110 |
<tr><td>Time:</td><td>$g->{time}</td><td> </td><td>Class:</td><td>$class{$g->{restrictions}} $g->{level} $g->{gtype}</td></tr>
|
|
|
111 |
<tr><td>Game:</td><td colspan=4>$g->{teams}</td></tr>
|
|
|
112 |
<tr><td colspan=5> </td></tr>
|
|
|
113 |
<tr><td>Color:</td><td colspan=4>$crew{'COL'}</td></tr>
|
|
|
114 |
<tr><td>Play-by-play:</td><td colspan=4>$crew{'PBP'}</td></tr>
|
|
|
115 |
<tr><td>Sponsorship:</td><td colspan=4>$crew{'SPO'}</td></tr>
|
|
|
116 |
</table><br><br><br><br><br><br><br><br><br><br><br><br>
|
|
|
117 |
game
|
|
|
118 |
|
|
|
119 |
$gcount++ % 4 == 0 ? print "<div class='pagebreak'><hr></div>\n" : { };
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
print<<tail;
|
|
|
125 |
</BODY>
|
|
|
126 |
</HTML>
|
|
|
127 |
tail
|