| Line 596... |
Line 596... |
| 596 |
use HTML::Tiny;
|
596 |
use HTML::Tiny;
|
| 597 |
my $h = HTML::Tiny->new( mode => 'html' );
|
597 |
my $h = HTML::Tiny->new( mode => 'html' );
|
| Line 598... |
Line 598... |
| 598 |
|
598 |
|
| 599 |
my $where = scalar @whereclause ? "where ".join " and ", @whereclause : "";
|
599 |
my $where = scalar @whereclause ? "where ".join " and ", @whereclause : "";
|
| 600 |
my @shifts;
|
600 |
my @shifts;
|
| 601 |
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, track as location, time, role, teams, signup, 'OFF' as dept, volhours from v_shift_officiating where RCid = ? union
|
601 |
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, start_time, end_time, track as location, time, role, teams, signup, 'OFF' as dept, volhours from v_shift_officiating where RCid = ? union
|
| 602 |
select id, date, dayofweek, track as location, time, role, teams, signup, 'ANN' as dept, volhours from v_shift_announcer where RCid = ? union
|
602 |
select id, date, dayofweek, start_time, end_time, track as location, time, role, teams, signup, 'ANN' as dept, volhours from v_shift_announcer where RCid = ? union
|
| 603 |
select id, date, dayofweek, location, time, role, if(dept = 'COA', note, '') as teams, type as signup, dept, if(dept = 'PER', 0, volhours) as volhours from v_shift where RCid = ? union
|
603 |
select id, date, dayofweek, start_time, end_time, location, time, role, if(dept = 'COA', note, '') as teams, type as signup, dept, if(dept = 'PER', 0, volhours) as volhours from v_shift where RCid = ? union
|
| 604 |
select id, date, dayofweek, location, time, role, name as teams, 'mvpclass' as signup, 'CLA' as dept, 0 as volhours from v_class_signup_new where RCid = ? union
|
604 |
select id, date, dayofweek, start_time, end_time, location, time, role, name as teams, 'mvpclass' as signup, 'CLA' as dept, 0 as volhours from v_class_signup_new where RCid = ? union
|
| 605 |
select id, date, dayofweek, location, time, role, name as teams, 'seminar' as signup, 'SEM' as dept, 0 as volhours from v_seminar_signup_new where RCid = ?) temp
|
605 |
select id, date, dayofweek, start_time, end_time, location, time, role, name as teams, 'seminar' as signup, 'SEM' as dept, 0 as volhours from v_seminar_signup_new where RCid = ?) temp
|
| 606 |
$where order by date, time");
|
606 |
$where order by date, time");
|
| - |
|
607 |
$sth->execute($RCid, $RCid, $RCid, $RCid, $RCid);
|
| - |
|
608 |
my @RESULTS;
|
| - |
|
609 |
while (my $r = $sth->fetchrow_hashref) {
|
| - |
|
610 |
push @RESULTS, $r;
|
| - |
|
611 |
|
| - |
|
612 |
if ($#RESULTS) {
|
| - |
|
613 |
my ($yyyy, $mm, $dd) = split /\-/, $r->{date};
|
| - |
|
614 |
my ($sh, $sm, $ss) = split /:/, $r->{start_time};
|
| - |
|
615 |
my $start_time = DateTime->new (
|
| - |
|
616 |
year => $yyyy,
|
| - |
|
617 |
month => $mm,
|
| - |
|
618 |
day => $dd,
|
| - |
|
619 |
hour => $sh,
|
| - |
|
620 |
minute => $sm,
|
| - |
|
621 |
second => 0,
|
| - |
|
622 |
time_zone => 'America/Los_Angeles'
|
| - |
|
623 |
);
|
| - |
|
624 |
|
| - |
|
625 |
my ($peh, $pem, $pes) = split /:/, $RESULTS[$#RESULTS-1]->{end_time};
|
| - |
|
626 |
my ($pyyyy, $pmm, $pdd) = split /\-/, $RESULTS[$#RESULTS-1]->{date};
|
| - |
|
627 |
my $prior_end_time = DateTime->new (
|
| - |
|
628 |
year => $pyyyy,
|
| - |
|
629 |
month => $pmm,
|
| - |
|
630 |
day => $pdd,
|
| - |
|
631 |
hour => $peh,
|
| - |
|
632 |
minute => $pem,
|
| - |
|
633 |
second => 0,
|
| - |
|
634 |
time_zone => 'America/Los_Angeles'
|
| - |
|
635 |
);
|
| - |
|
636 |
|
| - |
|
637 |
if ($start_time < $prior_end_time) {
|
| - |
|
638 |
$r->{conflict} = 1;
|
| - |
|
639 |
$RESULTS[$#RESULTS-1]->{conflict} = 1;
|
| - |
|
640 |
}
|
| - |
|
641 |
}
|
| - |
|
642 |
}
|
| 607 |
$sth->execute($RCid, $RCid, $RCid, $RCid, $RCid);
|
643 |
|
| 608 |
my $hours = 0;
|
644 |
my $hours = 0;
|
| 609 |
while (my $s = $sth->fetchrow_hashref) {
|
645 |
foreach my $s (@RESULTS) {
|
| 610 |
my ($yyyy, $mm, $dd) = split /\-/, $s->{date};
|
646 |
my ($yyyy, $mm, $dd) = split /\-/, $s->{date};
|
| 611 |
my $cutoff = DateTime->new(
|
647 |
my $cutoff = DateTime->new (
|
| 612 |
year => $yyyy,
|
648 |
year => $yyyy,
|
| 613 |
month => $mm,
|
649 |
month => $mm,
|
| 614 |
day => $dd,
|
650 |
day => $dd,
|
| 615 |
hour => 5,
|
651 |
hour => 5,
|
| 616 |
minute => 0,
|
652 |
minute => 0,
|
| 617 |
second => 0,
|
653 |
second => 0,
|
| 618 |
time_zone => 'America/Los_Angeles'
|
654 |
time_zone => 'America/Los_Angeles'
|
| Line 619... |
Line -... |
| 619 |
);
|
- |
|
| 620 |
|
655 |
);
|
| 621 |
|
656 |
|
| 622 |
if (!$s->{teams} or $s->{dept} eq "CLA" or $s->{dept} eq "SEM") {
|
657 |
if (!$s->{teams} or $s->{dept} eq "CLA" or $s->{dept} eq "SEM") {
|
| 623 |
# it's a time-based shift
|
658 |
# it's a time-based shift
|
| 624 |
if ($s->{dept} eq "PER") {
|
659 |
if ($s->{dept} eq "PER") {
|
| Line 666... |
Line 701... |
| 666 |
my $onclick = $s->{dept} eq "PER" ? "location.href = 'personal_time.pl?id=$s->{id}';" :
|
701 |
my $onclick = $s->{dept} eq "PER" ? "location.href = 'personal_time.pl?id=$s->{id}';" :
|
| 667 |
($s->{dept} eq "OFF" or $s->{dept} eq "ANN") ? "location.href = 'view_game.pl?id=$s->{id}';" :
|
702 |
($s->{dept} eq "OFF" or $s->{dept} eq "ANN") ? "location.href = 'view_game.pl?id=$s->{id}';" :
|
| 668 |
$s->{dept} eq "CLA" ? "location.href = 'view_class.pl?id=$s->{id}';" :
|
703 |
$s->{dept} eq "CLA" ? "location.href = 'view_class.pl?id=$s->{id}';" :
|
| 669 |
$s->{dept} eq "SEM" ? "location.href = 'view_seminar.pl?id=$s->{id}';" :
|
704 |
$s->{dept} eq "SEM" ? "location.href = 'view_seminar.pl?id=$s->{id}';" :
|
| 670 |
"location.href = 'view_shift.pl?id=$s->{id}';";
|
705 |
"location.href = 'view_shift.pl?id=$s->{id}';";
|
| - |
|
706 |
|
| 671 |
push @shifts, $h->div ({ class=>"rTableRow ".($s->{date} eq $dt ? "highlighted" : "shaded") },
|
707 |
push @shifts, $h->div ({ class=>"rTableRow ".($s->{date} eq $dt ? "highlighted" : "shaded"), style => $s->{conflict} ? "border:2px solid red;" : undef },
|
| 672 |
[$h->div ( { class=>'rTableCellr', style=>"white-space:nowrap;padding:3px 5px 7px 5px;font-size:small;", onClick => $onclick },
|
708 |
[$h->div ( { class=>'rTableCell', style=>"white-space:nowrap;padding:3px 5px 7px 5px;font-size:small;", onClick => $onclick },
|
| 673 |
substr($s->{dayofweek}, 0, 3)." [".$s->{date} =~ s/^\d{4}-(0)?//r =~ s|-(0)?|/|r."]",
|
709 |
substr($s->{dayofweek}, 0, 3)." [".$s->{date} =~ s/^\d{4}-(0)?//r =~ s|-(0)?|/|r."]",
|
| 674 |
$s->{time}.$h->br.
|
710 |
$s->{time}.$h->br.
|
| 675 |
($s->{volhours} ? $s->{volhours}." hrs" : ' '),
|
711 |
($s->{volhours} ? $s->{volhours}." hrs" : ' '),
|
| 676 |
$s->{location},
|
712 |
$s->{location},
|
| 677 |
($s->{dept} eq "CLA" ? "MVP Class" : $s->{dept} eq "SEM" ? "Seminar" : getDepartments()->{$s->{dept}}." - ".$s->{role}) .$h->br.
|
713 |
($s->{dept} eq "CLA" ? "MVP Class" : $s->{dept} eq "SEM" ? "Seminar" : getDepartments()->{$s->{dept}}." - ".$s->{role}) .$h->br.
|
| Line 684... |
Line 720... |
| 684 |
|
720 |
|
| 685 |
if ($output eq "hours") {
|
721 |
if ($output eq "hours") {
|
| 686 |
return $hours;
|
722 |
return $hours;
|
| Line -... |
Line 723... |
| - |
|
723 |
}
|
| - |
|
724 |
|
| - |
|
725 |
unshift @shifts, $h->div ({ class=>"rTableHeading " },
|
| - |
|
726 |
[$h->div ( { class=>'rTableHead', style=>"white-space:nowrap;padding:3px 5px 7px 5px;font-size:small;" },
|
| - |
|
727 |
"Date",
|
| - |
|
728 |
"Time / VolHours",
|
| - |
|
729 |
"Location",
|
| - |
|
730 |
"Dept - Role",
|
| - |
|
731 |
"")
|
| - |
|
732 |
]
|
| 687 |
}
|
733 |
);
|
| 688 |
|
734 |
|
| 689 |
if (scalar @shifts) {
|
735 |
if (scalar @shifts) {
|
| 690 |
return $h->ul ({ style=>"padding-inline-start:5px;" }, [ @shifts, $h->h5 ("Currently showing $hours ".($filter eq "all" ? " total " : "remaining ")."hours of Volunteer Time.") ]);
|
736 |
return $h->ul ({ style=>"padding-inline-start:5px;" }, [$h->div ({ class=>"rTable", style=>"border-collapse:collapse;" }, [ @shifts ]), $h->h5 ("Currently showing $hours ".($filter eq "all" ? " total " : "remaining ")."hours of Volunteer Time.") ]);
|
| 691 |
} elsif ($filter eq "prior") {
|
737 |
} elsif ($filter eq "prior") {
|
| 692 |
return $h->p ({ class=>"hint" }, "[nothing to see here]");
|
738 |
return $h->p ({ class=>"hint" }, "[nothing to see here]");
|
| 693 |
} else {
|
739 |
} else {
|