Subversion Repositories VORC

Rev

Rev 193 | Rev 208 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 193 Rev 194
Line 9... Line 9...
9
use strict;
9
use strict;
10
use cPanelUserConfig;
10
use cPanelUserConfig;
11
use RollerCon;
11
use RollerCon;
12
use CGI qw/param header start_html url/;
12
use CGI qw/param header start_html url/;
13
use CGI::Cookie;
13
use CGI::Cookie;
14
#use WebDB;
-
 
15
our $h = HTML::Tiny->new( mode => 'html' );
14
our $h = HTML::Tiny->new( mode => 'html' );
16
my $dbh = getRCDBH ();
15
my $dbh = getRCDBH ();
Line 17... Line 16...
17
 
16
 
18
my $cookie_string = authenticate (1) || die;
17
my $cookie_string = authenticate (1) || die;
19
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
-
 
20
#my $user = getUser($EML);
18
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
21
my $user = $ORCUSER;
-
 
22
#$user->{department} = convertDepartments $user->{department};
-
 
23
#my $activated = max (values %{ $user->{department} });
19
my $user = $ORCUSER;
24
my $activated = $ORCUSER->{access};
20
my $activated = $ORCUSER->{access};
Line 25... Line 21...
25
my $DEPTS = getDepartments ();
21
my $DEPTS = getDepartments ();
Line 26... Line 22...
26
 
22
 
27
print header (-cookie=>CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m"));
23
print header (-cookie=>CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m"));
28
 
24
 
Line 29... Line -...
29
#foreach (sort keys %ENV) {
-
 
30
#	print "$_: $ENV{$_}\n<br>";
25
#foreach (sort keys %ENV) {
31
#}
26
#	print "$_: $ENV{$_}\n<br>";
32
 
27
#}
Line 33... Line 28...
33
 
28
 
34
use DateTime;
-
 
35
my $dt = DateTime->today;
-
 
36
$dt =~ s/T00\:00\:00$//;
29
use DateTime;
37
 
30
my $dt = DateTime->today;
38
my @announcements;
31
$dt =~ s/T00\:00\:00$//;
Line 39... Line 32...
39
#push @announcements, $h->li ($h->a ({ href=>'__LINK__?'.$user->{discount_code} }, "THANK YOU! You've earned a discounted pass for next year. Click here to redeem.")) if $user->{discount_code};
32
 
Line 48... Line 41...
48
}
41
}
Line 49... Line 42...
49
 
42
 
50
my ($announcement) = $dbh->selectrow_array ("select value from setting where setting.key = ?", undef, "ANNOUNCEMENT");
43
my ($announcement) = $dbh->selectrow_array ("select value from setting where setting.key = ?", undef, "ANNOUNCEMENT");
Line 51... Line 44...
51
push @announcements, $h->li ($announcement) if $announcement;
44
push @announcements, $h->li ($announcement) if $announcement;
52
 
45
 
53
if ($user->{department}->{OFF} > 0) {
46
#if ($user->{department}->{OFF} > 0) {
54
  my @days = ("Thursday", "Friday", "Saturday");
47
#  my @days = ("Thursday", "Friday", "Saturday");
55
  my @dayschecked;
48
#  my @dayschecked;
56
	foreach my $day (@{$dbh->selectall_arrayref ("select dayofweek from v_shift where year(date) = year(now()) and RCid = ? and role = 'Officiating Huddle'", undef, $user->{RCid})}) {
49
#	foreach my $day (@{$dbh->selectall_arrayref ("select dayofweek from v_shift where year(date) = year(now()) and RCid = ? and role = 'Officiating Huddle'", undef, $user->{RCid})}) {
57
	  push @dayschecked, @{$day};
50
#	  push @dayschecked, @{$day};
58
	}
51
#	}
59
  
52
#  
60
  use tableViewer qw/inArray/;
53
#  use tableViewer qw/inArray/;
61
  push @announcements, $h->li ("Did you attend the Officiating Huddle on:"),
54
#  push @announcements, $h->li ("Did you attend the Officiating Huddle on:"),
62
    $h->form ({ action => "add_officiating_huddle_time.pl", target => "_blank" }, [
55
#    $h->form ({ action => "add_officiating_huddle_time.pl", target => "_blank" }, [
63
      map ({ inArray($_, \@dayschecked) ? $h->input ({ type => "checkbox", name => $_, checked => [] }).$_.$h->br : $h->input ({ type => "checkbox", name => $_ }).$_.$h->br } @days),
56
#      map ({ inArray($_, \@dayschecked) ? $h->input ({ type => "checkbox", name => $_, checked => [] }).$_.$h->br : $h->input ({ type => "checkbox", name => $_ }).$_.$h->br } @days),
64
      $h->input ({ type => "submit", value => scalar @dayschecked ? "Update my hours." : "Give me credit!" })
57
#      $h->input ({ type => "submit", value => scalar @dayschecked ? "Update my hours." : "Give me credit!" })
Line 65... Line 58...
65
    ]);
58
#    ]);
Line 66... Line 59...
66
}
59
#}
Line 73... Line 66...
73
push @printDEPTS, "Officiating Lead" if $user->{department}->{"OFF"} > 1;
66
push @printDEPTS, "Officiating Lead" if $user->{department}->{"OFF"} > 1;
74
my $printDEPTS = join ", ", @printDEPTS;
67
my $printDEPTS = join ", ", @printDEPTS;
75
push @everyone, $h->li ($h->a ({ href=>"/schedule/shifts.pl" }, "View and Sign Up for $printDEPTS Shifts")) if $printDEPTS;
68
push @everyone, $h->li ($h->a ({ href=>"/schedule/shifts.pl" }, "View and Sign Up for $printDEPTS Shifts")) if $printDEPTS;
76
push @everyone, $h->li ($h->a ({ href=>"/schedule/officiating_shifts.pl" }, "View and Sign Up for Officiating Shifts")) if $user->{department}->{OFF} > 0;
69
push @everyone, $h->li ($h->a ({ href=>"/schedule/officiating_shifts.pl" }, "View and Sign Up for Officiating Shifts")) if $user->{department}->{OFF} > 0;
Line -... Line 70...
-
 
