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.
523 lines
24 KiB
523 lines
24 KiB
# $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 "<pre>".Dumper($results)."</pre>\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 = "<font color=\"green\"><h1>NOTE: The following letter has been";
|
|
if ($FORM{'email'}) {$note .= " mailed to the candidate ($FORM{'email'})";}
|
|
if ($FORM{'email'} and $FORM{'CC'}) {$note .= " and";}
|
|
if ($FORM{'CC'}) {$note .= " CCed to these addresses - $FORM{'CC'}";}
|
|
$note .= ".</h1></font>\n";
|
|
send_mail($testdef->{'ntfy'}->[0],$addresses,'CMTSE Test Results',"Content-Type: text/html\n\n".$letter);
|
|
} else {
|
|
$note = "<font color=\"red\"><h1>WARNING: An emailed report was requested but no".
|
|
" email addresses were given.</h1></font>\n";
|
|
}
|
|
}
|
|
$letter =~ s/(<BODY.*?>)/$1$note/i;
|
|
print $letter;
|
|
#} elsif ($FORM{'reportname'} eq '') {
|
|
#} elsif ($FORM{'reportname'} eq '') {
|
|
} else {
|
|
&ReportChooser($CLIENT{'clid'},$FORM{'tstid'});
|
|
}
|
|
}
|
|
}
|
|
|
|
# There should only be function definitions beyond this point.
|
|
exit(0);
|
|
|
|
sub get_test_definition {
|
|
my ($client,$testid) = @_;
|
|
my @tests = get_test_list($client);
|
|
my @keys = split(/&/,shift(@tests));
|
|
chomp(@keys);
|
|
my $test;
|
|
foreach (@tests) {
|
|
if (/^$testid/) {
|
|
chomp;
|
|
@{$test}{@keys} = split(/&/,$_);
|
|
last;
|
|
}
|
|
}
|
|
if ($test) {
|
|
$test->{'ntfy'} = [split(/,/,$test->{'ntfy'})];
|
|
}
|
|
return $test;
|
|
}
|
|
|
|
sub get_test_questions {
|
|
my ($client,$test) = @_;
|
|
my @questions = &get_question_list($test,$client);
|
|
my @keys = split(/&/,shift(@questions));
|
|
chomp(@keys);
|
|
my $questions;
|
|
foreach (@questions) {
|
|
chomp;
|
|
my @values = split(/&/,$_);
|
|
#if ($values[3] eq 'Y') {next;}
|
|
@{$questions->{$values[0]}}{@keys} = @values;
|
|
}
|
|
return $questions;
|
|
}
|
|
|
|
sub get_all_test_results {
|
|
my ($client,$test) = @_;
|
|
my @filelist = &get_test_result_files($testcomplete, $client, $test);
|
|
my $results = {};
|
|
my $historyfile = join($pathsep,$testcomplete,"$client.$test.history");
|
|
open (HISTFILE,"<$historyfile") or return 0;
|
|
my %histentries;
|
|
while ($_ = <HISTFILE>) {
|
|
my ($date) = split(/<<>>/,$_);
|
|
if (toGMSeconds($date) >= timelocal(0,0,0,1,0,104)) {
|
|
my (undef,$user) = split(/&/,$_);
|
|
$histentries{$user} = 1;
|
|
}
|
|
}
|
|
close HISTFILE;
|
|
foreach my $file (@filelist) {
|
|
my $user = $file;
|
|
$user =~ s/.$test$//;
|
|
$user =~ s/^$client.//;
|
|
if (not exists $histentries{$user}) {
|
|
# no test after jan 1 2004 exist for this user
|
|
next;
|
|
}
|
|
&get_candidate_profile($client,$user);
|
|
$results->{$user}->{'fullname'} = "$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}";
|
|
&get_test_sequence_for_reports($client,$user,$test);
|
|
my @questions = split(/\&/, $SUBTEST_QUESTIONS{2});
|
|
my @answers = split(/\&/,$SUBTEST_ANSWERS{2});
|
|
my @responses = split(/&/,$SUBTEST_RESPONSES{2});
|
|
my @summary = split(/\&/, $SUBTEST_SUMMARY{2});
|
|
my @results = split(/\//, $summary[$#summary]);
|
|
@{$results->{$user}->{'overall'}}{'right','wrong','percent'} = @summary[0,1,2];
|
|
#print STDERR "$user @summary[0,1,2]\n";
|
|
for (my $i=1; $i < @questions; $i++) {
|
|
@{$results->{$user}->{'questions'}->{$questions[$i]}}{'question','answer','response','result'} =
|
|
($questions[$i], $answers[$i], $responses[$i], [split(/\./,$results[$i])]);
|
|
}
|
|
}
|
|
return $results;
|
|
}
|
|
|
|
sub add_results_by_cnd {
|
|
my ($questions,$results) = @_;
|
|
my (%subjects,%categories);
|
|
foreach my $user (keys %$results) {
|
|
my $subject = {};
|
|
my $category = {};
|
|
foreach my $quest (values %{$results->{$user}->{'questions'}}) {
|
|
my $subj = $questions->{$quest->{'question'}}->{'subj'};
|
|
$subj =~ s/\..*$//;
|
|
$subjects{$subj} = 1;
|
|
if (not exists $subject->{$subj}) {$subject->{$subj} = [0,0];}
|
|
$subject->{$subj}->[$quest->{'result'}->[0]]++;
|
|
my $cat = $questions->{$quest->{'question'}}->{'ques2'};
|
|
if (not $cat) {print STDERR "$questions->{$quest->{'question'}}->{'id'} $questions->{$quest->{'question'}}->{'qil'}\n";}
|
|
$categories{$cat} = 1;
|
|
if (not exists $category->{$cat}) {$category->{$cat} = [0,0];}
|
|
$category->{$cat}->[$quest->{'result'}->[0]]++;
|
|
}
|
|
$results->{$user}->{'subject'} = $subject;
|
|
$results->{$user}->{'category'} = $category;
|
|
}
|
|
return ([sort(keys(%subjects))],[sort(keys(%categories))]);
|
|
}
|
|
|
|
sub sum {
|
|
my $sum = 0;
|
|
foreach (@_) {
|
|
$sum += $_;
|
|
}
|
|
return $sum;
|
|
}
|
|
|
|
sub results_by_subject {
|
|
my ($questions,$results,$subjects) = @_;
|
|
my %init = ('count' => 0, 'mean' => 0, 'stddev' => 0, 'min' => 1000000, 'max' => 0, 'pass' => 0);
|
|
my $res = {'overall' => {%init}};
|
|
foreach (@$subjects) {
|
|
$res->{'subjects'}->{$_} = {%init};
|
|
}
|
|
my $overall = $res->{'overall'};
|
|
foreach my $result (values(%$results)) {
|
|
my $right = $result->{'overall'}->{'right'};
|
|
if (not exists $overall->{'total'}) {$overall->{'total'} = $right + $result->{'overall'}->{'wrong'};}
|
|
$overall->{'count'}++;
|
|
$overall->{'mean'} += $right;
|
|
$overall->{'min'} = ($overall->{'min'} < $right ? $overall->{'min'}: $right);
|
|
$overall->{'max'} = ($overall->{'max'} > $right ? $overall->{'max'}: $right);
|
|
$overall->{'percent'} += $result->{'overall'}->{'percent'};
|
|
if ($result->{'overall'}->{'percent'} >= 70) {$overall->{'pass'}++;}
|
|
push @{$overall->{'values'}} , $right;
|
|
foreach my $subj (@$subjects) {
|
|
my $current = $res->{'subjects'}->{$subj};
|
|
$right = $result->{'subject'}->{$subj}->[1];
|
|
if (not exists $current->{'total'}) {$current->{'total'} = ($right+$result->{'subject'}->{$subj}->[0]);}
|
|
#$current->{'count'}++;
|
|
$current->{'mean'} += $right;
|
|
$current->{'min'} = ($current->{'min'} < $right ? $current->{'min'}: $right);
|
|
$current->{'max'} = ($current->{'max'} > $right ? $current->{'max'}: $right);
|
|
$current->{'percent'} += 100*$right/($current->{'total'});
|
|
push @{$current->{'values'}} , $right;
|
|
}
|
|
}
|
|
# calculate standard deviations
|
|
foreach my $s ($overall, values(%{$res->{'subjects'}})) {
|
|
$s->{'mean'} /= $overall->{'count'};
|
|
$s->{'percent'} /= $overall->{'count'};
|
|
$s->{'stddev'} = sqrt(sum(map(($s->{'mean'}-$_)**2,@{$s->{'values'}}))/($overall->{'count'}-1));
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
sub HTMLHeader {
|
|
return "<html>\n<head>\n<title>$_[0]</title>\n".
|
|
"<script language=\"JavaScript\">\n<!-- \n$_[1]\n -->\n</script>\n</head>\n".
|
|
"<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"".
|
|
" TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"".
|
|
" VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">\n";
|
|
}
|
|
|
|
sub HTMLHeaderPlain {
|
|
return "<html>\n<head>\n<title>$_[0]</title>\n".
|
|
"<script language=\"JavaScript\">\n<!-- \n$_[1]\n -->\n</script>\n</head>\n".
|
|
"<BODY>\n";
|
|
}
|
|
|
|
sub HTMLFooter {
|
|
return "<br><center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">Copyright (c) 2004, AMTDA<center></font></body>\n</html>\n";
|
|
}
|
|
|
|
sub HTMLReportHeader {
|
|
my ($reporttype) = @_;
|
|
my $html = "<html><head><title>$reporttype</title></head><body>\n";
|
|
$html .= "American Machine Tool Distributors' Association<br>\n";
|
|
$html .= "Certified Machine Tool Sales Engineer (CMTSE) Examination<br>\n";
|
|
$html .= "Form 575070<br>\n";
|
|
$html .= "Report Generated ".scalar(localtime(time))."<br>\n";
|
|
$html .= "$reporttype<br>\n";
|
|
$html .= "Passing Score = Total Raw Score of 105 (70 % Correct)<p>\n";
|
|
return $html;
|
|
}
|
|
|
|
sub HTMLTable {
|
|
my ($data,$caption,%options) = @_;
|
|
my %options = ('aligndef' => 'center',
|
|
'alignrow' => [],
|
|
'bold' => {0 => 1},
|
|
@_);
|
|
my $html = "<table border>\n";
|
|
if ($caption or $caption eq '0') {
|
|
$html .= "<caption>$caption</caption>";
|
|
}
|
|
#$html .= "<tr>".join("",map("<th align=\"center\">$_</th>",@{$data->[0]}))."</tr>\n";
|
|
for (my $row = 0; $row < @{$data}; $row++) {
|
|
my $celltype = 'td';
|
|
my $align = $options{'aligndef'};
|
|
if ($options{'alignrow'}->[$row]) {$align = $options{'alignrow'}->[$row];}
|
|
if ($options{'bold'}->{$row}) {$celltype = 'th';}
|
|
$html .= "<tr>".join("",map("<$celltype align=\"$align\">$_</td>",@{$data->[$row]}))."</$celltype>\n";
|
|
}
|
|
$html .= "</table>\n";
|
|
return $html;
|
|
}
|
|
|
|
sub ReportChooser {
|
|
my ($client,$test) = @_;
|
|
my $js = "function parmsAMTDA(oform,rpt) {\n\t".
|
|
"oform.reportname.value=rpt;\n\t".
|
|
"oform.action='/cgi-bin/creports.pl';\n\t".
|
|
"oform.submit();\n};\n";
|
|
$js .= "function cndSelect(form) {
|
|
select = form.userview;
|
|
params = String(select.options[select.selectedIndex].value).split('&');
|
|
form.uid.value=params[0];
|
|
form.firstname.value=params[3];
|
|
form.middlename.value=params[4];
|
|
form.lastname.value=params[5];
|
|
form.address.value=params[6];
|
|
form.city.value=params[7];
|
|
form.state.value=params[8];
|
|
form.zip.value=params[9];
|
|
form.country.value=params[10];
|
|
form.email.value=params[11];
|
|
}";
|
|
print HTMLHeader("AMTDA CMTSE Test Reports",$js);
|
|
print "<form name=\"amtdarpt\" action=\"/cgi-bin/creports.pl\" method=\"Post\" target=\"rptwindow\" enctype=\"multipart/form-data\" >\n";
|
|
print "<input type=\"hidden\" name=\"tid\" value=\"$SESSION{'tid'}\">\n";
|
|
# For development purposes we hardcode the survey id.
|
|
# Fix this before production
|
|
print "<input type=hidden name=\"tstid\" value=\"$FORM{'tstid'}\">\n";
|
|
print "<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">\n";
|
|
print "<input type=hidden name=\"rptdesc\" value=\"$REPORT{'rptdesc'}\">\n";
|
|
print "<input type=hidden name=\"rptid\" value=\"$REPORT{'rptid'}\">\n";
|
|
print "<input type=\"hidden\" name=\"reportname\" value=\"\">\n";
|
|
print "<H1>AMTDA CMTSE Test Reports</h1>\n";
|
|
print "<ul style=\"list-style: none\">\n";
|
|
print "<li><a href=\"javascript:parmsAMTDA(document.amtdarpt,'rawscorebycnd');\">".
|
|
"Raw Scores by Candidate</a></li>\n";
|
|
print "<li><a href=\"javascript:parmsAMTDA(document.amtdarpt,'percentscorebycnd');\">".
|
|
"Percent Scores by Candidate</a></li>\n";
|
|
print "<li><a href=\"javascript:parmsAMTDA(document.amtdarpt,'rawscorebysubject');\">".
|
|
"Raw Scores by Subject</a></li>\n";
|
|
print "<li><a href=\"javascript:parmsAMTDA(document.amtdarpt,'passfailbycnd');\">".
|
|
"Pass/Fail by Candidate</a></li>\n";
|
|
print "<li><a href=\"javascript:parmsAMTDA(document.amtdarpt,'candidateletter');\">".
|
|
"Candidate Letter</a><p>\n";
|
|
my $users = get_users($client,$test);
|
|
print "<ul style=\"list-style: none\">\n";
|
|
print "<li><select name=\"userview\" onChange='cndSelect(document.amtdarpt)'>\n";
|
|
my $defuser;
|
|
foreach my $user (sort keys %$users) {
|
|
my (undef,undef,undef,$first,$middle,$last) = split(/&/,$users->{$user});
|
|
if (not defined $defuser) {
|
|
$defuser = $user;
|
|
print "<option value=\"$users->{$user}\" selected>$last, $first $middle</option>\n";
|
|
} else {
|
|
print "<option value=\"$users->{$user}\">$last, $first $middle</option>\n";
|
|
}
|
|
}
|
|
print "</select><input type=\"hidden\" name=\"uid\" value=\"$defuser\"></li>\n";
|
|
my (undef,undef,undef,$first,$middle,$last,$address,$city,$state,$zip,$country,$email)
|
|
= split(/&/,$users->{$defuser});
|
|
print "<li><table><tr><td>Last Name:</td><td><input type=\"text\" name=\"lastname\" value=\"$last\"></td>\n";
|
|
print "<td>First:</td><td><input type=\"text\" name=\"firstname\" value=\"$first\"></td>\n";
|
|
print "<td>Middle:</td><td><input type=\"text\" name=\"middlename\" value=\"$middle\"></td></tr>\n";
|
|
print "<tr><td>Address:</td><td colspan=5><input type=\"text\" name=\"address\" value=\"$address\" size=80></td></tr>\n";
|
|
print "<tr><td>City:</td><td><input type=\"text\" name=\"city\" value=\"$city\"></td>\n";
|
|
print "<td>State:</td><td><input type=\"text\" name=\"state\" value=\"$state\"></td>\n";
|
|
print "<td>Zip:</td><td><input text=\"text\" name=\"zip\" value=\"$zip\"></td></tr>\n";
|
|
print "<tr><td>Country:</td><td colspan=5><input type=\"text\" name=\"country\" value=\"$country\" size=80></td></tr>\n";
|
|
print "<tr><td>E-mail:</td><td colspan=5><input type=\"text\" name=\"email\" value=\"$email\" size=80></td></tr>\n";
|
|
print "</table></li>";
|
|
print "<li><input type=\"checkbox\" name=\"sendemail\"> Send Email to Candidate\n</li>";
|
|
print "<li>CC: <input type=\"text\" name=\"CC\" size=80></li>\n";
|
|
# print "<li>BCC: <input type=\"text\" name=\"BCC\" size=80></li>\n";
|
|
print "<li>(Separate multiple email addresses with a comma, e.g. name\@place.com,name2\@place2.com)</li>\n";
|
|
print "</ul>\n";
|
|
print "</li>\n";
|
|
print HTMLFooter();
|
|
}
|
|
|
|
sub RawScoreByCnd {
|
|
my ($questions,$results,$subjects,$categories) = @_;
|
|
my $data = [];
|
|
$data->[0] = ['ID#','Name','Total Score',@$subjects];
|
|
foreach my $user (sort {$results->{$a}->{'fullname'} cmp $results->{$b}->{'fullname'}} keys %$results) {
|
|
my $bysubject = $results->{$user}->{'subject'};
|
|
push @$data, [$user,
|
|
$results->{$user}->{'fullname'},
|
|
$results->{$user}->{'overall'}->{'right'},
|
|
map($bysubject->{$_}->[1],@$subjects)];
|
|
}
|
|
print &HTMLReportHeader("Raw Score Report for PES File");
|
|
#print "<pre>".Dumper($data)."</pre>\n";
|
|
print &HTMLTable($data);
|
|
print &HTMLFooter();
|
|
}
|
|
|
|
sub PercentScoreByCnd {
|
|
my ($questions,$results,$subjects,$categories) = @_;
|
|
my $data = [];
|
|
$data->[0] = ['ID#','Name','Total Score',@$subjects];
|
|
foreach my $user (sort {$results->{$a}->{'fullname'} cmp $results->{$b}->{'fullname'}} keys %$results) {
|
|
my $bysubject = $results->{$user}->{'subject'};
|
|
push @$data, [$user,
|
|
$results->{$user}->{'fullname'},
|
|
$results->{$user}->{'overall'}->{'percent'}." %",
|
|
map(int(100*$bysubject->{$_}->[1]/($bysubject->{$_}->[1]+$bysubject->{$_}->[0])+0.5)." %",@$subjects)];
|
|
}
|
|
print &HTMLReportHeader("Percent Score Report for PES File");
|
|
#print "<pre>".Dumper($data)."</pre>\n";
|
|
print &HTMLTable($data);
|
|
print &HTMLFooter();
|
|
}
|
|
|
|
sub RawScoreBySubject {
|
|
my ($questions,$results,$subjects,$bysubj) = @_;
|
|
#print "<pre>".Dumper($bysubj)."</pre>";
|
|
my $data = [];
|
|
$data->[0] = ['Subject','Max Raw Scores','Range of Raw Scores','Average Raw Scores',
|
|
'Standard Deviation','Average Percent Correct','Number Passing','Percent Passing'];
|
|
my $current = $bysubj->{'overall'};
|
|
$data->[1] = ['Total Score',$current->{'total'},"$current->{'min'} - $current->{'max'}",
|
|
sprintf("%.2f",$current->{'mean'}),sprintf("%.2f",$current->{'stddev'}),
|
|
sprintf("%.2f",$current->{'percent'}),$current->{'pass'},
|
|
sprintf("%.2f %%",100*$current->{'pass'}/$current->{'count'})];
|
|
foreach my $subj (@$subjects) {
|
|
$current = $bysubj->{'subjects'}->{$subj};
|
|
push @$data, [$subj, $current->{'total'},"$current->{'min'} - $current->{'max'}",
|
|
sprintf("%.2f",$current->{'mean'}),sprintf("%.2f",$current->{'stddev'}),
|
|
sprintf("%.2f",$current->{'percent'})];
|
|
}
|
|
print &HTMLReportHeader("Subject Breakdown");
|
|
#print "<pre>".Dumper($data)."</pre>\n";
|
|
print &HTMLTable($data,"Data Based on $bysubj->{'overall'}->{'count'} Candidates");
|
|
print &HTMLFooter();
|
|
}
|
|
|
|
sub PassFailByCnd {
|
|
my ($results) = @_;
|
|
my $data = [];
|
|
$data->[0] = ['ID#','Name','Status'];
|
|
foreach my $user (sort {$results->{$a}->{'fullname'} cmp $results->{$b}->{'fullname'}} keys %$results) {
|
|
push @$data, [$user,
|
|
$results->{$user}->{'fullname'},
|
|
($results->{$user}->{'overall'}->{'percent'} < 70 ? 'Fail': 'Pass')];
|
|
}
|
|
print &HTMLReportHeader("Alphabetical List of Candidates with Pass/Fail Status");
|
|
print &HTMLTable($data);
|
|
print &HTMLFooter();
|
|
}
|
|
|
|
sub CandidateLetter {
|
|
my ($questions, $results, $subjects, $categories, $user) = @_;
|
|
my $history = &get_cnd_test_from_history($testcomplete,$CLIENT{'clid'},$user,$FORM{'tstid'});
|
|
my %content = ('01' => 'Market Management',
|
|
'02' => 'Customer Engagement',
|
|
'03' => 'Needs Analysis',
|
|
'04' => 'Contract Proposal',
|
|
'05' => 'Customer Acceptance',
|
|
'06' => 'Order Management',
|
|
'07' => 'Post-Installation Management');
|
|
my %chapter = ('02' =>'Ch. 02: Territory and Customer Development',
|
|
'03' =>'Ch. 03: Planning and Organizing',
|
|
'04' =>'Ch. 04: The Selling Process',
|
|
'05' =>'Ch. 05: Business Practices & Ethics',
|
|
'06' =>'Ch. 06: Manufacturing Processes',
|
|
'07' =>'Ch. 07: CNC Technology and Machine Control',
|
|
'08' =>'Ch. 08: Blueprint Reading and Geometric Tolerancing',
|
|
'09' =>'Ch. 09: Cutting Tool Technology',
|
|
'10' =>'Ch. 10: Machine Tool Design',
|
|
'11' =>'Ch. 11: Metal Forming Technology',
|
|
'12' =>'Ch. 12: Machine Tool Accuracy',
|
|
'13' =>'Ch. 13: General Mathematics and Geometry');
|
|
my $data1 = [[1,2,3,4],
|
|
['Content Domain', "Maximum Possible","Raw Score","Percent Score"]];
|
|
my $data2 = [[1,2,3,4],['Study Guide Chapter', "Maximum Possible","Raw Score","Percent Score"]];
|
|
push @$data1, (['Total Score',
|
|
$results->{$user}->{'overall'}->{'right'}+$results->{$user}->{'overall'}->{'wrong'},
|
|
$results->{$user}->{'overall'}->{'right'},
|
|
$results->{$user}->{'overall'}->{'percent'}.' %'],
|
|
[' ',' ',' ',' ']);
|
|
#print STDERR Dumper($subjects, $data1, $results->{$user});
|
|
foreach my $subj (@$subjects) {
|
|
my $current = $results->{$user}->{'subject'}->{$subj};
|
|
push @$data1, [$content{$subj},
|
|
$current->[0]+$current->[1],
|
|
$current->[1],
|
|
sprintf("%.2f %%",100*$current->[1]/($current->[0]+$current->[1] or 1))];
|
|
}
|
|
foreach my $cat (@$categories) {
|
|
my $current = $results->{$user}->{'category'}->{$cat};
|
|
push @$data2, [$chapter{$cat},
|
|
$current->[0]+$current->[1],
|
|
$current->[1],
|
|
sprintf("%.2f %%",100*$current->[1]/($current->[0]+$current->[1] or 1))];
|
|
}
|
|
my $html = "";
|
|
|
|
$html .= &HTMLHeaderPlain("Notice of Test Results");
|
|
$html .= "<center>Notice of Test Results<br>";
|
|
$html .= "for the<br>\n";
|
|
$html .= "American Machine Tool Distributors' Association<br>\n";
|
|
$html .= "Certified Machine Tool Sales Engineer (CMTSE) Examination<br>\n";
|
|
my $date = scalar(localtime($history->{'end'}));
|
|
$date =~ s/ \d\d:\d\d:\d\d/,/;
|
|
$html .= "Tested $date<br></center>\n";
|
|
$html .= "<p>ID \# $user<p>\n";
|
|
$html .= "<ul style=\"list-style: none\">\n";
|
|
$html .= "<li>$FORM{'firstname'}".($FORM{'middlename'}?" $FORM{'middlename'}":'').
|
|
($FORM{'lastname'}?" $FORM{'lastname'}":'')."</li>\n";
|
|
$html .= "<li>$FORM{'address'}</li>\n" if ($FORM{'address'});
|
|
$html .= "<li>$FORM{'city'}, $FORM{'state'} $FORM{'zip'}</li>" if ($FORM{'city'} or $FORM{'state'} or $FORM{'zip'});
|
|
$html .= "<li>$FORM{'country'}</li>\n" if ($FORM{'country'});
|
|
$html .= "<li>E-mail: $FORM{'email'}</li>\n" if ($FORM{'email'});
|
|
$html .= "</ul>\n";
|
|
$html .= "You must achieve a percent score of 70 % or higher to pass this examination.\n";
|
|
$html .= &HTMLTable($data1,undef,'bold' => {1=>1},'aligndef' => 'left','alignrow' => ['center','center']);
|
|
$html .= "<p>\n";
|
|
$html .= &HTMLTable($data2,"Scores Based on Candidate Study Guide",'bold' => {1=>1},'aligndef' => 'left','alignrow' => ['center','center']);
|
|
$html .= "<P>\n";
|
|
if ($results->{$user}->{'overall'}->{'percent'} >= 70) {
|
|
$html .= "Congratulations on successfully completing the Certified ".
|
|
"Machine Tool Sales Engineer (CMTSE) Examination. The information ".
|
|
"contained in this report includes your Total Score, your scores on ".
|
|
"the seven content domains that comprise the examination, and your ".
|
|
"score by Candidate Study Guide chapter. Column 2 lists the total ".
|
|
"number of exam questions for each area; Column 3 lists the actual ".
|
|
"number of questions you answered correctly; and, Column 4 ".
|
|
"indicates the percentage of questions you answered correctly.<p>\n";
|
|
$html .= "Thank you for ".
|
|
"participating in the Certified Machine Tool Sales Engineer ".
|
|
"(CMTSE) Examination.<p>";
|
|
} else {
|
|
$html .= "Regretfully, we must inform you that you failed to ".
|
|
"pass the Certified Machine Tool Sales Engineer (CMTSE) ".
|
|
"Examination. The information contained in this report ".
|
|
"includes your Total Score, your scores on the seven content ".
|
|
"domains that comprise the examination, and your score by ".
|
|
"Candidate Study Guide chapter. Column 2 lists the total ".
|
|
"number of exam questions for each area; Column 3 lists the ".
|
|
"actual number of questions you answered correctly; and, Column ".
|
|
"4 indicates the percentage of questions you answered ".
|
|
"correctly.<p>\n".
|
|
|
|
"CMTSE candidates who do not pass the exam are welcome and ".
|
|
"encouraged to retake it at their earliest opportunity. ".
|
|
"Your application is valid for two years from the exam date ".
|
|
"for which you originally registered. To participate in an ".
|
|
"upcoming exam, please contact AMTDA at 1-800-878-2683.<p>\n";
|
|
}
|
|
$html .= HTMLFooter();
|
|
return $html;
|
|
}
|
|
|