Rev 40 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/perluse strict;use cPanelUserConfig;use RollerCon;use WebDB;use tableViewer;use CGI;use CGI::Cookie;use DateTime;my $cookie_string = authenticate(2) || die;my ($EML, $PWD, $LVL) = split /&/, $cookie_string;my $user = getUser($EML);my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");my $date = param ("date");my $dt;if ($date =~ /^\d{4}-\d{2}-\d{2}$/) {my ($YYYY, $MM, $DD) = split /-/, $date;$dt = DateTime->new(year => $YYYY,month => $MM,day => $DD);} else {$dt = DateTime->today;$date = $dt->date;}my $day = $dt->day_name;## Uncomment and update to test:#$day = "Wednesday";#$date = "2022-07-13";my $dbh = WebDB::connect ();print CGI::header(-cookie=>$RCAUTH_cookie);print<<output;<html><head><title>RollerCon VORC - MVP Class Sign-Ups - $day ($date)</title><link rel="stylesheet" type="text/css" href="/style.css"></head><body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">outputmy $gcount = 1; my $tcount = '';my $sth = $dbh->prepare("select distinct note, role, location, time from v_shift where dept = ? and date = ? order by location, time");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");$sth->execute("CLA", $date);while (my $g = $sth->fetchrow_hashref()) {if ($tcount ne $g->{location}) { #pagebreak whenever we change tracksprint "<div class='pagebreak'></div>\n" unless (!$tcount or $gcount++ % 2);# print "<div class='pagebreak'><hr></div>\n";$gcount = 1;$tcount = $g->{location};}print<<game;<table><tr><td colspan=5 class="mvp bold">Class: ($g->{location}) $g->{note}</td></tr><tr><td colspan=3 class="mvp">Date: $day ($date)</td><td colspan=2 class='mvp right'>Time: $g->{time}</td></tr><tr><td colspan=5 class="mvp">Coach: $g->{role}</td></tr><tr><td colspan=5 class="mvp"> </td></tr>gamemy $counter = 1;$crewhan->execute($date, "CLA", $g->{location}, $g->{time});while (my ($derby_name, $real_name) = $crewhan->fetchrow_array()) {print "<tr><td class='mvp right'>".$counter++."</td><td> </td><td class='mvp'>".$derby_name."</td><td> </td><td class='mvp'>".$real_name."</td></tr>";}for ($counter..20) {print "<tr><td class='mvp right'>".$_."</td><td colspan=4> </td></tr>";}print "</table><br><br>";$gcount++ % 2 == 0 ? print "<div class='pagebreak'></div>\n" : { };}print<<tail;</BODY></HTML>tail