| 8 |
- |
1 |
#!/usr/bin/perl
|
|
|
2 |
|
|
|
3 |
use strict;
|
|
|
4 |
use cPanelUserConfig;
|
|
|
5 |
use RollerCon;
|
| 38 |
- |
6 |
use WebDB;
|
|
|
7 |
use tableViewer;
|
| 8 |
- |
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 $dt = DateTime->today;
|
|
|
18 |
my $day = $dt->day_name;
|
|
|
19 |
my $date = $dt->date;
|
|
|
20 |
|
| 38 |
- |
21 |
## Uncomment and update to test:
|
|
|
22 |
$day = "Wednesday";
|
|
|
23 |
$date = "2022-07-13";
|
| 8 |
- |
24 |
|
|
|
25 |
my %class = qw(
|
|
|
26 |
U Unrestricted
|
|
|
27 |
M Mens
|
|
|
28 |
W Womens
|
|
|
29 |
SS Single-Gender
|
|
|
30 |
);
|
|
|
31 |
|
| 38 |
- |
32 |
my $dbh = WebDB::connect ();
|
| 8 |
- |
33 |
|
|
|
34 |
print CGI::header(-cookie=>$RCAUTH_cookie);
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
print<<output;
|
| 38 |
- |
40 |
<html><head><title>RollerCon VORC - Daily Officiating Schedule - $day ($date)</title>
|
| 8 |
- |
41 |
<link rel="stylesheet" type="text/css" href="/rollercon.css">
|
|
|
42 |
</head>
|
|
|
43 |
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
|
|
44 |
output
|
|
|
45 |
|
|
|
46 |
my $gcount = 1; my $tcount = '';
|
| 38 |
- |
47 |
my $sth = $dbh->prepare("select distinct teams, track, level, time, gtype, restrictions from v_shift_officiating where date = ? order by track, time");
|
|
|
48 |
my $crewhan = $dbh->prepare("select role, derby_name from v_shift_officiating where date = ? and track = ? and time = ?");
|
|
|
49 |
my $leadhan = $dbh->prepare("select location, time, derby_name from v_shift where dept = 'OFF' and date = ? order by location, time");
|
|
|
50 |
my $openshifthan = $dbh->prepare("select time, level, restrictions, gtype, teams, tla, name from v_shift_officiating where tla <> 'ALT' and isNull(derby_name) = 1 and date = ? and track = ? order by time");
|
| 8 |
- |
51 |
|
|
|
52 |
my @leads = ("<table>\n", "<tr><td colspan=5><b>Lead Shifts</b></td></tr>\n");
|
|
|
53 |
$leadhan->execute($date);
|
|
|
54 |
my $tc = 'C1';
|
|
|
55 |
while (my $lshift = $leadhan->fetchrow_hashref()) {
|
| 38 |
- |
56 |
if ($tc ne $lshift->{location}) {
|
| 8 |
- |
57 |
push @leads, "<tr><td colspan=5> </td></tr>\n";
|
| 38 |
- |
58 |
$tc = $lshift->{location};
|
| 8 |
- |
59 |
}
|
| 38 |
- |
60 |
push @leads, "<tr><td>$lshift->{location}</td><td> </td><td>$lshift->{time}</td><td> </td><td>$lshift->{derby_name}</td></tr>\n";
|
| 8 |
- |
61 |
}
|
|
|
62 |
push @leads, "</table>\n";
|
|
|
63 |
|
|
|
64 |
$sth->execute($date);
|
|
|
65 |
while (my $g = $sth->fetchrow_hashref()) {
|
|
|
66 |
if ($tcount ne $g->{track}) { #pagebreak whenever we change tracks
|
|
|
67 |
print "<div class='pagebreak'><hr></div>\n" unless !$tcount;
|
|
|
68 |
print @leads;
|
|
|
69 |
|
|
|
70 |
my @openshifts = ("<table>\n", "<tr><td colspan=5><b>Open Shifts on $g->{track}</b></td></tr>\n");
|
|
|
71 |
$openshifthan->execute($date, $g->{track});
|
|
|
72 |
while (my @oshift = $openshifthan->fetchrow_array()) {
|
|
|
73 |
my $sh = join "</td><td> </td><td>", @oshift;
|
|
|
74 |
push @openshifts, "<tr><td>$sh</td></tr>\n";
|
|
|
75 |
}
|
|
|
76 |
push @openshifts, "</table>\n";
|
|
|
77 |
print "<br><br><br><br>";
|
|
|
78 |
print @openshifts;
|
|
|
79 |
|
|
|
80 |
print "<div class='pagebreak'><hr></div>\n";
|
|
|
81 |
$gcount = 1;
|
|
|
82 |
$tcount = $g->{track};
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
$g->{gtype} = join '', map { ucfirst lc } split /(\s+)/, $g->{gtype}; # Capitalize the game time to look nicer
|
|
|
86 |
|
|
|
87 |
my %crew;
|
|
|
88 |
$crewhan->execute($date, $g->{track}, $g->{time});
|
|
|
89 |
while (my ($k, $v) = $crewhan->fetchrow_array()) {
|
|
|
90 |
$crew{$k} = $v;
|
|
|
91 |
}
|
|
|
92 |
my $P1 = "PLT-1";
|
|
|
93 |
my $P2 = "PLT-2";
|
|
|
94 |
my $PH = "PLT";
|
|
|
95 |
my $OPR1 = "OPR-1";
|
|
|
96 |
if ($g->{gtype} eq "Full Length" or $g->{gtype} eq "Selected Staffing") {
|
|
|
97 |
$P1 = 'PLT/H';
|
|
|
98 |
$P2 = 'PLT';
|
|
|
99 |
$PH = $P1;
|
|
|
100 |
} elsif ($g->{gtype} eq "Challenge-rs1") {
|
|
|
101 |
$crew{'OPR-1'} = "<i>-not staffed-</i>";
|
|
|
102 |
$crew{'OPR-2'} = "<i>-not staffed-</i>";
|
|
|
103 |
$crew{'OPR-3'} = "<i>-not staffed-</i>";
|
|
|
104 |
$crew{'PLT-1'} = "<i>-not staffed-</i>";
|
|
|
105 |
$crew{'PLT-2'} = "<i>-not staffed-</i>";
|
|
|
106 |
$crew{'SK-1'} = "<i>-not staffed-</i>";
|
|
|
107 |
$crew{'SK-2'} = "<i>-not staffed-</i>";
|
|
|
108 |
$crew{'PBM'} = "<i>-not staffed-</i>";
|
|
|
109 |
} elsif ($g->{gtype} eq "Challenge-rs2") {
|
|
|
110 |
$OPR1 = "OPR";
|
|
|
111 |
|
|
|
112 |
$crew{'IPR'} = "<i>-not staffed-</i>";
|
|
|
113 |
$crew{'OPR-2'} = "<i>-not staffed-</i>";
|
|
|
114 |
$crew{'OPR-3'} = "<i>-not staffed-</i>";
|
|
|
115 |
$crew{'PLT-1'} = "<i>-not staffed-</i>";
|
|
|
116 |
$crew{'PLT-2'} = "<i>-not staffed-</i>";
|
|
|
117 |
$crew{'SK-1'} = "<i>-not staffed-</i>";
|
|
|
118 |
$crew{'SK-2'} = "<i>-not staffed-</i>";
|
|
|
119 |
$crew{'PBM'} = "<i>-not staffed-</i>";
|
| 38 |
- |
120 |
} elsif ($g->{gtype} eq "Scrimmage") {
|
|
|
121 |
$crew{'PLT-1'} = "<i>-not staffed-</i>";
|
|
|
122 |
$crew{'PLT-2'} = "<i>-not staffed-</i>";
|
|
|
123 |
$crew{'SK-1'} = "<i>-not staffed-</i>";
|
|
|
124 |
$crew{'SK-2'} = "<i>-not staffed-</i>";
|
|
|
125 |
$crew{'PBM'} = "<i>-not staffed-</i>";
|
|
|
126 |
$crew{'PBT-1'} = "<i>-not staffed-</i>";
|
|
|
127 |
$crew{'PBT-2'} = "<i>-not staffed-</i>";
|
|
|
128 |
$crew{'SO'} = "<i>-not staffed-</i>";
|
| 8 |
- |
129 |
}
|
|
|
130 |
|
|
|
131 |
my $A = '';
|
|
|
132 |
if (defined $crew{'ALT'}) {
|
|
|
133 |
$A = "ALT:";
|
|
|
134 |
} else {
|
|
|
135 |
$crew{'ALT'} = '';
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
print<<game;
|
|
|
139 |
<table>
|
|
|
140 |
<tr><td>Date:</td><td>$day ($date)</td><td> </td><td>Track:</td><td>$g->{track}</td></tr>
|
|
|
141 |
<tr><td>Time:</td><td>$g->{time}</td><td> </td><td>Class:</td><td>$class{$g->{restrictions}} $g->{level} $g->{gtype}</td></tr>
|
|
|
142 |
<tr><td>Game:</td><td colspan=4>$g->{teams}</td></tr>
|
|
|
143 |
<tr><td colspan=5> </td></tr>
|
|
|
144 |
<tr><td>HR:</td><td>$crew{'HR'}</td><td> </td><td>$PH:</td><td>$crew{$P1}</td></tr>
|
|
|
145 |
<tr><td>IPR:</td><td>$crew{'IPR'}</td><td> </td><td>PLT:</td><td>$crew{$P2}</td></tr>
|
|
|
146 |
<tr><td>JR:</td><td>$crew{'JR-1'}</td><td> </td><td>SK:</td><td>$crew{'SK-1'}</td></tr>
|
|
|
147 |
<tr><td>JR:</td><td>$crew{'JR-2'}</td><td> </td><td>SK:</td><td>$crew{'SK-2'}</td></tr>
|
|
|
148 |
<tr><td>OPR:</td><td>$crew{$OPR1}</td><td> </td><td>PBM:</td><td>$crew{'PBM'}</td></tr>
|
|
|
149 |
<tr><td>OPR:</td><td>$crew{'OPR-2'}</td><td> </td><td>PBT:</td><td>$crew{'PBT-1'}</td></tr>
|
|
|
150 |
<tr><td>OPR:</td><td>$crew{'OPR-3'}</td><td> </td><td>PBT:</td><td>$crew{'PBT-2'}</td></tr>
|
|
|
151 |
<tr><td>$A</td><td>$crew{'ALT'}</td><td> </td><td>JT:</td><td>$crew{'JT'}</td></tr>
|
|
|
152 |
<tr><td> </td><td> </td><td> </td><td>SO:</td><td>$crew{'SO'}</td></tr>
|
|
|
153 |
</table><br><br><br><br><br><br><br><br><br><br><br><br>
|
|
|
154 |
game
|
|
|
155 |
|
|
|
156 |
$gcount++ % 2 == 0 ? print "<div class='pagebreak'><hr></div>\n" : { };
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
print<<tail;
|
|
|
162 |
</BODY>
|
|
|
163 |
</HTML>
|
|
|
164 |
tail
|