70
 
77
 
71
my @OHD_YEARS;
78
if ($user->{department}->{OFF} > 0) {
72
if ($user->{department}->{OFF} > 0) {
79
	foreach my $officiating_year (@{$dbh->selectall_arrayref ("select distinct year(date) as year from v_shift_officiating where RCid = ? and gtype in ('challenge', 'full length', 'selected', 'challenge-rs1', 'challenge-rs2') order by year desc", undef, $user->{RCid})}) {
73
  foreach my $officiating_year (@{$dbh->selectall_arrayref ("select distinct year(date) as year from v_shift_officiating where RCid = ? and gtype in ('challenge', 'full length', 'selected', 'challenge-rs1', 'challenge-rs2') order by year desc", undef, $user->{RCid})}) {
80
    push @everyone, $h->li ($h->a ({ href=>"/schedule/ohd.pl?year=".$officiating_year->[0] }, "Export your $officiating_year->[0] games in WFTDA OHD Format (CSV file)"));
74
    push @OHD_YEARS, $h->li ($h->a ({ href=>"/schedule/ohd.pl?year=".$officiating_year->[0] }, $officiating_year->[0]));
81
	}  
75
  }  
-
 
76
}
Line 82... Line 77...
82
}
77
push @everyone, $h->li (["Export your officiating game assignments in OHD Format (CSV File):", $h->ul ([@OHD_YEARS])]) unless !scalar @OHD_YEARS;
83
 
78
 
84
push @everyone, $h->li ($h->a ({ href=>"/schedule/announcer_shifts.pl" }, "View and Sign Up to Announce Games")) if $user->{department}->{ANN} > 0;
79
push @everyone, $h->li ($h->a ({ href=>"/schedule/announcer_shifts.pl" }, "View and Sign Up to Announce Games")) if $user->{department}->{ANN} > 0;
85
push @everyone, $h->li ($h->a ({ href=>"/schedule/games.pl" }, "View Games"));
80
push @everyone, $h->li ($h->a ({ href=>"/schedule/games.pl" }, "View Games"));
Line 115... Line 110...
115
	push @leads, $h->li ($h->a ({ href=>"/schedule/password_reset.pl" }, "Reset a Password."));
110
	push @leads, $h->li ($h->a ({ href=>"/schedule/password_reset.pl" }, "Reset a Password."));
Line 116... Line 111...
116
 
111
 
117
	# Officiating Leads:
112
	# Officiating Leads:
