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.
240 lines
12 KiB
240 lines
12 KiB
#!/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 = "<B>You have already completed this item.</B><BR>";
|
|
# $instruct = join('', $instruct, "<B>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.</B><BR>");
|
|
# $instruct = join('', $instruct, "Please contact your site registrar if you feel you have received this message in error.<BR>");
|
|
$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 = "<B>THIS TEST REQUIRES PRINTED WORKSHEETS</B> as reference during the test.<BR>";
|
|
$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, ".<BR>You will be reminded again before the test has been started.<BR>\ \;<BR>");
|
|
}
|
|
if ($TEST{'tmd'} eq 'Y') {
|
|
$instruct = join('', $instruct, "You will have <B>$TEST{'maxtm'} minutes</B> to complete the <B>$TEST_SESSION{'noq'} questions.</B><BR>");
|
|
$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.<BR>");
|
|
} else {
|
|
$instruct = "This item is composed of <B>$TEST_SESSION{'noq'} questions.</B><BR>";
|
|
$instruct = join('', $instruct, "You have no time limit to complete this item.<BR>");
|
|
$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.<BR>");
|
|
}
|
|
$oktoskip = ($TEST{'qsk'} eq 'Y') ? "may" : "<U>MAY NOT</U>" ;
|
|
$oktobackup = ($TEST{'qpv'} eq 'Y') ? "may" : "<U>MAY NOT</U>" ;
|
|
$oktopause = ($TEST{'tpp'} eq 'Y') ? "may" : "<U>MAY NOT</U>" ;
|
|
} elsif ($TEST{'seq'} eq 'svy') {
|
|
if ($TEST{'tmd'} eq 'Y') {
|
|
$instruct = "You will have <B>$TEST{'maxtm'} minutes</B> to complete the <B>$TEST_SESSION{'noq'} questions.</B><BR>";
|
|
$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.<BR>");
|
|
} else {
|
|
$instruct = "The survey/questionaire is composed of <B>$TEST_SESSION{'noq'} questions.</B><BR>";
|
|
$instruct = join('', $instruct, "You have no time limit to complete these questions.<BR>");
|
|
#$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.<BR>");
|
|
}
|
|
$oktoskip = ($TEST{'qsk'} eq 'Y') ? "may" : "<U>MAY NOT</U>" ;
|
|
$oktobackup = ($TEST{'qpv'} eq 'Y') ? "may" : "<U>MAY NOT</U>" ;
|
|
$oktopause = ($TEST{'tpp'} eq 'Y') ? "may" : "<U>MAY NOT</U>" ;
|
|
} elsif ($TEST{'seq'} eq 'dmg') {
|
|
$instruct = "The survey/questionaire you are taking is adaptive.<BR>";
|
|
$instruct = join('', $instruct, "After the first question, the questions you are presented will depend on previous answers.<BR>");
|
|
$instruct = join('', $instruct, "Because of this, the number of questions depends on the answers you give.<BR>");
|
|
if ($TEST{'tmd'} eq 'Y') {
|
|
$instruct = "You will have <B>$TEST{'maxtm'} minutes</B> to complete the survey/questionaire.</B><BR>";
|
|
$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.<BR>");
|
|
} else {
|
|
$instruct = join('', $instruct, "You have no time limit to complete this survey/questionaire.<BR>");
|
|
}
|
|
$oktoskip = "<U>MAY NOT</U>";
|
|
$oktobackup = "<U>MAY NOT</U>";
|
|
$oktopause = "<U>MAY NOT</U>";
|
|
} else {
|
|
$instruct = "The test you are taking is an adaptive test.<BR>";
|
|
$instruct = join('', $instruct, "The goal of this type of test is to achieve a predetermined endpoint or set of endpoints in the allotted time.<BR>");
|
|
$instruct = join('', $instruct, "After the first test question, the questions you are presented will depend on the previous answer.<BR>");
|
|
$instruct = join('', $instruct, "Because of this, the number of questions depends on the answers you give.<BR>");
|
|
$instruct = join('', $instruct, "You will have <B>$TEST{'maxtm'} minutes</B> to complete this item.</B><BR>");
|
|
$oktoskip = "<U>MAY NOT</U>";
|
|
$oktobackup = "<U>MAY NOT</U>";
|
|
$oktopause = "<U>MAY NOT</U>";
|
|
}
|
|
|
|
# Starting little bullet list of special instructions.
|
|
$instruct = join('', $instruct, "<UL><FONT SIZE=3><B>Special Instructions</B></FONT>");
|
|
if ($TEST{'dscl'} ne '') {
|
|
if ($tstate eq $TEST_STATES{'_PENDING'}) {
|
|
$FORM{'submitvalue'} = "$xlatphrase[550]";
|
|
$instruct = join('', $instruct, "<LI><B><U>You must review the confidentiality agreement. ");
|
|
$instruct = join('', $instruct, "By proceeding with this item you are explicitly agreeing to abide by");
|
|
$instruct = join('', $instruct, " the terms and conditions of the agreement.</U></B>");
|
|
} else {
|
|
$instruct = join('', $instruct, "<LI><B><U>You previously agreed to a confidentiality agreement. ");
|
|
$instruct = join('', $instruct, "By proceeding with this item you are explicitly agreeing to abide by");
|
|
$instruct = join('', $instruct, " the terms and conditions of the agreement.</U></B>");
|
|
}
|
|
}
|
|
if ($TEST{'profb'} ne '') {
|
|
unless ($FORM{'submitvalue'}) {
|
|
$FORM{'submitvalue'} = "$xlatphrase[551]";
|
|
}
|
|
$instruct = join('', $instruct, "<LI><B>You must complete the profile questionaire that precedes this item.");
|
|
$instruct = join('', $instruct, " Information collected in the questionaire is for internal use only");
|
|
$instruct = join('', $instruct, " and will not be released to any other company, agency, or concern.</B>");
|
|
}
|
|
unless ($FORM{'submitvalue'}) {
|
|
$FORM{'submitvalue'} = "$xlatphrase[548]";
|
|
}
|
|
if ($TEST{'profa'} ne '') {
|
|
$instruct = join('', $instruct, "<LI><I>We would appreciate your completion of the optional profile questionaire that follows this item.");
|
|
$instruct = join('', $instruct, " Information collected in the questionaire is for internal use only");
|
|
$instruct = join('', $instruct, " and will not be released to any other company, agency, or concern.</I>");
|
|
}
|
|
|
|
if ($TEST{'srvy'} ne '') {
|
|
$instruct = join('', $instruct, "<LI><I>We would appreciate your completion of the optional survey that follows this item.");
|
|
$instruct = join('', $instruct, " Information collected in the survey is for internal use only");
|
|
$instruct = join('', $instruct, " and will used to evaulate and enhance this item.</I>");
|
|
}
|
|
|
|
#skip these if it is a survey
|
|
if (($TEST{'seq'} ne 'svy') && ($TEST{'seq'} ne 'dmg')){
|
|
$instruct = join('', $instruct, "<LI>You $oktoskip skip questions you are unsure of and review them at the end.");
|
|
$instruct = join('', $instruct, "<LI>You $oktobackup go back to previous questions during the activity.");
|
|
$instruct = join('', $instruct, "<LI>You $oktopause pause the session at any time.");
|
|
}
|
|
#rewordeded the following line:
|
|
$instruct = join('', $instruct, "<LI>After the final question, click the \"Done\" button.");
|
|
$instruct = join('', $instruct, "</UL>");
|
|
# end of Acts' special instructions
|
|
} # end of big conditional : unless $UsingInsFileFlag-------------------
|
|
|
|
# Now if we're using the instruction file, do it.
|
|
# and if there exists a defaultsvy.ins file or a defaulttst.ins file then open em and add em in.
|
|
if ( $UsingInsFileFlag ) {
|
|
$instructionstring =&get_file_html_body($instructionfilewithpath);
|
|
$instruct = join('',$instruct,"$instructionstring ");
|
|
$FORM{'usingcustomins'}="Y";
|
|
} elsif ($TEST{'seq'} eq 'svy') {
|
|
#Get default instructions for SURVEY.
|
|
$defaultsvyinstructionswithpath = join($pathsep, $questionroot,"$SESSION{'clid'}.defaultsvy.ins");
|
|
if ( &file_exists($defaultsvyinstructionswithpath) ) {
|
|
$instructionstring =&get_file_html_body($defaultsvyinstructionswithpath);
|
|
$instruct = join('',$instruct,"$instructionstring ");
|
|
}
|
|
} else {
|
|
# At the moment in ALL OTHER CASES, use the default test instructions, if such exist.
|
|
# Get default instructions for a test.
|
|
$FORM{'usingcustomins'}="N";
|
|
$defaulttestinstructionswithpath = join($pathsep, $questionroot,"$SESSION{'clid'}.defaulttst.ins");
|
|
if ( &file_exists($defaulttestinstructionswithpath)) {
|
|
$instructionstring =&get_file_html_body($defaulttestinstructionswithpath);
|
|
$instruct = join('',$instruct,"$instructionstring ");
|
|
}
|
|
}
|
|
#--------end jack's edits.
|
|
if ($tstate eq $TEST_STATES{'_PENDING'}) {
|
|
#hkh bug#29 - change to 'Review Confidentiality Agreement' button
|
|
if ($FORM{'submitvalue'} eq "$xlatphrase[550]") {
|
|
$instruct = join('', $instruct, "$xlatphrase[770]<BR>");
|
|
} else {
|
|
$instruct = join('', $instruct, "$xlatphrase[651]<BR>");
|
|
}
|
|
} else {
|
|
$instruct = join('', $instruct, "$xlatphrase[673]<BR>");
|
|
}
|
|
$instruct = join('', $instruct, "$xlatphrase[652]<BR>");
|
|
return $instruct;
|
|
}
|
|
|
|
# sac get_file_to_html_string() function
|
|
# renamed to get_file_html_body() and moved to smilib.pl
|
|
|