Subversion Repositories ORC

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/usr/bin/perl

use 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 $dt = DateTime->today;
my $day = $dt->day_name;
my $date = $dt->date;

## 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="/rollercon.css">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
output

my $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 tracks
                print "<div class='pagebreak'><hr></div>\n" unless !$tcount;
                print "<div class='pagebreak'><hr></div>\n";
                $gcount = 1;
                $tcount = $g->{location};
        }
        
        my %crew;
        $crewhan->execute($date, "CLA", $g->{location}, $g->{time});
        while (my ($k, $v) = $crewhan->fetchrow_array()) {
                $crew{$k} = $v;
        }
                
        print<<game;
<table>
  <tr><td colspan=4>Class: ($g->{location}) $g->{note}</td></tr>
        <tr><td colspan=2>Date: $day ($date)</td><td colspan=2 align=right>Time: $g->{time}</td></tr>
        <tr><td colspan=4>Coach: $g->{role}</td></tr>
        <tr><td colspan=4>&nbsp;</td></tr>
game
  my $counter = 1;
  foreach (sort keys %crew) {
    print "<tr><td>&nbsp;</td><td>".$counter++."</td><td>".$_."</td><td>".$crew{$_}."</td></tr>";
  }
  print "</table><br><br><br><br><br><br><br><br><br><br><br><br>";

        $gcount++ % 2 == 0 ? print "<div class='pagebreak'><hr></div>\n" : { };
}



print<<tail;
</BODY>
</HTML>
tail