118
	if ($user->{department}->{OFF} > 1) {
113
	if ($user->{department}->{OFF} > 1) {
119
		unshift @leads, $h->li ($h->a ({ href=>"/schedule/scores.pl" }, "View / Update Game Scores"));
-
 
120
#		 push @leads, $h->li ($h->a ({ href=>"daily_print.pl" }, "Daily Print Report"));
114
		unshift @leads, $h->li ($h->a ({ href=>"/schedule/scores.pl" }, "View / Update Game Scores"));
121
		push @leads, $h->li (["What's happening right now on...", $h->ul ([
115
		push @leads, $h->li (["What's happening right now on...", $h->ul ([
122
			$h->li ($h->a ({ href=>"right_now.pl?t=C1" }, "Track C1")),
116
			$h->li ($h->a ({ href=>"right_now.pl?t=C1" }, "Track C1")),
123
			$h->li ($h->a ({ href=>"right_now.pl?t=C2" }, "Track C2")),
117
			$h->li ($h->a ({ href=>"right_now.pl?t=C2" }, "Track C2")),
124
			$h->li ($h->a ({ href=>"right_now.pl?t=C3" }, "Track C3")),
118
			$h->li ($h->a ({ href=>"right_now.pl?t=C3" }, "Track C3")),
Line 163... Line 157...
163
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/classes.pl" }, "Manage MVP Classes"));
157
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/classes.pl" }, "Manage MVP Classes"));
164
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/games.pl" }, "Manage Games"));
158
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/games.pl" }, "Manage Games"));
165
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/departments.pl" }, "Manage Department Settings"));
159
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/departments.pl" }, "Manage Department Settings"));
166
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/settings.pl" }, "System Settings"));
160
  push @sysadmins, $h->li ($h->a ({ href=>"/schedule/settings.pl" }, "System Settings"));
167
 	push @sysadmins, $h->li ($h->a ({ href=>"/schedule/volhours_report.pl?limit=All" }, "YEAR END VOLUNTEER HOURS REPORT"));
161
 	push @sysadmins, $h->li ($h->a ({ href=>"/schedule/volhours_report.pl?limit=All" }, "YEAR END VOLUNTEER HOURS REPORT"));
-
 
162
 	push @sysadmins, $h->li ($h->a ({ href=>"/schedule/shifts.pl?excel=0&autoload=1&dept=true&date=true&dayofweek=true&time=true&doubletime=true&volhours=true&role=true&location=true&note=true&RCid=true&derby_name=true&filter-dept=COA&filter-date=&filter-dayofweek=&filter-time=&filter-doubletime=&filter-volhours=&filter-role=&filter-location=&filter-note=&filter-RCid=&filter-derby_name=&year=2024&sortby=dayofweek&limit=25&page=1" }, "COACH HOURS REPORT"));
Line 168... Line 163...
168
 
163
 
169
 
164
 
170
 	
165
 	
171
 	my ($unclaimed_tix) = $dbh->selectrow_array ("select count(*) from v_ticket where isnull(RCid) = 1");
166
 	my ($unclaimed_tix) = $dbh->selectrow_array ("select count(*) from v_ticket where isnull(RCid) = 1");
Line 172... Line 167...
172
 	my ($mvpcount)      = $dbh->selectrow_array ("select count(*) from v_ticket where isnull(RCid) = 0");
167
 	my ($mvpcount)      = $dbh->selectrow_array ("select count(*) from v_ticket where isnull(RCid) = 0");
173
 	$mvpcount = 1 unless $mvpcount;
168
 	$mvpcount = 1 unless $mvpcount;
174
 	my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
-
 
Line 175... Line 169...
175
 	
169
 	my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
Line 176... Line 170...
176
  push @mvpcounts, $h->li ($mvpcount." MVP Tickets have been matched in VORC. ($unclaimed_tix remain unmatched.)");
170
 	
177
  push @mvpcounts, $h->li ("They could (in theory) sign up for ".$mvpcount*$class_limit." class spots.");
171
  push @mvpcounts, $h->li ($mvpcount." MVP Tickets have been matched in VORC. ($unclaimed_tix remain unmatched.)");
178
  
172
  push @mvpcounts, $h->li ("They could (in theory) sign up for ".$mvpcount*$class_limit." class spots.");
179
 	
173
 	
Line 180... Line -...
180
 	my ($signupcount, $total_class_count, $available_count) = $dbh->selectrow_array ("select sum(count), sum(capacity), sum(available) from v_class where year(date) = year(now())");
-
 
181
 	
-
 
182
 	$total_class_count //= 0;
-
 
183
 	push @mvpcounts, $h->li ($total_class_count." Total Class Spots");
-
 
184
 	push @mvpcounts, $h->li ($signupcount." Filled Class Spots (".sprintf("%.2f", ($signupcount / $total_class_count) * 100)."\%)") unless !$total_class_count;
174
 	my ($signupcount, $total_class_count, $available_count) = $dbh->selectrow_array ("select sum(count), sum(capacity), sum(available) from v_class where year(date) = year(now())");
185
 	push @mvpcounts, $h->li ($available_count." Available Class Spots (".sprintf("%.2f", ($available_count / $total_class_count) * 100)."\%)") unless !$total_class_count;
-
 
186
 	
175
 	
187
 	
-
 
188
# 	push @sysadmins, $h->li ($mvpcount." MVP Passholders have signed up for ".$signupcount." spots (".sprintf("%.2f", ($signupcount / ($mvpcount*getSetting("MAX_CLASS_SIGNUP"))) * 100)."\% of allowable signups).");
176
 	$total_class_count //= 0;
Line 189... Line 177...
189
# 	push @sysadmins, $h->li (sprintf("%.2f", ($signupcount / $total_class_count) * 100)."\% of total class spaces are filled.");
177
 	push @mvpcounts, $h->li ($total_class_count." Total Class Spots");
190
 	
178
 	push @mvpcounts, $h->li ($signupcount." Filled Class Spots (".sprintf("%.2f", ($signupcount / $total_class_count) * 100)."\%)") unless !$total_class_count;
191
 	my ($active) = $dbh->selectrow_array ("select count(*) from official where last_active > (now() - interval 30 minute)");
179
 	push @mvpcounts, $h->li ($available_count." Available Class Spots (".sprintf("%.2f", ($available_count / $total_class_count) * 100)."\%)") unless !$total_class_count;