#!/usr/bin/perl
#
# $Id: tstart.pl,v 1.6 2006/01/23 21:39:30 ddoughty Exp $
#
# Source File: tstart.pl
# Get config
#####################################################################
#
# MODS by jc 12/22/00
#
# Added code to open a file of client instructions and merge them with the instruction
# list.
#----------------------------------------------------------------
#
# added code to see if there exists an .ins file and merge them with instructions.
# looks for default files for instructions separately for tests and surveys.
#
require 'sitecfg.pl';
require 'testlib.pl';
&app_initialize;
print "Content-Type: text/html\n\n";
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
$TEST{'id'} = $FORM{'tstid'};
# Moved to tqrs.pl so only logged if Start button pressed - DED 12/03/03
#&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Test Start $TEST{'id'}");
&get_client_profile($SESSION{'clid'});
## v support for wilcard login
# (replaced) &get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'});
# (with)
if ($SESSION{'taclid'} eq '') {
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'});
} else {
&get_tacl_profile();
}
## ^ support for wilcard login
&get_test_sequence( $SESSION{'clid'}, $SESSION{'uid'}, $TEST{'id'});
&get_test_profile( $SESSION{'clid'}, $TEST{'id'});
$FORM{'lang'}=$TEST{'deliverlanguage'};
&LanguageSupportInit();
@stqids = split(/&/, $SUBTEST_QUESTIONS{'2'});
$TEST_SESSION{'noq'} = $#stqids;
($tstate,$tsubtest,$tqno) = split(/\./, $TEST_SESSION{'state'});
if ($tstate eq $TEST_STATES{'_PAUSED_BY_USER'} || $tstate eq $TEST_STATES{'_IN_PROGRESS'}) {
($trash, $tmreset) = split(/&/, $SUBTEST_SUMMARY{$tsubtest});
($hrs, $mins, $secs) = split(/:/, $tmreset);
$tmremaining = ($hrs * 60) + $mins;
$TEST{'maxtm'} = $tmremaining;
$TEST{'instructions'} = &prepare_instructions;
$FORM{'submitvalue'} = "$xlatphrase[547]";
$FORM{'allowstart'}="Y";
} elsif ($tstate eq $TEST_STATES{'_PENDING'}) {
$FORM{'submitvalue'} = "$xlatphrase[548]";
$FORM{'allowstart'}="Y";
$TEST{'instructions'} = &prepare_instructions;
} else {
# $instruct = "You have already completed this item.
";
# $instruct = join('', $instruct, "Please logout of this page and click the REFRESH button on your browser to ensure that you are seeing the most current version of your registration page.
");
# $instruct = join('', $instruct, "Please contact your site registrar if you feel you have received this message in error.
");
$instruct = "$xlatphrase[674]";
$TEST{'instructions'} = $instruct;
$FORM{'allowstart'}="N";
}
# decide if we want to show the print button based of if .prb exists
# it will be in the SAME directory with the suffix .prb
$tmptmplt = "tstart";
&show_template($tmptmplt);
}
sub prepare_instructions {
$instructionfile = "$TEST{'id'}.$SESSION{'clid'}.ins";
$instructionfilewithpath = join($pathsep,$questionroot,$instructionfile);
$UsingInsFileFlag = &file_exists($instructionfilewithpath);
unless ( $UsingInsFileFlag ){
$FORM{'submitvalue'}="";
if ($TEST{'seq'} eq 'std') {
if (($TEST{'Ins'} ne '') && ($tstate eq $TEST_STATES{'_PENDING'})) {
$instruct = "THIS TEST REQUIRES PRINTED WORKSHEETS as reference during the test.
";
$instruct = join('', $instruct, "These worksheets will be printed at the start of the test");
if ($TEST{'dscl'} ne '') {
$instruct = join('', $instruct, ", AFTER the ");
if ($TEST{'profb'} eq '') {
$instruct = join('', $instruct, "confidentiality agreement");
} else {
$instruct = join('', $instruct, "pretest questionaire/survey");
}
}
$instruct = join('', $instruct, ".
You will be reminded again before the test has been started.
\ \;
");
}
if ($TEST{'tmd'} eq 'Y') {
$instruct = join('', $instruct, "You will have $TEST{'maxtm'} minutes to complete the $TEST_SESSION{'noq'} questions.
");
$instruct = join('', $instruct, "The time remaining is displayed in the upper ");
$instruct = join('', $instruct, "right hand corner of the screen and the clock stops while pages are loading.
");
} else {
$instruct = "This item is composed of $TEST_SESSION{'noq'} questions.
";
$instruct = join('', $instruct, "You have no time limit to complete this item.
");
$instruct = join('', $instruct, "The current question in the sequence of the total ");
$instruct = join('', $instruct, "number of questions is shown just to the left of the time remaining.
");
}
$oktoskip = ($TEST{'qsk'} eq 'Y') ? "may" : "MAY NOT" ;
$oktobackup = ($TEST{'qpv'} eq 'Y') ? "may" : "MAY NOT" ;
$oktopause = ($TEST{'tpp'} eq 'Y') ? "may" : "MAY NOT" ;
} elsif ($TEST{'seq'} eq 'svy') {
if ($TEST{'tmd'} eq 'Y') {
$instruct = "You will have $TEST{'maxtm'} minutes to complete the $TEST_SESSION{'noq'} questions.
";
$instruct = join('', $instruct, "The time remaining is displayed in the upper ");
$instruct = join('', $instruct, "right hand corner of the screen and the clock stops while pages are loading.
");
} else {
$instruct = "The survey/questionaire is composed of $TEST_SESSION{'noq'} questions.
";
$instruct = join('', $instruct, "You have no time limit to complete these questions.
");
#$instruct = join('', $instruct, "The current question in the sequence of the total ");
#$instruct = join('', $instruct, "number of questions is shown just to the left of the time remaining.
");
}
$oktoskip = ($TEST{'qsk'} eq 'Y') ? "may" : "MAY NOT" ;
$oktobackup = ($TEST{'qpv'} eq 'Y') ? "may" : "MAY NOT" ;
$oktopause = ($TEST{'tpp'} eq 'Y') ? "may" : "MAY NOT" ;
} elsif ($TEST{'seq'} eq 'dmg') {
$instruct = "The survey/questionaire you are taking is adaptive.
";
$instruct = join('', $instruct, "After the first question, the questions you are presented will depend on previous answers.
");
$instruct = join('', $instruct, "Because of this, the number of questions depends on the answers you give.
");
if ($TEST{'tmd'} eq 'Y') {
$instruct = "You will have $TEST{'maxtm'} minutes to complete the survey/questionaire.
";
$instruct = join('', $instruct, "The time remaining is displayed in the upper ");
$instruct = join('', $instruct, "right hand corner of the screen and the clock stops while pages are loading.
");
} else {
$instruct = join('', $instruct, "You have no time limit to complete this survey/questionaire.
");
}
$oktoskip = "MAY NOT";
$oktobackup = "MAY NOT";
$oktopause = "MAY NOT";
} else {
$instruct = "The test you are taking is an adaptive test.
";
$instruct = join('', $instruct, "The goal of this type of test is to achieve a predetermined endpoint or set of endpoints in the allotted time.
");
$instruct = join('', $instruct, "After the first test question, the questions you are presented will depend on the previous answer.
");
$instruct = join('', $instruct, "Because of this, the number of questions depends on the answers you give.
");
$instruct = join('', $instruct, "You will have $TEST{'maxtm'} minutes to complete this item.
");
$oktoskip = "MAY NOT";
$oktobackup = "MAY NOT";
$oktopause = "MAY NOT";
}
# Starting little bullet list of special instructions.
$instruct = join('', $instruct, "