# $Id: amtda.pl,v 1.15 2004/06/22 20:53:31 ddoughty Exp $ # # Source File: amtda.pl # custom reports for amtda.org # use FileHandle; use Time::Local; use Data::Dumper; require 'sitecfg.pl'; require 'testlib.pl'; require "maillib.pl"; use strict; use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST %SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS %SYSTEM %REPORT %SUBTEST_RESPONSES); use vars qw($testcomplete $cgiroot $pathsep $dataroot ); &app_initialize; &LanguageSupportInit(); &get_client_profile($SESSION{'clid'}); &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); $FORM{'tstid'} = ($CLIENT{'clid'} eq 'sandbox'? 'tutor': 'CMTSE'); if (&get_session($FORM{'tid'})) { if (not $FORM{'reportname'}) { &ReportChooser($CLIENT{'clid'},$FORM{'tstid'}); } else { my $questions = &get_test_questions($CLIENT{'clid'},$FORM{'tstid'}); my $results = &get_all_test_results($CLIENT{'clid'},$FORM{'tstid'}); my ($subjects, $categories) = &add_results_by_cnd($questions,$results); #print "
".Dumper($results)."\n"; if ($FORM{'reportname'} eq 'rawscorebycnd') { &RawScoreByCnd($questions, $results, $subjects, $categories); } elsif ($FORM{'reportname'} eq 'percentscorebycnd') { &PercentScoreByCnd($questions, $results, $subjects, $categories); } elsif ($FORM{'reportname'} eq 'rawscorebysubject') { my $bysubj = &results_by_subject($questions, $results, $subjects); &RawScoreBySubject($questions, $results, $subjects, $bysubj); } elsif ($FORM{'reportname'} eq 'passfailbycnd') { &PassFailByCnd($results); } elsif ($FORM{'reportname'} eq 'candidateletter') { my $letter = &CandidateLetter($questions, $results, $subjects, $categories,$FORM{"uid"}); my $note = ''; if ($FORM{'sendemail'}) { # email copies of the letter out print STDERR "($FORM{'email'}|$FORM{'CC'})\n"; if ($FORM{'email'} or $FORM{'CC'}) { my $testdef = get_test_definition($CLIENT{'clid'},$FORM{'tstid'}); my $addresses = join(',',$FORM{'email'},$FORM{'CC'}); $note = "
\n"; return $html; } sub HTMLTable { my ($data,$caption,%options) = @_; my %options = ('aligndef' => 'center', 'alignrow' => [], 'bold' => {0 => 1}, @_); my $html = "
$_ | ",@{$data->[0]}))."
---|