|
|
|
|
|
";
}
}
sub PrintSection {
if ($ocrstyle) {
my $i;
print "\n\n";
print "\n";
for $i (0 .. $#ocrcoltbl0) {
print "$ocrcoltbl0[$i]";
}
print " \n | \n";
if ($ocrcolumns > 1) {
print "\n";
print "\n";
for $i (0 .. $#ocrcoltbl1) {
print "$ocrcoltbl1[$i]";
}
print " \n | \n";
}
if ($ocrcolumns > 2) {
print "\n";
print "\n";
for $i (0 .. $#ocrcoltbl2) {
print "$ocrcoltbl2[$i]";
}
print " \n | \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('',"
","$questionindex. | ",$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";
$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;
}