| Line 14... |
Line 14... |
| 14 |
use CGI qw/param header start_html url/;
|
14 |
use CGI qw/param header start_html url/;
|
| 15 |
my $h = HTML::Tiny->new( mode => 'html' );
|
15 |
my $h = HTML::Tiny->new( mode => 'html' );
|
| Line 16... |
Line 16... |
| 16 |
|
16 |
|
| Line 17... |
Line 17... |
| 17 |
my %F;
|
17 |
my %F;
|
| 18 |
|
18 |
|
| 19 |
my $cookie_string = authenticate (1) || die;
|
19 |
my $cookie_string = authenticate (RollerCon::USER) || die;
|
| 20 |
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
20 |
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
| 21 |
my $user = getUser ($EML);
|
21 |
my $user = getUser ($EML);
|
| 22 |
$user->{department} = convertDepartments $user->{department};
|
22 |
$user->{department} = convertDepartments $user->{department};
|
| Line 179... |
Line 179... |
| 179 |
|
179 |
|
| 180 |
sub display_form {
|
180 |
sub display_form {
|
| 181 |
my $R = shift;
|
181 |
my $R = shift;
|
| 182 |
my $view = shift // "";
|
182 |
my $view = shift // "";
|
| - |
|
183 |
my $actionbutton;
|
| Line 183... |
Line 184... |
| 183 |
my $actionbutton;
|
184 |
my $coachRCid;
|
| Line 184... |
Line 185... |
| 184 |
|
185 |
|
| 185 |
$view = "View" unless $LVL >= RollerCon::ADMIN;
|
186 |
$view = "View" unless $LVL >= RollerCon::ADMIN;
|
| Line 234... |
Line 235... |
| 234 |
$actionbutton .= formField ("Cancel");
|
235 |
$actionbutton .= formField ("Cancel");
|
| 235 |
} else {
|
236 |
} else {
|
| 236 |
# We're just looking at it...
|
237 |
# We're just looking at it...
|
| 237 |
print $h->p ("Viewing Class: $R->{$primary}...");
|
238 |
print $h->p ("Viewing Class: $R->{$primary}...");
|
| 238 |
$F{$DBFields[0]} .= $h->input ({ type=>"hidden", name=>$DBFields[0], value=> $F{$DBFields[0]} });
|
239 |
$F{$DBFields[0]} .= $h->input ({ type=>"hidden", name=>$DBFields[0], value=> $F{$DBFields[0]} });
|
| - |
|
240 |
$coachRCid = $F{coach};
|
| 239 |
$F{coach} = $h->a ({ href=>"/schedule/view_user.pl?RCid=$F{coach}" }, getUserDerbyName $F{coach});
|
241 |
$F{coach} = $h->a ({ href=>"/schedule/view_user.pl?RCid=$F{coach}" }, getUserDerbyName $F{coach});
|
| Line 240... |
Line 242... |
| 240 |
|
242 |
|
| 241 |
$F{start_time} = convertTime $F{start_time};
|
243 |
$F{start_time} = convertTime $F{start_time};
|
| 242 |
$F{end_time} = convertTime $F{end_time};
|
244 |
$F{end_time} = convertTime $F{end_time};
|
| Line 283... |
Line 285... |
| 283 |
);
|
285 |
);
|
| Line 284... |
Line 286... |
| 284 |
|
286 |
|
| 285 |
print $actionbutton;
|
287 |
print $actionbutton;
|
| Line 286... |
Line -... |
| 286 |
print $h->close ("form");
|
- |
|
| 287 |
|
288 |
print $h->close ("form");
|
| - |
|
289 |
|
| - |
|
290 |
my $dbh = WebDB::connect ();
|
| - |
|
291 |
|
| - |
|
292 |
my ($class_is_over) = $dbh->selectrow_array ("select 1 from v_class where $primary = ? and concat_ws(' ', date, end_time) < date_sub(now(), interval 2 hour)", undef, $R->{$primary});
|
| 288 |
if ($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::LEAD) {
|
293 |
|
| Line 289... |
Line 294... |
| 289 |
my $dbh = WebDB::connect ();
|
294 |
if (($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::LEAD) and !$class_is_over) {
|
| 290 |
my ($count) = $dbh->selectrow_array ("select count from v_class where $primary = ?", undef, $R->{$primary});
|
295 |
my ($count) = $dbh->selectrow_array ("select count from v_class where $primary = ?", undef, $R->{$primary});
|
| Line 303... |
Line 308... |
| 303 |
$h->div ({ class=>"liRight" }, ($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::LEAD) ? $h->a ({ style=>"font-size:small", onClick=>"if (confirm('Really? Delete $$_[2] from this class?')==true) { window.open('make_shift_change.pl?change=del&RCid=$$_[1]&id=$R->{$primary}&role=$$_[0]','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "[DROP]") : "")
|
308 |
$h->div ({ class=>"liRight" }, ($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::LEAD) ? $h->a ({ style=>"font-size:small", onClick=>"if (confirm('Really? Delete $$_[2] from this class?')==true) { window.open('make_shift_change.pl?change=del&RCid=$$_[1]&id=$R->{$primary}&role=$$_[0]','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "[DROP]") : "")
|
| 304 |
])
|
309 |
])
|
| 305 |
) } @A ])
|
310 |
) } @A ])
|
| 306 |
]);
|
311 |
]);
|
| 307 |
}
|
312 |
}
|
| 308 |
$dbh->disconnect;
|
- |
|
| 309 |
}
|
313 |
}
|
| - |
|
314 |
|
| - |
|
315 |
if (($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::LEAD or $ORCUSER->{RCid} == $coachRCid) and $class_is_over) {
|
| - |
|
316 |
my ($response_count) = $dbh->selectrow_array ("select count(distinct(RCid)) from v_survey_answer where classid = ?", undef, $R->{$primary});
|
| - |
|
317 |
my $exclude_private = ($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::LEAD) ? "" : "and private = 0";
|
| - |
|
318 |
|
| - |
|
319 |
my @RESPONSES = @{$dbh->selectall_arrayref ("select qorder, type, question, average, qid from v_survey_results where classid = ? $exclude_private", undef, $R->{$primary})};
|
| - |
|
320 |
|
| - |
|
321 |
print $h->br, $h->br;
|
| - |
|
322 |
print $h->div ({ class=>"index", style=>"max-width:610px" }, [ $h->p ({ class=>"heading" }, [ "Survey Results: ", $response_count." Response".(($response_count > 1) ? "s" : "") ]),
|
| - |
|
323 |
$h->ul ( [ map { $h->li ({ class=>"shaded", style=>"margin:4px;" },
|
| - |
|
324 |
$h->div ({ class=>"lisp0" }, [
|
| - |
|
325 |
$h->div ({ class=>"liLeft" }, [ $$_[0], ": ", $$_[2] ]),
|
| - |
|
326 |
$h->div ({ class=>"liRight" }, [ $$_[1] eq "text" ?
|
| - |
|
327 |
$h->a ({ href=>"view_survey_comments.pl?classid=$R->{$primary}&qid=$$_[4]" }, [ $$_[3], (($$_[3] == 1) ? " comment" : " comments") ]) :
|
| - |
|
328 |
$$_[3] ])
|
| - |
|
329 |
# $h->div ({ class=>"liRight" }, [ $$_[3], $$_[1] eq "text" ? (($$_[3] == 1) ? " comment" : " comments") : "" ])
|
| - |
|
330 |
# $h->div ({ class=>"liRight" }, $h->a ({ href=>"view_survey_comments.pl?classid=$R->{$primary}&qid=$$_[4]" }, $$_[3].$$_[1] eq "text" ? (($$_[3] == 1) ? " comment" : " comments") : ""))
|
| - |
|
331 |
])
|
| - |
|
332 |
) } @RESPONSES ])
|
| - |
|
333 |
]);
|
| - |
|
334 |
|
| - |
|
335 |
|
| - |
|
336 |
|
| - |
|
337 |
}
|
| - |
|
338 |
$dbh->disconnect;
|
| 310 |
}
|
339 |
}
|
| Line 311... |
Line 340... |
| 311 |
|
340 |
|
| 312 |
sub process_form {
|
341 |
sub process_form {
|