You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
3.4 KiB

#!/usr/bin/perl
#
# $Id: texp.pl,v 1.7 2006/07/13 23:43:40 ddoughty Exp $
#
# Source File: texp.pl
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
&app_initialize;
print "Content-Type: text/html\n\n";
if (&get_session($FORM{'tid'})) {
&get_test_sequence( $SESSION{'clid'}, $SESSION{'uid'}, $FORM{'tstid'}, $testinprog);
@tsbt = ( $TEST_SESSION{'dscl'}, $TEST_SESSION{'profb'}, $TEST_SESSION{'tstid'},
$TEST_SESSION{'profa'}, $TEST_SESSION{'srvy'} );
$tlastsubtest = 2;
for (0 .. $#tsbt) {
if ($tsbt[$_] ne '') {$tlastsubtest = $_ ;}
}
($tstate,$tsubtest,$tqno) = split(/\./, $TEST_SESSION{'state'});
if ($FORM{'submit'} eq 'timeexpired') {
$TEST_SESSION{'subtest'} = $tsbt[$tsubtest];
&get_test_profile( $TEST_SESSION{'clid'}, $TEST_SESSION{'subtest'});
#if ( $tsubtest > 2 || $TEST{'scr'} eq '3' || $TEST{'emlcndopt'} ne 'Y') {
if ( $tsubtest > 2 || $TEST{'scr'} eq '3' || !($TEST{'emlcndopt'} eq 'Y' || $TEST{'remt'} ne '0')) {
$TEST_SESSION{'message'} = "You have completed the testing.<BR>You will be notified of the results by your administrator.";
$tetmplt = "tend";
} else {
$tetmplt = "tsubend";
}
#$QUESTION{'id'} = &get_question_id($tsubtest, $tqno);
#&get_question_definition($TEST{'id'}, $CLIENT{'clid'}, $QUESTION{'id'});
#&put_question_response($tsubtest, $tqno);
&get_subtest_profile( $TEST_SESSION{'clid'}, $TEST_SESSION{'subtest'});
#&summarize_test($tsubtest);
$passfailflag=&summarize_test($tsubtest);
$FORM{'remediation'} = &remediate_summary($tsubtest);
&put_test_sequence($testinprog, $TEST_SESSION{'clid'}, $TEST_SESSION{'uid'}, $TEST_SESSION{'id'});
$tqno=0; $tsubtest++;
while ($tsbt[$tsubtest] eq '' && $tsubtest < 5) {$tsubtest++;}
if ($tsubtest < 5) {
$TEST_SESSION{'tmreset'} = $TEST{'maxtmfmt'};
$TEST_SESSION{'state'} = "$tstate.$tsubtest.$tqno";
$TEST_SESSION{'subtest'} = $tsbt[$tsubtest];
&get_test_profile( $TEST_SESSION{'clid'}, $TEST_SESSION{'id'});
&put_test_sequence($testinprog, $TEST_SESSION{'clid'}, $TEST_SESSION{'uid'}, $TEST_SESSION{'id'});
$TEST_SESSION{'navbuttons'}="<INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Next\">";
} else {
$tstate = $TEST_STATES{'_TIME_EXPIRED'};
$tsubtest=0; $tqno=0;
$TEST_SESSION{'state'} = "$tstate.$tsubtest.$tqno";
&put_test_sequence($testinprog, $TEST_SESSION{'clid'}, $TEST_SESSION{'uid'}, $TEST_SESSION{'id'});
&promote_test_sequence($testinprog, $testcomplete, $TEST_STATES{'_COMPLETED'});
$endtime = &format_date_time("dd-mmm-yyyy hh:nn:ss GMT", "1", "0");
if ($TEST{'ntfy'} ne '') {
if ($SESSION{'taclid'} eq '') {
&get_candidate_profile( $TEST_SESSION{'clid'}, $TEST_SESSION{'uid'});
} else {
&get_tacl_profile();
}
&get_test_profile( $TEST_SESSION{'clid'}, $TEST_SESSION{'id'});
&send_testresults("2", "$endtime");
}
&send_custom_exit_email($passfailflag);
&get_test_profile( $TEST_SESSION{'clid'}, $TEST_SESSION{'subtest'});
$TEST_SESSION{'navbuttons'}="<INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Logout\" onClick=\"cancel_test()\">";
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "3", "Test Complete $TEST{'id'} - Time Expired", $endtime);
}
$TEST_SESSION{'message'} = "The time allotted for this test has expired.";
&show_template($tetmplt);
&make_anonymous();
} else {
&show_illegal_access_warning;
}
}