Subversion Repositories VORC

Rev

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

Rev 208 Rev 252
Line 37... Line 37...
37
  
37
  
38
	my @emails;
38
	my @emails;
39
  my $dbh = WebDB::connect ();	
39
  my $dbh = WebDB::connect ();	
40
	if ($type eq "class") {
40
	if ($type eq "class") {
-
 
41
    push @emails, map { @{$_} } @{ $dbh->selectall_arrayref ("select email from v_class_signup_new join official on v_class_signup_new.RCid = official.RCid where id = ?", undef, $ID) };
-
 
42
  } elsif ($type eq "seminar") {
41
    push @emails, map { @{$_} } @{ $dbh->selectall_arrayref ("select email from v_class_signup_new join official on v_class_signup_new.RCid = official.RCid where id = ?", undef, $ID) };
43
    push @emails, map { @{$_} } @{ $dbh->selectall_arrayref ("select email from v_seminar_signup_new join official on v_seminar_signup_new.RCid = official.RCid where id = ?", undef, $ID) };
42
	} elsif ($type eq "game") {
44
	} elsif ($type eq "game") {
43
	  push @emails, map { @{$_} } @{ $dbh->selectall_arrayref ("select email from v_shift_officiating where id = ? and isnull(email) = 0 union select email from v_shift_announcer where id = ? and isnull(email) = 0", undef, $ID, $ID) };
45
	  push @emails, map { @{$_} } @{ $dbh->selectall_arrayref ("select email from v_shift_officiating where id = ? and isnull(email) = 0 union select email from v_shift_announcer where id = ? and isnull(email) = 0", undef, $ID, $ID) };
44
	}
46
	}
Line 94... Line 96...
94
print $h->close ("form");
96
print $h->close ("form");
95
print $h->close ("html");
97
print $h->close ("html");
Line 96... Line 98...
96
 
98
 
97
sub chooseType {
99
sub chooseType {
98
  my $type = param ("type") // "";
100
  my $type = param ("type") // "";
Line 99... Line 101...
99
  $type = "" unless ($type eq "class" or $type eq "game");
101
  $type = "" unless ($type eq "class" or $type eq "seminar" or $type eq "game");
100
    
102
    
101
  for ("class", "game") {
103
  for ("class", "seminar", "game") {
102
    my %PROPS = (
104
    my %PROPS = (
103
      type     => "radio",
105
      type     => "radio",
104
      id       => $_,
106
      id       => $_,
Line 122... Line 124...
122
  my $type = shift // "";
124
  my $type = shift // "";
123
  my $ID = param ("ID") // "";
125
  my $ID = param ("ID") // "";
124
  $ID = "" unless $ID =~ /^\d+$/;
126
  $ID = "" unless $ID =~ /^\d+$/;
Line 125... Line 127...
125
  
127
  
126
  if (!$type) {
128
  if (!$type) {
127
    print $h->div ("Please select either Class or Game.");
129
    print $h->div ("Please select Class, Seminar, or Game.");
128
    print $h->input ({type=>"hidden", name=>"ID"});
130
    print $h->input ({type=>"hidden", name=>"ID"});
129
    print $h->br;
131
    print $h->br;
130
    return "";
132
    return "";
131
  } else {
133
  } else {
132
    my $table = $type eq "class" ? "v_class_new" : "v_games";
134
    my $table = $type eq "class" ? "v_class_new" : $type eq "seminar" ? "v_seminar_new" : "v_games";
133
    my $field = $type eq "class" ? "name" : "teams";
135
    my $field = ($type eq "class" or $type eq "seminar") ? "name" : "teams";
134
    my $dbh = WebDB::connect ();
136
    my $dbh = WebDB::connect ();
135
    #push @queued_users, map { @{$_} } @{ $qdbh->selectall_arrayref ("select queueid from queue where timestampdiff(minute, last_seen, now()) < 7 and (timestamp <> last_seen or timestampdiff(second, last_seen, now()) <= 60) order by timestamp") };
137
    #push @queued_users, map { @{$_} } @{ $qdbh->selectall_arrayref ("select queueid from queue where timestampdiff(minute, last_seen, now()) < 7 and (timestamp <> last_seen or timestampdiff(second, last_seen, now()) <= 60) order by timestamp") };
136
    my %things = map { $_->[0] => $_->[1] } @{ $dbh->selectall_arrayref ("select distinct id, $field from $table where year(date) = year(now())") };
138
    my %things = map { $_->[0] => $_->[1] } @{ $dbh->selectall_arrayref ("select distinct id, $field from $table where year(date) = year(now())") };
137
  	$dbh->disconnect ();
139
  	$dbh->disconnect ();
Line 149... Line 151...
149
 
151
 
150
sub printDetails {
152
sub printDetails {
151
  my $type = shift // "";
153
  my $type = shift // "";
Line 152... Line 154...
152
  my $ID   = shift // "";
154
  my $ID   = shift // "";
Line 153... Line 155...
153
  
155
  
Line 154... Line 156...
154
  error ("No Class or Game Selected") unless $type and $ID;
156
  error ("No Class, Semianr, or Game Selected") unless $type and $ID;
155
  
157
  
156
  my $dbh = WebDB::connect ();
158
  my $dbh = WebDB::connect ();
157
  
159
  
158
  my $user_count;
160
  my $user_count;
-
 
161
  if ($type eq "class") {
-
 
162
    print map { $_.$h->br } $dbh->selectrow_array ("select id, name, coach, date, dayofweek, time, location from v_class_new where id = ?", undef, $ID);
-
 
163
    ($user_count) = $dbh->selectrow_array ("select count(email) from v_class_signup_new join official on v_class_signup_new.RCid = official.RCid where id = ?", undef, $ID);
-
 
164
    print $user_count." Users".$h->br;
159
  if ($type eq "class") {
165
  } elsif ($type eq "seminar") {
160
    print map { $_.$h->br } $dbh->selectrow_array ("select id, name, coach, date, dayofweek, time, location from v_class_new where id = ?", undef, $ID);
166
    print map { $_.$h->br } $dbh->selectrow_array ("select id, name, coach, date, dayofweek, time, location from v_seminar_new where id = ?", undef, $ID);
161
    ($user_count) = $dbh->selectrow_array ("select count(email) from v_class_signup_new join official on v_class_signup_new.RCid = official.RCid where id = ?", undef, $ID);
167
    ($user_count) = $dbh->selectrow_array ("select count(email) from v_seminar_signup_new join official on v_seminar_signup_new.RCid = official.RCid where id = ?", undef, $ID);
162
    print $user_count." Users".$h->br;
168
    print $user_count." Users".$h->br;
163
  } elsif ($type eq "game") {
169
  } elsif ($type eq "game") {