Subversion Repositories ORC

Rev

Rev 40 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
40 - 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
 
41 - 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
}
40 - 30
my $day = $dt->day_name;
31
 
32
## Uncomment and update to test:
41 - 33
#$day = "Wednesday";
34
#$date = "2022-07-13";
40 - 35
 
36
my $dbh = WebDB::connect ();
37
 
38
print CGI::header(-cookie=>$RCAUTH_cookie);
39
 
40
print<<output;
41
<html><head><title>RollerCon VORC - MVP Class Sign-Ups - $day ($date)</title>
41 - 42
<link rel="stylesheet" type="text/css" href="/style.css">
40 - 43
</head>
44
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
45
output
46
 
47
my $gcount = 1; my $tcount = '';
48
my $sth = $dbh->prepare("select distinct note, role, location, time from v_shift where dept = ? and date = ? order by location, time");
49
my $crewhan = $dbh->prepare("select v_shift.derby_name, real_name from v_shift, official where v_shift.RCid = official.RCid and date = ? and dept = ? and isnull(v_shift.derby_name) = 0 and location = ? and time = ? order by v_shift.derby_name");
50
 
51
 
52
$sth->execute("CLA", $date);
53
while (my $g = $sth->fetchrow_hashref()) {
54
	if ($tcount ne $g->{location}) { #pagebreak whenever we change tracks
41 - 55
		print "<div class='pagebreak'></div>\n" unless (!$tcount or $gcount++ % 2);
56
#		print "<div class='pagebreak'><hr></div>\n";
40 - 57
		$gcount = 1;
58
		$tcount = $g->{location};
59
	}
60
 
61
	print<<game;
62
<table>
41 - 63
  <tr><td colspan=5 class="mvp bold">Class: ($g->{location}) $g->{note}</td></tr>
64
	<tr><td colspan=3 class="mvp">Date: $day ($date)</td><td colspan=2 class='mvp right'>Time: $g->{time}</td></tr>
65
	<tr><td colspan=5 class="mvp">Coach: $g->{role}</td></tr>
66
	<tr><td colspan=5 class="mvp">&nbsp;</td></tr>
40 - 67
game
41 - 68
 
40 - 69
  my $counter = 1;
41 - 70
	$crewhan->execute($date, "CLA", $g->{location}, $g->{time});
71
	while (my ($derby_name, $real_name) = $crewhan->fetchrow_array()) {
72
    print "<tr><td class='mvp right'>".$counter++."</td><td>&nbsp;</td><td class='mvp'>".$derby_name."</td><td>&nbsp;</td><td class='mvp'>".$real_name."</td></tr>";
73
	}
74
	for ($counter..20) {
75
	  print "<tr><td class='mvp right'>".$_."</td><td colspan=4>&nbsp;</td></tr>";
76
	}
77
 
78
  print "</table><br><br>";
40 - 79
 
41 - 80
	$gcount++ % 2 == 0 ? print "<div class='pagebreak'></div>\n" : { };
40 - 81
}
82
 
83
 
84
 
85
print<<tail;
86
</BODY>
87
</HTML>
88
tail