#!/usr/bin/perl # # $Id: tmasterp.pl,v 1.5 2006/10/17 14:39:59 ddoughty Exp $ # # Source File: tmasterp.pl # Get config require 'sitecfg.pl'; require 'testlib.pl'; $FORM{'frm'}=""; &app_initialize; if ($FORM{'outputto'} eq 'html') { print "Content-Type: application/x-doc\n\n"; $bDisplay = 0; } else { print "Content-Type: text/html\n\n"; $bDisplay = 1; } if (&get_session($FORM{'tid'})) { &LanguageSupportInit(); if ($FORM{'clid'} eq '') { &get_client_profile($SESSION{'clid'}); &get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'}); } else { &get_client_profile($FORM{'clid'}); &get_candidate_profile( $FORM{'clid'}, $FORM{'cndid'}); } &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); &get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $TEST{'id'}, $testpending); &CreateMasters(); } sub CreateMasters() { if ($TEST{'seq'} eq 'svy') { @skilllevel = ( '','','','' ); $itemdescription = "Survey"; } else { @skilllevel = ( 'Basic','Intermediate','Advanced','' ); $itemdescription = "Test"; } $oshowqid = ($FORM{'showqid'} ne '') ? 1 : 0; $oshowsubj = ($FORM{'showsubj'} ne '') ? 1 : 0; $oshowskill = ($FORM{'showskill'} ne '') ? 1 : 0; $oautoprint = ($FORM{'outputto'} eq 'autoprint') ? 1 : 0; $oblackoutthrowoffs = ($FORM{'blackoutthrowoffs'} ne '') ? 1 : 0; $onoradios = ($FORM{'noradios'} ne '') ? 1 : 0; $tcolor=$FORM{'ocrtextcolor'}; $printwidth = 640; $titlewidth = 260; $titlecolwidth = 190; if ($FORM{'prtwidth'} ne '') { $printwidth = int($FORM{'prtwidth'}); $titlewidth = int($printwidth / 2); $titlecolwidth = int($titlewidth / 2); if ($titlecolwidth < 170) { $titlewidth = int($printwidth - ($titlecolwidth * 2)); } } $refpage = ($FORM{'showgraphics'} eq 'refpage') ? 1 : 0; if ($refpage) { $showgraphics = 1; } else { $showgraphics = ($FORM{'showgraphics'} eq 'ON') ? 1 : 0; } $ocrstyle=($FORM{'ocrstyle'} ne '') ? 1 : 0; if ($ocrstyle) { $scoreboxwarning = "MARK THE CIRCLES UNDER THE CORRECT ANSWER LABEL FOR EACH QUESTION USING A \#2 LEAD PENCIL ONLY."; } else { $printscoreboxes = ($FORM{'showscoreboxes'} ne '') ? 1 : 0; $scoreboxwarning = ($printscoreboxes) ? "DO NOT MARK BOXES TO THE RIGHT OF THE QUESTION. (FOR SCORING USE ONLY)" : ""; } if ($FORM{'showdates'} ne '') { $testavailabilitydates = "Take On/After:
$TEST{'availon'}
Take On/Before:
$TEST{'availthru'}
\n"; } else { $testavailabilitydates = ""; } @questions = split(/&/,$SUBTEST_QUESTIONS{2}); @keyanswers = split(/&/,$SUBTEST_ANSWERS{2}); $masterid = 1; $timed = ($TEST{'tmd'} eq 'Y') ? "Allotted Time: $TEST{'maxtm'} mins" : ""; $testmasterdir = join($pathsep, $secroot, "tests", "master"); if ($oautoprint) { print " \n"; } else { print " \n"; } if ($ocrstyle) { @ocrsheets=(); $ocrsheets[0] = ($FORM{'showmaster'} ne '') ? 1 : 0; $ocrsheets[1] = ($FORM{'showocransw'} ne '') ? 1 : 0; $ocrsheets[2] = ($FORM{'showkey'} ne '') ? 1 : 0; for (0 .. 2) { $keyprint = (($ocrsheets[$_]) && ($_ == 2)) ? 1 : 0; if ($ocrsheets[$_]) { $ocrsheetno=$_; if ($ocrsheetno > 0) { $textcolor="color=\"$tcolor\""; $bordercolor="bordercolor=\"$tcolor\""; $scoreboxwarning = "MARK THE CIRCLES UNDER THE CORRECT ANSWER LABEL FOR EACH QUESTION USING A \#2 LEAD PENCIL ONLY."; $keyhdr = ($keyprint) ? "KEY" : "ANSWER SHEET"; } else { $textcolor="black"; $bordercolor="black"; $scoreboxwarning = "DO NOT MARK ON THIS PAGE. USE THE ANSWER SHEET TO MARK ALL ANSWERS WITH A \#2 PENCIL."; } if (($ocrstyle) && ($ocrsheetno > 0)) { &PrintPageHeader(); &PrintSectionHeader(); &PrintQuestionsOCR(); &PrintSection(); } else { $keyhdr = ($keyprint) ? "KEY" : ""; @pagequestions = &PrintQuestions(); if (($refpage == 1) && ($referencepage ne '')) { $referencepage = join('', "\n", $referencepage); } &PrintPageHeader(); &PrintSectionHeader(); for (0 .. $#pagequestions) { print $pagequestions[$_]; print "\ \;
\n"; } } @pagequestions = (); print "\n$referencepage\n"; if ($bDisplay) { print "\n"; } } } } else { $ocrsheetno=-1; $textcolor="black"; $bordercolor="black"; $keyprint = ($FORM{'showkey'} ne '') ? 1 : 0; $printsheet = ($FORM{'showmaster'} ne '') ? 1 : 0; $keyhdr = ($keyprint) ? "KEY" : ""; @pagequestions = &PrintQuestions(); if (($refpage == 1) && ($referencepage ne '')) { $referencepage = join('', "\n", $referencepage); } &PrintPageHeader(); &PrintSectionHeader(); for (0 .. $#pagequestions) { print $pagequestions[$_]; print "\ \;
\n"; } @pagequestions = (); print "\n$referencepage\n"; if ($bDisplay) { print "\n"; } } print " "; } sub PrintPageHeader { if ($bDisplay) { print "
"; } print "
Master: $TEST{'id'}.001
Questions: $#questions
$timed
$TEST{'desc'}
$keyhdr
Taker ID: $CANDIDATE{'uid'}
$testavailabilitydates
\ \;
Date:\ \; "; if ($bDisplay) { print ""; } else { print "____________"; } print " \ \; Name:\ \; "; if ($bDisplay) { print ""; } else { print "______________________________"; } print " \ \; Email:\ \; "; if ($bDisplay) { print ""; } else { print "______________________________"; } print "
$scoreboxwarning
"; } sub PrintSectionHeader { my $noq=$#questions; if (($ocrstyle) && ($ocrsheetno != 0)) { @ocrcoltbl0=(); @ocrcoltbl1=(); @ocrcoltbl2=(); $ocrcolumns = int($noq/50); my $vernoq = $ocrcolumns*50; if ($vernoq != $noq) { $ocrcolumns++; } $ocrtblwidth=510/$ocrcolumns; print "\n"; } else { print "
"; } } sub PrintSection { if ($ocrstyle) { my $i; print "\n\n"; if ($ocrcolumns > 1) { print "\n"; } if ($ocrcolumns > 2) { print "\n"; } print "<\TR>\n"; } } sub PrintQuestionsOCR() { my $trash; my $r=0; my $c=0; my $rowhtml; my $questionindex; $referencepage = ""; $allowupdate = 0; $scored = 1; foreach $questionindex (1 .. $#questions) { &get_question_definition($TEST{'id'},$CLIENT{'clid'},$questions[$questionindex]); $qtype = $QUESTION{'qtp'}; $anstype = $QUESTION{'qalb'}; ($qsubj, $sklvl) = split(/\./, $QUESTION{'subj'}); if ($sklvl eq '') { $sklvl = 3; } ($keyresponse,$kflags) = split(/::/, $keyanswers[$questionindex]); $scoreable = 1; $credit = $noanswertag; $checked = ""; $answerkey = ""; $studentkey = ""; $qanswermatch = ""; @txts = (); if ($qtype eq 'nrt') { # &PrintQuestionNRT($TEST{'seq'}); } elsif ($qtype eq 'tf') { &PrintQuestionTF($TEST{'seq'}); } elsif ($qtype eq 'esa') { # &PrintQuestionESA($TEST{'seq'}); } elsif ($qtype eq 'mcs') { &PrintQuestionMCS($TEST{'seq'}); } elsif ($qtype eq 'mcm') { # &PrintQuestionMCM($TEST{'seq'}); } elsif ($qtype eq 'mch') { # &PrintQuestionMCH($TEST{'seq'}); } elsif ($qtype eq 'ord') { # &PrintQuestionORD($TEST{'seq'}); } $rowhtml = join('',"","",$answerkey,"\n"); $c=int(($questionindex-1) / 50); $r=(($questionindex-1) % 50); if ($c == 0) { push @ocrcoltbl0,$rowhtml; } elsif ($c==1) { push @ocrcoltbl1,$rowhtml; } elsif ($c==2) { push @ocrcoltbl2,$rowhtml; } } } sub PrintQuestions() { my $trash; $referencepage = ""; $allowupdate = 0; $scored = 1; @tstquestions = (); foreach $questionindex (1 .. $#questions) { &get_question_definition($TEST{'id'},$CLIENT{'clid'},$questions[$questionindex]); $qtype = $QUESTION{'qtp'}; $anstype = $QUESTION{'qalb'}; ($qsubj, $sklvl) = split(/\./, $QUESTION{'subj'}); if ($sklvl eq '') { $sklvl = 3; } ($keyresponse,$kflags) = split(/::/, $keyanswers[$questionindex]); $scoreable = 1; $credit = $noanswertag; $checked = ""; $answerkey = "
 
 
 
 

\n"; print "\n"; for $i (0 .. $#ocrcoltbl0) { print "$ocrcoltbl0[$i]"; } print "
\n
\n"; print "\n"; for $i (0 .. $#ocrcoltbl1) { print "$ocrcoltbl1[$i]"; } print "
\n
\n"; print "\n"; for $i (0 .. $#ocrcoltbl2) { print "$ocrcoltbl2[$i]"; } print "
\n
$questionindex.
\n"; $studentkey = ""; $qanswermatch = ""; @txts = (); if ($qtype eq 'nrt') { &PrintQuestionNRT($TEST{'seq'}); } elsif ($qtype eq 'tf') { &PrintQuestionTF($TEST{'seq'}); } elsif ($qtype eq 'esa') { &PrintQuestionESA($TEST{'seq'}); } elsif ($qtype eq 'mcs') { &PrintQuestionMCS($TEST{'seq'}); } elsif ($qtype eq 'mcm') { &PrintQuestionMCM($TEST{'seq'}); } elsif ($qtype eq 'mch') { &PrintQuestionMCH($TEST{'seq'}); } elsif ($qtype eq 'ord') { &PrintQuestionORD($TEST{'seq'}); } if ($qtype ne 'esa' ) { $answerkey = join('', $answerkey,"
\n"); } $qlinked = ""; $questionillustration = ""; if ($showgraphics) { if ($QUESTION{'qim'} eq '1') { $qlinked = $QUESTION{'illustration'}; ($trash,$qlinked)= split(/img=/, $qlinked); ($qlinked,$trash) = split(/\" /, $qlinked); $qlinked = ""; } elsif ($QUESTION{'qim'} eq '2') { $qlinked = $QUESTION{'illustration'}; } if ($qlinked ne "") { if ($refpage) { $referencepage = join('', $referencepage,"Illustration below is for question $questionindex.
\n$qlinked
\ \;
\n"); } else { $questionillustration = " \ \;
Illustration below is for question $questionindex.
$qlinked \n"; } $questionillustration =~ s/BORDER=0/BORDER=1/g; } } $qother = ""; $joinsc = " "; if ($oshowqid) { $qother = join('', $qother, "$QUESTION{'id'}"); $joinsc = ":"; } if ($oshowsubj) { $qother = join($joinsc, $qother, "$qsubj "); $joinsc = ":"; } if ($oshowskill) { $qother = join($joinsc, $qother, "$skilllevel[$sklvl] "); } if ($qother ne '') { $qother = join('', "", uc($qother), "
"); } $scoremsg = ($printscoreboxes) ? "
\nSCORING
USE ONLY" : ""; if ($colspan eq 2) { $tstquestion = "$questionillustration $questionindex. $qother$QUESTION{'qtx'} $scoremsg $answerkey \n"; } else { $tstquestion = "$questionillustration $questionindex. $qother$QUESTION{'qtx'} $scoremsg $answerkey $qanswermatch \n"; } push @tstquestions, $tstquestion; } return @tstquestions; } sub PrintQuestionNRT { my ($ttyp) = @_; $answerkey = join('',$answerkey,"\n"); if ($keyprint == 1) { $answerkey = join('',$answerkey,""); } else { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\n"); $colspan=2; } sub PrintQuestionTF { my ($ttyp) = @_; $answerkey = join('',$answerkey,"\n"); if ($ttyp eq 'svy') { $checked = ($QUESTION{'qca'} eq "TRUE") ? "CHECKED": ""; $checked = ($keyprint == 1) ? $checked : ""; if (!$onoradios) { $answerkey .= ""; } $answerkey .= "TRUE
\n"; $checked = ($QUESTION{'qca'} eq "FALSE") ? "CHECKED": ""; $checked = ($keyprint == 1) ? $checked : ""; if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"FALSE
\n"); } else { if ($keyprint) { if ($oblackoutthrowoffs) { if ($QUESTION{'qca'} eq "TRUE") { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"TRUE
\n"); $answerkey = join('',$answerkey,""); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"X
\n"); } else { $answerkey = join('',$answerkey,""); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"X
\n"); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"FALSE
\n"); } } else { if ($QUESTION{'qca'} eq "TRUE") { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"TRUE
\n"); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"FALSE
\n"); } else { if (!$onoradios) { $answerkey = join('',$answerkey,"\n"); } $answerkey = join('',$answerkey,"TRUE
\n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"FALSE
\n"); } } } else { if (!$onoradios) { $answerkey = join('',$answerkey,"  ");} $answerkey = join('',$answerkey,"  TRUE"); if (!$onoradios) { $answerkey = join('',$answerkey,"  ");} $answerkey = join('',$answerkey,"  FALSE"); } } $colspan=2; $answerkey = join('',$answerkey,"
\n"); } sub PrintQuestionESA { my ($ttyp) = @_; $answerkey = join('',$answerkey,"\n"); $lenresponse = length($keyresponse) + 4; if ($keyprint == 1) { $answerkey = ""; } else { $answerkey = ""; } $colspan=2; $answerkey = join('',$answerkey,"\n"); } sub PrintQuestionMCS { my ($ttyp) = @_; if ($ttyp eq 'svy') { @txts = (); if ($QUESTION{'qca'} ne '') { push @txts, $QUESTION{'qca'}; } @txts_wro = split(/\n/, $QUESTION{'qia'}); foreach $qia (@txts_wro) { push @txts, $qia; } @kans = split(/\?/,$keyresponse); @albls=&set_answer_labels($anstype); foreach $j (1 .. $#kans) { $jidx = $j-1; @indexs = split(/=/, $kans[$j]); $checked = ($indexs[1] == '1') ? " CHECKED" : ""; $checked = ($keyprint == 1) ? $checked : ""; $answerkey = join('',$answerkey,"\n"); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"$albls[$jidx]."); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"$txts[$indexs[0]]\n"); $answerkey = join('',$answerkey,"\ \n"); } } else { push @txts, $QUESTION{'qca'}; @txts_wro = split(/\n/, $QUESTION{'qia'}); foreach $qia (@txts_wro) { push @txts, $qia; } @kans = split(/\?/,$keyresponse); @albls=&set_answer_labels($anstype); foreach $j (1 .. $#kans) { $jidx = $j-1; @indexs = split(/=/, $kans[$j]); $checked=""; if ($keyprint) { $checked = ($indexs[1] eq '1') ? " CHECKED" : ""; } if (($ocrstyle) && ($ocrsheetno > 0)) { if ($checked ne "") { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ $albls[$jidx]."); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ "); } elsif (($oblackoutthrowoffs) && ($keyprint)) { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ $albls[$jidx]."); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ "); } else { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ $albls[$jidx]."); $answerkey = join('',$answerkey,""); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\ "); } } else { if ($checked ne "") { $answerkey = join('',$answerkey,"\n"); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"$albls[$jidx]."); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"$txts[$indexs[0]]\n"); $answerkey = join('',$answerkey,"\ \n"); } elsif (($oblackoutthrowoffs) && ($keyprint)) { $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"\ "); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"\ \n"); } else { $answerkey = join('',$answerkey,"\n"); if ($ocrstyle || $onoradios) { $answerkey = join('',$answerkey,"\ "); } else { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"$albls[$jidx]."); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"$txts[$indexs[0]]\n"); $answerkey = join('',$answerkey,"\ \n"); } } } } $colspan=2; } sub PrintQuestionMCM { my ($ttyp) = @_; if ($ttyp eq 'svy') { @txts = (); if ($QUESTION{'qca'} ne '') { @txts = split(/\n/, $QUESTION{'qca'}); } @txts_wro = split(/\n/, $QUESTION{'qia'}); foreach $qia (@txts_wro) { push @txts, $qia; } @kans = split(/\?/,$keyresponse); @albls=&set_answer_labels($anstype); $answerkey = join('',$answerkey,"\n"); foreach $j (1 .. $#kans) { $jidx = $j-1; @indexs = split(/=/, $kans[$j]); $checked = ($studentresponse =~ /$jidx/) ? " CHECKED" : ""; $answerkey = join('',$studentkey,"$albls[$jidx].","$txts[$indexs[0]]
\n"); } $answerkey = join('',$answerkey,"
\n"); } else { @txts = split(/\n/, $QUESTION{'qca'}); @txts_wro = split(/\n/, $QUESTION{'qia'}); foreach $qia (@txts_wro) { push @txts, $qia; } @kans = split(/\?/,$keyresponse); @albls=&set_answer_labels($anstype); foreach $j (1 .. $#kans) { $jidx = $j-1; @indexs = split(/=/, $kans[$j]); $checked=""; if ($keyprint) { $checked = ($indexs[1] eq '1') ? " CHECKED" : ""; } if (($ocrstyle) && ($ocrsheetno > 0)) { if ($checked ne "") { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ $albls[$jidx]."); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ "); } elsif (($oblackoutthrowoffs) && ($keyprint)) { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ $albls[$jidx]."); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ "); } else { $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ $albls[$jidx]."); $answerkey = join('',$answerkey,""); if (!$onoradios) { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\ "); } } else { if ($checked ne "") { $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"$albls[$jidx]."); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"$txts[$indexs[0]]\n"); $answerkey = join('',$answerkey,"\ \n"); } elsif (($oblackoutthrowoffs) && ($keyprint)) { $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,""); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"\ "); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"\ \n"); } else { $answerkey = join('',$answerkey,"\n"); if ($ocrstyle) { $answerkey = join('',$answerkey,"\ "); } else { $answerkey = join('',$answerkey,""); } $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"\n"); $answerkey = join('',$answerkey,"$albls[$jidx]."); $answerkey = join('',$answerkey,"\ \n"); $answerkey = join('',$answerkey,"$txts[$indexs[0]]\n"); $answerkey = join('',$answerkey,"\ \n"); } } # if ($keyprint) { # $checked = ($indexs[1] eq '1') ? " CHECKED" : ""; # if ($oblackoutthrowoffs) { # if ($checked ne '') { # $answerkey = join('',$answerkey,"$albls[$jidx].","$txts[$indexs[0]]
\n"); # } else { # $answerkey = join('',$answerkey,"X
\n"); # } # } else { # $answerkey = join('',$answerkey,"$albls[$jidx].","$txts[$indexs[0]]
\n"); # } # } else { # $answerkey = join('',$answerkey,"$albls[$jidx].","$txts[$indexs[0]]
\n"); # } } } # $colspan=2; } sub PrintQuestionMCH { my ($ttyp) = @_; $answerkey = join('',$answerkey,"\n"); if ($ttyp eq 'svy') { @txts = split(/\n/, $QUESTION{'qca'}); @txts_wro = split(/\n/, $QUESTION{'qia'}); @ansopts = split(/\./, $keyresponse); $ansopt = shift @ansopts; @albls=&set_answer_labels($anstype); $keyresponse = ""; for (0 .. $#ansopts) { $cansord[$ansopts[$_]] = $albls[$_]; $qanswermatch = join('',$qanswermatch, "($cansord[$ansopts[$_]]) $txts_wro[$ansopts[$_]]
\n"); } foreach $cansord (@cansord) { $keyresponse = join('', $keyresponse, $cansord); } for (0 .. $#ansopts) { if ($keyprint == 1) { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$_]
\n"); } else { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$_]
\n"); } } @cansord = (); } else { @txts = split(/\n/, $QUESTION{'qca'}); @txts_wro = split(/\n/, $QUESTION{'qia'}); @ansopts = split(/\./, $keyresponse); $trash = shift @ansopts; @albls=&set_answer_labels($anstype); $keyresponse = ""; for (0 .. $#ansopts) { $cansord[$ansopts[$_]] = $albls[$_]; $qanswermatch = join('',$qanswermatch, "$cansord[$ansopts[$_]].\ \;\ \;$txts_wro[$ansopts[$_]]
\n"); } foreach $cansord (@cansord) { $keyresponse = join('', $keyresponse, $cansord); } for (0 .. $#ansopts) { if ($keyprint == 1) { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$_]
\n"); } else { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$_]
\n"); } } @cansord = (); } # $colspan=1; $answerkey = join('',$answerkey,"
\n"); } sub PrintQuestionORD { my ($ttyp) = @_; $answerkey = join('',$answerkey,"\n"); if ($ttyp eq 'svy') { @txts = split(/\n/, $QUESTION{'qca'}); @ansopts = split(/\./, $keyresponse); $trash = shift @ansopts; @albls=&set_answer_labels($anstype); for (0 .. $#ansopts) { $ansopt = $ansopts[$_]; $ansopt++; if ($keyprint == 1) { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$ansopts[$_]]
\n"); } else { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$ansopts[$_]]
\n"); } } } else { @txts = split(/\n/, $QUESTION{'qca'}); @ansopts = split(/\./, $keyresponse); $trash = shift @ansopts; @albls=&set_answer_labels($anstype); for (0 .. $#ansopts) { $ansopt = $ansopts[$_]; $ansopt++; if ($keyprint == 1) { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$ansopts[$_]]
\n"); } else { $answerkey = join('',$answerkey,"$albls[$_]."," $txts[$ansopts[$_]]
\n"); } } } # $colspan=2; $answerkey = join('',$answerkey,"
\n"); } sub PrintOCRSheets() { my @tstquestions = (); return @tstquestions; }