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.

1676 lines
44 KiB

#!/usr/bin/perl
#
# Source File: creports003.pl
#
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
require 'tstatlib.pl';
$FORM{'frm'}="";
&app_initialize;
if ($FORM{'cbexport'} eq 'xport') {
print "Content-Disposition: attachment;filename=report.txt\n\n";
$bDisplay = 0;
} else {
print "Content-Type: text/html\n\n";
$bDisplay = 1;
}
# ACT-C-003&Test Reports by Candidate
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
$REPORT{'rptid'}="";
@rptdefs = &get_data("reports.$SESSION{'clid'}");
@lbls = split(/&/, $rptdefs[0]);
foreach $rptdef (@rptdefs) {
chomp ($rptdef);
@flds = split(/&/, $rptdef);
if ($flds[0] eq $FORM{'rptno'}) {
for $i (0 .. $#lbls) {
$REPORT{$lbls[$i]} = $flds[$i];
$i++;
}
}
}
if ($FORM{'frm'} == '1') {
&show_index_candidates;
} else {
if ($FORM{'frm'} == '2') {
&show_index_tests;
} else {
if ($FORM{'frm'} == '3') {
if ($FORM{'cbexport'} eq 'xport') {
&download_detail;
} else {
&show_detail;
}
} else {
if ($FORM{'frm'} == '4') {
&show_filter_options;
} else {
print "<HTML>\n";
print "<HEAD></HEAD>\n";
print "<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"
TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"
VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">
</BODY>\n";
print "</HTML>\n";
}
}
}
}
}
sub show_index_candidates {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}");
&get_client_profile($SESSION{'clid'});
print "<HTML>
<HEAD>
<TITLE>$REPORT{'rptid'} - $REPORT{'rptdesc'}</TITLE>
<SCRIPT language=\"JavaScript\">
<!--
window.onload=onWdwLoad;
function onWdwLoad() {
document.rptform1.cndnamesort.selectedIndex = -1;
document.rptform1.cndidsort.selectedIndex = -1;
}
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
alert(\"$xlatphrase[473]\");
return false;
} else {
if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert(\"$xlatphrase[473]\");
return false;
}
}
return true;
}
function nameSelect(f) {
var w=top.detail.rptdtl003.document.location;
f.cndidsort.selectedIndex = -1;
if (f.cndnamesort.selectedIndex != -1) {
w.replace(\"$urlroot/creports003.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\");
i=f.cndnamesort.selectedIndex;
f.cndid.value=f.cndnamesort.options[i].value;
f.submit();
return true;
}
}
function idSelect(f) {
var w=top.detail.rptdtl003.document.location;
f.cndnamesort.selectedIndex = -1;
if (f.cndidsort.selectedIndex != -1) {
w.replace(\"$urlroot/creports003.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\");
i=f.cndidsort.selectedIndex;
f.cndid.value=f.cndidsort.options[i].value;
f.submit();
return true;
}
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// -->
</SCRIPT>
</HEAD>
<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"
TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"
VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">
<FORM name=\"rptform1\" action=\"$cgiroot/creports003.pl\" METHOD=GET target=\"rpttidx003\">
<CENTER>
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"frm\" value=\"2\">
<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">
<input type=hidden name=\"cndid\" value=\"\">
<TR>
<TD ALIGN=\"center\">
<nobr>
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\">
<B>$REPORT{'rptid'} - $REPORT{'rptdesc'}</B><BR>
</FONT>
";
my @clrecs = &get_client_cnd_list($CLIENT{'clid'});
my @clnamesort=();
my @clidsort=();
my $namesort;
my $idsort;
my $mycreator;
my $imaregistrar = &get_a_key("cnd.$SESSION{'clid'}", $SESSION{'uid'}, "registrar");
for (1 .. $#clrecs) {
$clrecs[$_] =~ s/\n//g;
@cndrecs = split(/&/, $clrecs[$_]);
$id = $cndrecs[0];
$nmf = $cndrecs[3];
$nmm = $cndrecs[4];
$nml = $cndrecs[5];
$mycreator = $cndrecs[15];
unless (($id eq '') || ($nml eq '')) {
$namesort=join('&',$nml,$nmf,$nmm,$id);
if ($imaregistrar eq 'Y') {
if ($SESSION{'uid'} eq $mycreator) {
push @clnamesort, $namesort;
}
} else {
push @clnamesort, $namesort;
}
}
}
@clrecs = sort @clnamesort;
@clnamesort=();
print "Name:<SELECT name=\"cndnamesort\" onChange=\"return nameSelect(this.form)\">\n";
print "<OPTION value=\"-1\">&nbsp;</OPTION>\n";
for (0 .. $#clrecs) {
($nml, $nmf, $nmm, $id) = split(/&/, $clrecs[$_]);
$idsort=join('&',$id,$nml,$nmf,$nmm);
push @clidsort, $idsort;
print "<OPTION value=\"$id\">$nml, $nmf $nmm ($id)</OPTION>\n";
}
print "</SELECT>\n";
@clrecs = sort @clidsort;
@clidsort=();
print "\&nbsp;ID:<SELECT name=\"cndidsort\" onChange=\"return idSelect(this.form)\">\n";
print "<OPTION value=\"-1\">&nbsp;</OPTION>\n";
for (0 .. $#clrecs) {
($id,$nml,$nmf,$nmm) = split(/&/, $clrecs[$_]);
print "<OPTION value=\"$id\">$id - $nml, $nmf $nmm\n";
}
print "</SELECT>\n";
@clrecs=();
print "</nobr>
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
</BODY>
</HTML>
";
}
sub show_index_tests {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}");
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
my $style = "SELECT {\"width: 200px;height: 200px;font-size: 8pt;\"}";
print "<HTML>
<HEAD>
<TITLE>$REPORT{'rptid'} - $REPORT{'rptdesc'}</TITLE>
<STYLE>
<!--
$style
-->
</STYLE>
<SCRIPT language=\"JavaScript\">
<!--
window.onload=onWdwLoad;
function onWdwLoad() {
document.rptform1.tstid.selectedIndex = -1;
}
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
alert(\"This source and all graphics are proprietary and may not be viewed or copied.\");
return false;
} else {
if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert(\"This source and all graphics are proprietary and may not be viewed or copied.\");
return false;
}
}
return true;
}
function testSelect(f) {
if (f.tstsel.selectedIndex != -1) {
f.submit();
return true;
}
}
function clearOptions(f) {
var i,s,u,c;
u=\"\";
c=0;
f.multiple.value=\"0\";
for (i=0; i < f.tstsel.options.length; i++) {
if (f.tstsel.options[i].selected) {
if (u != \"\") {
u += \",\";
f.multiple.value=\"1\";
}
u += f.tstsel.options[i].value;
c++;
}
}
f.tstid.value=u;
if (c == 0) {
top.detail.rptdtl003.document.location.replace(\"$urlroot/creports003.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\");
return false;
} else {
f.submit();
return true;
}
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// -->
</SCRIPT>
</HEAD>
<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"
TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"
VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">
<FORM name=\"rptform1\" action=\"$cgiroot/creports003.pl\"
METHOD=GET target=\"rptdtl003\">
<CENTER>
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"frm\" value=\"4\">
<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">
<input type=hidden name=\"cndid\" value=\"$FORM{'cndid'}\">
<input type=hidden name=\"clid\" value=\"$CLIENT{'clid'}\">
<input type=hidden name=\"tstid\" value=\"\">
<input type=hidden name=\"multiple\" value=\"0\">
<TR>
<TD ALIGN=\"center\">
<nobr>
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>
<B>$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}</B><BR>
</FONT>
<nobr>
</TD>
</TR>
<TR>
<TD ALIGN=\"center\">
";
my @trecs = &get_test_list($CLIENT{'clid'});
my @tmptrecs = ();
for (1 .. $#trecs) {
($id, $desc) = split(/&/, $trecs[$_]);
$trecs[$_] = join('&', "$desc", "$id");
push @tmptrecs, $trecs[$_];
}
@trecs = sort @tmptrecs;
print "\t\t<SELECT name=\"tstsel\" size=\"8\" multiple Height=200 Width=200 onChange=\"return clearOptions(this.form)\">\n";
for (0 .. $#trecs) {
($desc,$id) = split(/&/, $trecs[$_]);
$testscompleted = CountHistoricTests($testcomplete,$CLIENT{'clid'},$id,$FORM{'cndid'});
if ($testscompleted == 0) {
$testscompleted = CountTestFilesByCnd($testcomplete,$CLIENT{'clid'},$id,$FORM{'cndid'});
}
$testsinprogress = CountTestFilesByCnd($testinprog, $CLIENT{'clid'},$id,$FORM{'cndid'});
$testspending = CountTestFilesByCnd($testpending, $CLIENT{'clid'},$id,$FORM{'cndid'});
if (($testsinprogress != 0) || ($testspending != 0) || ($testscompleted != 0)) {
print "\t\t\t<OPTION value=\"$id\">$testscompleted-$testsinprogress-$testspending $desc\n";
}
}
print "\t\t</SELECT>
</TD>
</TR>
<TR>
<TD ALIGN=\"center\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>
$xlatphrase[721]
</FONT>
<!--
<INPUT TYPE=BUTTON name=\"show\" value=\"$xlatphrase[27]\" onClick=\"return testSelect(this.form)\">
-->
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
";
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "3", "Exec Report $FORM{'rptno'} completed");
}
sub show_filter_options {
my $cndid;
my $cndname;
my @testdates;
my $iopt;
my $optval;
my $optdesc;
my $lstdates;
my $qcor;
my $qinc;
my $tscore;
my $trash;
my $j;
my $i;
my @tests;
my @tmpdates;
my $jscript;
my $colspan;
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Report Options $FORM{'rptno'}");
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
@tests = split(/\,/,$FORM{'tstid'});
$cndname = join('', $CANDIDATE{'nml'}, ", ", $CANDIDATE{'nmf'}, " ", $CANDIDATE{'nmm'});
$cndid = $CANDIDATE{'uid'};
$lstdates = "<SELECT name=tdatesel size=10 multiple>\n";
$jscript="var s=new Array();\n";
if ($FORM{'multiple'} ne '1') {
$testdescriptions = "$FORM{'tstid'} - $TEST{'desc'}\<br\>";
&get_test_profile($CLIENT{'clid'}, $FORM{'tstid'});
@testdates = getHistoricTests($testcomplete,$CLIENT{'clid'},$FORM{'tstid'},$FORM{'cndid'});
for $iopt (0 .. $#testdates) {
$j=$#testdates-$iopt;
($optval,$qcor,$qinc,$tscore) = split(/&/, $testdates[$j]);
$optdesc = $optval;
$optval =~ s/ /_/g;
#$optdesc =~ s/ GMT//g;
if ($TEST{'seq'} eq 'std') {
$lstdates = join('',$lstdates,"<OPTION value=\"$optval\">$optdesc\&nbsp;($tscore)\n");
$jscript = join('',$jscript,"s[$iopt]=$tscore;\n");
} else {
$lstdates = join('',$lstdates,"<OPTION value=\"$optval\">$optdesc</OPTION>\n");
}
}
} else {
$iopt=0;
$testdescriptions = "";
for $i (0 .. $#tests) {
if ($tests[$i] ne '') {
&get_test_profile($CLIENT{'clid'}, $tests[$i]);
@tmpdates = getHistoricTests($testcomplete,$CLIENT{'clid'},$tests[$i],$FORM{'cndid'});
if ($iopt > 0) {
$testdescriptions = join(', ',$testdescriptions,"<nobr>$tests[$i] - $TEST{'desc'}</nobr>");
} else {
$testdescriptions = join('',$testdescriptions,"<nobr>$tests[$i] - $TEST{'desc'}</nobr>");
}
if ($#tmpdates != -1) {
$j=$#tmpdates;
$testdates[$iopt]=$tmpdates[$j];
($optval,$qcor,$qinc,$tscore) = split(/&/, $tmpdates[$j]);
$optdesc = $optval;
$optval =~ s/ /_/g;
$optval = join('+',$optval,$TEST{'id'});
#$optdesc =~ s/ GMT//g;
$optdesc = join(' ',$optdesc,$TEST{'id'});
if ($TEST{'seq'} eq 'std') {
$lstdates = join('',$lstdates,"<OPTION value=\"$optval\">$optdesc\&nbsp;($tscore)\n");
$jscript = join('',$jscript,"s[$iopt]=$tscore;\n");
$iopt++;
} else {
$lstdates = join('',$lstdates,"<OPTION value=\"$optval\">$optdesc\n");
}
}
}
}
}
$lstdates = join('',$lstdates,"</SELECT>\n");
$styles = "SELECT {\"font-size: 8pt;\"}\n";
$styles = join('',$styles,"INPUT {\"font-size: 8pt;height: 20px;\"}\n");
print "<HTML>
<HEAD>
<TITLE>$REPORT{'rptid'} - $REPORT{'rptdesc'}</TITLE>
<STYLE>
<!--
$styles
-->
</STYLE>
<SCRIPT language=\"JavaScript\">
<!--
$jscript
function wdwOnLoad() {
var f;
f=document.rptform1;
f.onsubmit=submitMe;
f.tdatesel.focus();
f.cbsellast.selectedIndex=0;
exportClick(f);
selall(f);
}
function exportClick(f) {
if (f.cbexport.checked) {
f.target = \"_self\";
} else {
f.target = \"reportdetail\";
}
}
function submitMe() {
var f;
var bok = false;
f = document.rptform1;
f.testdates.value=\"\";
for (i=0; i < f.tdatesel.options.length; i++) {
if (f.tdatesel.options[i].selected) {
bok = true;
f.testdates.value += \",\";
f.testdates.value += f.tdatesel.options[i].value;
}
}
if (bok) {
f.testdates.value += \",\";
} else {
alert(\"You must select at least one test date.\");
f.tdatesel.focus();
}
return bok;
}
function selall(f) {
var i;
for (i=0; i < f.tdatesel.options.length; i++) {
f.tdatesel.options[i].selected = true;
}
return false;
}
function deselall(f) {
var i;
for (i=0; i < f.tdatesel.options.length; i++) {
f.tdatesel.options[i].selected = false;
}
return false;
}
function sellast(f) {
var i,j,n,t;
j=f.cbsellast.selectedIndex;
if (j != -1) {
if (j == 0) {
selall(f);
} else {
n=f.cbsellast.options[j].value;
if (n > 10) {
selscores(f,n);
} else {
deselall(f);
t=f.tdatesel.options.length;
n=(t < f.cbsellast.options[j].value) ? t : f.cbsellast.options[j].value;
for (i=0; i < n; i++) {
f.tdatesel.options[i].selected = true;
}
}
}
}
return false;
}
function selscores(f,j) {
var i,n,h,l,nh,nl;
if (j == 11) {
n=0;
j=0;
for (i=0; i < f.tdatesel.options.length; i++) {
if (s[i] > n) {
j=i;
n=s[i];
}
}
f.tdatesel.selectedIndex=j;
} else {
selall(f);
if (j == 12) {
nl=101;
for (i=f.tdatesel.options.length-1; i >= 0; i--) {
if (s[i] < nl) {
l=i;
nl=s[i];
}
}
f.tdatesel.options[l].selected=false;
} else {
nh=0;
nl=101;
for (i=f.tdatesel.options.length-1; i >= 0; i--) {
if (s[i] > nh) {
h=i;
nh=s[i];
}
}
for (i=f.tdatesel.options.length-1; i >= 0; i--) {
if (i != h) {
if (s[i] < nl) {
l=i;
nl=s[i];
}
}
}
f.tdatesel.options[l].selected=false;
f.tdatesel.options[h].selected=false;
}
}
return false;
}
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
alert(\"This source and all graphics are proprietary and may not be viewed or copied.\");
return false;
} else {
if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert(\"This source and all graphics are proprietary and may not be viewed or copied.\");
return false;
}
}
return true;
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
window.onload=wdwOnLoad;
// -->
</SCRIPT>
</HEAD>
<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"
TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"
VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">
<FORM name=\"rptform1\" action=\"$cgiroot/creports003.pl\" METHOD=GET TARGET=\"reportdetail\">
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"frm\" value=\"3\">
<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">
<input type=hidden name=\"tstid\" value=\"$FORM{'tstid'}\">
<input type=hidden name=\"cndid\" value=\"$FORM{'cndid'}\">
<input type=hidden name=\"clid\" value=\"$FORM{'clid'}\">
<input type=hidden name=\"testdates\" value=\"\">
<input type=hidden name=\"multiple\" value=\"$FORM{'multiple'}\">
<CENTER>
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD ALIGN=\"left\" valign=\"top\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>
<B>$xlatphrase[686]</B><BR>
</FONT>
</TD>
</TR>
<TR>
<TD ALIGN=\"left\" valign=\"top\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=1>
$testdescriptions
</FONT>
</TD>
</TABLE>
<TABLE cellpadding=0 cellspacing=0 border=1 width=100\%>
";
if ($TEST{'seq'} eq 'std') {
print "<TR>
<TD rowspan=4>
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD align=\"center\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>
$xlatphrase[687]<br>
</font>
</TD>
</TR>
<TR>
<TD align=\"center\">
<font size=1>
<SELECT NAME=\"cbsellast\" onChange=\"sellast(this.form)\">
<OPTION value=0>$xlatphrase[634]
";
if ($FORM{'multiple'} ne '1') {
print "
<OPTION value=11>$xlatphrase[705]
";
}
print "
<OPTION value=12>$xlatphrase[706]
<OPTION value=13>$xlatphrase[707]
";
if ($FORM{'multiple'} ne '1') {
print "
<OPTION value=1>$xlatphrase[695]
<OPTION value=2>$xlatphrase[696]
<OPTION value=3>$xlatphrase[697]
<OPTION value=4>$xlatphrase[698]
<OPTION value=5>$xlatphrase[699]
<OPTION value=6>$xlatphrase[700]
<OPTION value=7>$xlatphrase[701]
<OPTION value=8>$xlatphrase[702]
<OPTION value=9>$xlatphrase[703]
<OPTION value=10>$xlatphrase[704]
";
}
print "
</SELECT>
</font>
</TD>
</TR>
<TR>
<TD align=\"center\">
<FONT SIZE=2>
$lstdates</br>
</font>
</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN=\"center\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>$xlatphrase[688]</font>
</TD>
</TR>
<TR>
<TD ALIGN=\"center\">
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=RADIO NAME=\"rbsort\" VALUE=\"date\" CHECKED>
</TD>
<TD><font size=2>$xlatphrase[163]</font></TD>
</TR>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=RADIO NAME=\"rbsort\" VALUE=\"score\">
</TD>
<TD><font size=2>$xlatphrase[361]</font></TD>
</TR>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=RADIO NAME=\"rbsort2\" VALUE=\"d\" CHECKED>
</TD>
<TD><font size=2>$xlatphrase[691]</font></TD>
</TR>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=RADIO NAME=\"rbsort2\" VALUE=\"a\">
</TD>
<TD><font size=2>$xlatphrase[690]</font></TD>
</TR>
</TABLE>
</td>
</tr>
<TR>
<TD ALIGN=\"center\">
<nobr>
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>$xlatphrase[689]</font>
</nobr>
</TD>
</TR>
<TR>
<TD ALIGN=\"center\">
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=CHECKBOX NAME=\"cbcor\" VALUE=\"qcor\" CHECKED>
</TD>
<TD><font size=2>$xlatphrase[137]</font></TD>
</TR>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=CHECKBOX NAME=\"cbinc\" VALUE=\"qinc\" CHECKED>
</TD>
<TD><font size=2>$xlatphrase[692]</font></TD>
</TR>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=CHECKBOX NAME=\"cbscore\" VALUE=\"score\" CHECKED>
</TD>
<TD><font size=2>$xlatphrase[361]</font></TD>
</TR>
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=CHECKBOX NAME=\"cbpf\" VALUE=\"pf\" CHECKED>
</TD>
<TD><font size=2>$xlatphrase[693]</font></TD>
</TR>
<!-- Need to get time code working before users can see this option
<TR>
<TD ALIGN=\"right\">
<INPUT TYPE=CHECKBOX NAME=\"cbtim\" VALUE=\"etim\">
</TD>
<TD><font size=2>$xlatphrase[694]</font></TD>
</TR>
-->
</TABLE>
</TD>
</TR>
";
$colspan="colspan=2";
} else {
print "<TR>
<TD>
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD align=\"center\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>
$xlatphrase[687]<br>
</font>
</TD>
</TR>
<TR>
<TD align=\"center\">
<font size=1>
<SELECT NAME=\"cbsellast\" onChange=\"sellast(this.form)\">
<OPTION value=0>$xlatphrase[634]
<OPTION value=1>$xlatphrase[695]
<OPTION value=2>$xlatphrase[696]
<OPTION value=3>$xlatphrase[697]
<OPTION value=4>$xlatphrase[698]
<OPTION value=5>$xlatphrase[699]
<OPTION value=6>$xlatphrase[700]
<OPTION value=7>$xlatphrase[701]
<OPTION value=8>$xlatphrase[702]
<OPTION value=9>$xlatphrase[703]
<OPTION value=10>$xlatphrase[704]
</SELECT>
</font>
</TD>
</TR>
<TR>
<TD align=\"center\">
<FONT SIZE=2>
$lstdates</br>
</font>
</TD>
</TR>
</TABLE>
</TD>
</TR>
";
$colspan="";
}
print "<TR>
<TD $colspan ALIGN=\"center\">
<font size=2>
";
$testspending = CountTestFilesByCnd($testpending, $CLIENT{'clid'},$id,$FORM{'cndid'});
if ($testspending > 0) {
print "
Print\&nbsp\; <A HREF=\"$cgiroot/tmaster.pl?tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=$CANDIDATE{'uid'}&tstid=$TEST{'id'}\" TARGET=\"prtwindow\">Master/Key</A>";
}
print "\&nbsp;<br>
<INPUT TYPE=CHECKBOX NAME=\"cbexport\" VALUE=\"xport\" onClick=\"return exportClick(this.form)\">
\&nbsp;$xlatphrase[708]<br>
\&nbsp;<br>
<INPUT type=\"submit\" name=\"submit\" value=\"$xlatphrase[709]\">
\&nbsp;<br>
</font>
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
</BODY>
</HTML>
";
}
sub show_detail {
my @tentries;
my @tcols;
my $i;
my $j;
my $k;
my $loidx;
my $hiidx;
my $loscore;
my $hiscore;
my $avgscore;
my $avgcount;
my @testdates;
my @found;
my $sgrepfor;
my $bDisplay;
my $timetaken;
my $testtitle;
my $tstdate;
my $testid;
my @tmparray;
my @tmpdates;
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}");
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
if ($FORM{'multiple'} ne '1') {
&get_test_profile($CLIENT{'clid'}, $FORM{'tstid'});
$testtitle="$FORM{'tstid'} - $TEST{'desc'}";
} else {
$sgrepfor = $FORM{'testdates'};
$sgrepfor =~ tr/_/ /;
@testdates = split(/\,/,$sgrepfor);
&get_test_profile($CLIENT{'clid'}, $testdates[1]);
$testtitle="$xlatphrase[720]";
}
print "<HTML>
<HEAD>
<TITLE>$REPORT{'rptid'} - $REPORT{'rptdesc'}</TITLE>
<SCRIPT language=\"JavaScript\">
<!--
function checkMultiple(f,s) {
var i,j;
i=s.indexOf(\"+\",0);
if (i != -1) {
f.testdates.value=s.substring(0,i);
j=s.length+1;
i++;
f.tstid.value=s.substring(i,j);
}
}
function parmsC003base(f,s,c) {
var u,v,i,j,l,x;
x=s.split('&');
checkMultiple(f,x[0]);
u=\",\"+f.testdates.value;
l=u.length+1;
i=u.indexOf(\" \",0);
while (i != -1) {
j=i+1;
v=u.substring(0,i)+\"_\"+u.substring(j,l);
u=v;
i=u.indexOf(\" \",0);
}
f.testdates.value=u;
f.correct.value=x[1];
f.incorrect.value=x[2];
f.total.value=parseInt(x[1])+parseInt(x[2]);
if (x[3] != undefined) {
f.percent.value=x[3];
}
if (c == \"csv\") {
f.format.value=\"csv\";
} else {
f.format.value=\"\";
}
f.submit();
return false;
}
function parmsC003(f,s) {
f.remed.value=\"0\";
return parmsC003base(f,s);
}
function parmsC003c(f,s) {
f.remed.value=\"0\";
return parmsC003base(f,s,\"csv\");
}
function parmsC003r(f,s) {
f.remed.value=\"1\";
return parmsC003base(f,s);
}
function parmsC003ir(f,s) {
f.remed.value=\"2\";
return parmsC003base(f,s);
}
function parmsC003T(f,s) {
var u,v,i,j,l;
checkMultiple(f,s);
u=\",\"+f.testdates.value;
l=u.length+1;
i=u.indexOf(\" \",0);
while (i != -1) {
j=i+1;
v=u.substring(0,i)+\"_\"+u.substring(j,l);
u=v;
i=u.indexOf(\" \",0);
}
f.testdates.value=u;
f.submit();
return false;
}
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
alert(\"This source and all graphics are proprietary and may not be viewed or copied.\");
return false;
} else {
if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert(\"This source and all graphics are proprietary and may not be viewed or copied.\");
return false;
}
}
return true;
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// -->
</SCRIPT>
</HEAD>
<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"
TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"
VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">
<FORM name=\"rptform1\" action=\"$cgiroot/creports007.pl\" METHOD=GET target=\"rptdtl003\">
<CENTER>
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"frm\" value=\"4\">
<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">
<input type=hidden name=\"tstid\" value=\"$FORM{'tstid'}\">
<input type=hidden name=\"cndid\" value=\"$FORM{'cndid'}\">
<input type=hidden name=\"clid\" value=\"$CLIENT{'clid'}\">
<input type=hidden name=\"remed\" value=\"0\">
<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD VALIGN=\"top\">$CLIENT{'logo'}</TD>
<TD ALIGN=\"right\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=2>
<B>$xlatphrase[710]</B><BR>
<B>$cndid - $cndname<br>$testtitle</B><BR>
\&nbsp\;<BR>
</FONT>
</TD>
</TR>
<TR>
<TD VALIGN=\"top\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=1>
$xlatphrase[713]
</FONT>
</TD>
<TD ALIGN=\"right\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" SIZE=1>
";
if ($FORM{'cbtim'} ne '') {
print "\t\t$xlatphrase[714]\n";
}
print "\t\t</FONT>
</TD>
</TR>
</TABLE>
<TABLE cellpadding=0 cellspacing=0 border=1 width=100\%>
<TR>
<TD valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[711]</font></TD>
";
$sgrepfor = $FORM{'testdates'};
$sgrepfor =~ tr/_/ /;
@testdates = split(/\,/,$sgrepfor);
if ($FORM{'multiple'} eq '1') {
@tmparray = split(/\,/,$sgrepfor);
@tentries=();
$k=0;
for $i (0 .. $#tmparray) {
if ($tmparray[$i] ne '') {
($tstdate,$testid) = split(/\+/, $tmparray[$i]);
@tmpdates=getHistoricTests($testcomplete,$CLIENT{'clid'},$testid,$FORM{'cndid'});
$j=$#tmpdates;
if ($j != -1) {
$tentries[$k]=join('&',$testid,$tmpdates[$j]);
$k++;
}
@tmpdates=();
}
}
@tmparray=();
} else {
@tentries = getHistoricTests($testcomplete,$CLIENT{'clid'},$FORM{'tstid'},$FORM{'cndid'});
}
$loidx=-1;
$hiidx=-1;
$loscore=100;
$hiscore=0;
$avgscore=0;
$avgcount=0;
$timetaken=0;
#
# sort based on filters
#
my $sortrec;
my @unsorted;
my $sortkey;
for $i (0 .. $#tentries) {
@tcols = split(/&/,$tentries[$i]);
if ($FORM{'multiple'} eq '1') {
$testid = $tcols[0];
shift @tcols;
$sgrepfor="$tcols[0]\.+$testid";
} else {
$testid=$FORM{'tstid'};
$sgrepfor="$tcols[0]";
}
@found = grep( /$sgrepfor/,@testdates);
if ($#found != -1) {
if ($FORM{'rbsort'} eq 'date') {
$sortrec = join('&',$tcols[0],"$tcols[0]\+$testid",$tcols[1],$tcols[2],$tcols[3]);
} else {
# rbsort must be by score
$sortkey = "00000$tcols[3]";
$j=length($sortkey)-5;
$sortkey = substr($sortkey,$j,5);
$j = $i;
$sortrec = join('&',$sortkey,"$tcols[0]\+$testid",$tcols[1],$tcols[2],$tcols[3]);
}
push @unsorted, $sortrec;
}
}
@tentries = sort @unsorted;
if ($FORM{'rbsort'} eq 'date') {
if ($FORM{'rbsort2'} eq 'd') {
for $i (0 .. $#tentries) {
$j = $#tentries - $i;
$unsorted[$i] = $tentries[$j];
}
@tentries = @unsorted;
}
} else {
if ($FORM{'rbsort2'} eq 'd') {
for $i (0 .. $#tentries) {
$j = $#tentries - $i;
$unsorted[$i] = $tentries[$j];
}
@tentries = @unsorted;
}
}
@unsorted = ();
#
# send results
#
my $timfmt;
for $i (0 .. $#tentries) {
@tcols = split(/&/,$tentries[$i]);
shift @tcols;
($tstdate,$testid) = split(/\+/, $tcols[0]);
if ($FORM{'multiple'} eq '1') {
&get_test_profile($CLIENT{'clid'}, $testid);
} else {
$testid = $TEST{'id'};
}
$colspan=1;
$tcols[4] = ($tcols[3] >= 70) ? "$xlatphrase[718]" : "$xlatphrase[719]";
if ($i == 0) {
if ($TEST{'seq'} eq 'std') {
if ($FORM{'cbcor'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[137]</font></TD>\n";
}
if ($FORM{'cbinc'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[692]</font></TD>\n";
}
if ($FORM{'cbscore'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[361]</font></TD>\n";
}
if ($FORM{'cbpf'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[712]</font></TD>\n";
}
if ($FORM{'cbtim'} ne '') {
print "<TD align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[694]<br>\($xlatphrase[363]\)</font></TD>\n";
}
} else {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">\&nbsp;</font></TD>\n";
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">\&nbsp;</font></TD>\n";
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">\&nbsp;</font></TD>\n";
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">\&nbsp;</font></TD>\n";
}
print "</TR>\n";
}
if ($TEST{'seq'} eq 'std') {
### DED 9/1/04 Removed .tim files
#if ($FORM{'cbtim'} ne '') {
#$tcols[5] = &computeTestTime($testcomplete,$CLIENT{'clid'},$TEST{'id'},$FORM{'cndid'},$tstdate);
#$timetaken += $tcols[5];
#$timfmt = &formatTimeFromSeconds($tcols[5],"h:m:s");
#}
$loidx = ($tcols[3] < $loscore) ? $i : $loidx;
$hiidx = ($tcols[3] > $hiscore) ? $i : $hiidx;
$loscore = ($tcols[3] < $loscore) ? $tcols[2] : $loscore;
$hiscore = ($tcols[3] > $hiscore) ? $tcols[2] : $hiscore;
$avgscore += $tcols[3];
$avgcount++;
print "<TR>\n";
print "<TD valign=top><font size=2><nobr>".
"<a href=\"javascript:parmsC003(document.rptform2,'$tcols[0]&$tcols[1]&$tcols[2]&$tcols[3]')\">$tstdate</a>".
"\&nbsp;$testid\&nbsp;<a href=\"javascript:parmsC003r(document.rptform2,'$tcols[0]&&')\">Only Responses</a>".
"\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;<a href=\"javascript:parmsC003ir(document.rptform2,'$tcols[0]&&')\">Only Incorrect Responses</a>".
"</nobr></font></TD>\n";
if ($FORM{'cbcor'} ne '') {
$colspan++;
print "<TD align=middle valign=top><font size=2>$tcols[1]</font></TD>\n";
}
if ($FORM{'cbinc'} ne '') {
$colspan++;
print "<TD align=middle valign=top><font size=2>$tcols[2]</font></TD>\n";
}
if ($FORM{'cbscore'} ne '') {
print "<TD align=middle valign=top><font size=2>$tcols[3] \%</font></TD>\n";
}
if ($FORM{'cbpf'} ne '') {
print "<TD align=middle valign=top><font size=2>$tcols[4]</font></TD>\n";
}
if ($FORM{'cbtim'} ne '') {
print "<TD align=right valign=top><font size=2><a href=\"javascript:parmsC003T(document.rptform3,'$tcols[0]&');\">$timfmt</a></font></TD>\n";
}
} else {
print "<TR>
<TD valign=top><font size=2><nobr><a href=\"javascript:parmsC003(document.rptform2,'$tcols[0]&');\">$tstdate</a>".
"&nbsp;&nbsp;&nbsp;<a href=\"javascript:parmsC003c(document.rptform2,'$tcols[0]&');\">CSV Format<a>".
"</nobr></font></TD>
<TD align=middle valign=top colspan=4><font size=2>$tcols[1]</font></TD>
";
}
print "</TR>\n";
}
if ($TEST{'seq'} eq 'std') {
@tcols = split(/&/,$tentries[$hiidx]);
shift @tcols;
$tcols[0] =~ tr/+/ /;
print "<TR>\n";
print "<TD colspan=$colspan align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\"><nobr>$tcols[0]</nobr></font></TD>\n";
if ($FORM{'cbscore'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$tcols[3] \%</font></TD>\n";
}
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[715]</font></TD>\n";
if ($FORM{'cbtim'} ne '') {
print "<TD align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$tcols[5]</font></TD>\n";
}
print "</TR>\n";
@tcols = split(/&/,$tentries[$loidx]);
shift @tcols;
$tcols[0] =~ tr/+/ /;
print "<TR>\n";
print "<TD colspan=$colspan align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\"><nobr>$tcols[0]</nobr></font></TD>\n";
if ($FORM{'cbscore'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$tcols[3] \%</font></TD>\n";
}
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$xlatphrase[716]</font></TD>\n";
if ($FORM{'cbtim'} ne '') {
print "<TD align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$tcols[5]</font></TD>\n";
}
print "</TR>\n";
$tcols[0] = $xlatphrase[717];
$tcols[3] = int($avgscore / $avgcount);
$tcols[4] = ($tcols[2] >= 70) ? "$xlatphrase[718]" : "$xlatphrase[719]";
print "<TR>\n";
print "<TD colspan=$colspan align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\"><nobr>$tcols[0]</nobr></font></TD>\n";
if ($FORM{'cbscore'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$tcols[3] \%</font></TD>\n";
}
if ($FORM{'cbpf'} ne '') {
print "<TD align=middle valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$tcols[4]</font></TD>\n";
}
if ($FORM{'cbtim'} ne '') {
$tcols[5] = int($timetaken / $avgcount);
$timfmt = &formatTimeFromSeconds($tcols[5],"h:m:s");
print "<TD align=right valign=top><font size=2 COLOR=\"$SYSTEM{'HEADERCOLOR'}\">$timfmt</font></TD>\n";
}
print "</TR>\n";
}
@tentries = ();
print "</TABLE>
</FORM>
<FORM name=\"rptform2\" action=\"$cgiroot/testreport.pl\" METHOD=GET TARGET=\"reportdetail\">
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"tstid\" value=\"$FORM{'tstid'}\">
<input type=hidden name=\"cndid\" value=\"$FORM{'cndid'}\">
<input type=hidden name=\"clid\" value=\"$FORM{'clid'}\">
<input type=hidden name=\"testdates\" value=\"\">
<input type=hidden name=\"correct\" value=\"\">
<input type=hidden name=\"incorrect\" value=\"\">
<input type=hidden name=\"total\" value=\"\">
<input type=hidden name=\"percent\" value=\"\">
<input type=hidden name=\"remed\" value=\"0\">
<input type=hidden name=\"format\" value=\"\">
</FORM>
<FORM name=\"rptform3\" action=\"$cgiroot/creports007.pl\" METHOD=GET TARGET=\"reportdetail\">
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"frm\" value=\"3\">
<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">
<input type=hidden name=\"tstid\" value=\"$FORM{'tstid'}\">
<input type=hidden name=\"cndid\" value=\"$FORM{'cndid'}\">
<input type=hidden name=\"clid\" value=\"$FORM{'clid'}\">
<input type=hidden name=\"testdates\" value=\"\">
<input type=hidden name=\"remed\" value=\"0\">
</FORM>
</CENTER>
</BODY>
</HTML>
";
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "3", "Exec Report $FORM{'rptno'} completed");
}
sub download_detail {
my @tentries;
my @tcols;
my $i;
my $j;
my $loidx;
my $hiidx;
my $loscore;
my $hiscore;
my $avgscore;
my $avgcount;
my @testdates;
my @found;
my $sgrepfor;
my $bDisplay;
my $timetaken;
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}");
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
&get_test_profile($CLIENT{'clid'}, $FORM{'tstid'});
print "$xlatphrase[710]\n";
print "$cndid - $cndname\n";
print "$FORM{'tstid'} - $TEST{'desc'}\n";
print "\n";
print "$xlatphrase[711]";
if ($TEST{'seq'} eq 'std') {
if ($FORM{'cbcor'} ne '') {
print "\t$xlatphrase[137]";
}
if ($FORM{'cbinc'} ne '') {
print "\t$xlatphrase[692]";
}
if ($FORM{'cbscore'} ne '') {
print "\t$xlatphrase[361]";
}
if ($FORM{'cbpf'} ne '') {
print "\t$xlatphrase[712]";
}
if ($FORM{'cbtim'} ne '') {
print "\t$xlatphrase[694]";
}
} else {
print "\t";
print "\t";
print "\t";
print "\t";
}
print "\n";
@tentries = getHistoricTests($testcomplete,$CLIENT{'clid'},$FORM{'tstid'},$FORM{'cndid'});
$loidx=-1;
$hiidx=-1;
$loscore=100;
$hiscore=0;
$avgscore=0;
$avgcount=0;
$timetaken=0;
$sgrepfor = $FORM{'testdates'};
$sgrepfor =~ tr/_/ /;
@testdates = split(/\,/,$sgrepfor);
#
# sort based on filters
#
my $sortrec;
my @unsorted;
my $sortkey;
for $i (0 .. $#tentries) {
@tcols = split(/&/,$tentries[$i]);
$sgrepfor="$tcols[0]";
@found = grep( /$sgrepfor/,@testdates);
if ($#found != -1) {
if ($FORM{'rbsort'} eq 'date') {
$sortrec = join('&',$tcols[0],$tcols[0],$tcols[1],$tcols[2],$tcols[3]);
} else {
# rbsort must be by score
$sortkey = "00000$tcols[3]";
$j=length($sortkey)-5;
$sortkey = substr($sortkey,$j,5);
$j = $i;
$sortrec = join('&',$sortkey,$tcols[0],$tcols[1],$tcols[2],$tcols[3]);
}
push @unsorted, $sortrec;
}
}
@tentries = sort @unsorted;
if ($FORM{'rbsort'} eq 'date') {
if ($FORM{'rbsort2'} eq 'd') {
for $i (0 .. $#tentries) {
$j = $#tentries - $i;
$unsorted[$i] = $tentries[$j];
}
@tentries = @unsorted;
}
} else {
if ($FORM{'rbsort2'} eq 'd') {
for $i (0 .. $#tentries) {
$j = $#tentries - $i;
$unsorted[$i] = $tentries[$j];
}
@tentries = @unsorted;
}
}
@unsorted = ();
#
# send results
#
my $timfmt;
for $i (0 .. $#tentries) {
@tcols = split(/&/,$tentries[$i]);
shift @tcols;
$colspan="";
$tcols[4] = ($tcols[3] >= 70) ? "$xlatphrase[718]" : "$xlatphrase[719]";
if ($TEST{'seq'} eq 'std') {
### DED 9/1/04 Removed .tim files
#if ($FORM{'cbtim'} ne '') {
#$tcols[5] = &computeTestTime($testcomplete,$CLIENT{'clid'},$FORM{'tstid'},$FORM{'cndid'},$tcols[1]);
#$timetaken += $tcols[5];
#$timfmt = &formatTimeFromSeconds($tcols[5],"h:m:s");
#}
$loidx = ($tcols[3] < $loscore) ? $i : $loidx;
$hiidx = ($tcols[3] > $hiscore) ? $i : $hiidx;
$loscore = ($tcols[3] < $loscore) ? $tcols[3] : $loscore;
$hiscore = ($tcols[3] > $hiscore) ? $tcols[3] : $hiscore;
$avgscore += $tcols[3];
$avgcount++;
print "$tcols[0]";
if ($FORM{'cbcor'} ne '') {
$colspan = join('',$colspan,"\t");
print "\t$tcols[1]";
}
if ($FORM{'cbinc'} ne '') {
$colspan = join('',$colspan,"\t");
print "\t$tcols[2]";
}
if ($FORM{'cbscore'} ne '') {
print "\t$tcols[3]";
}
if ($FORM{'cbpf'} ne '') {
print "\t$tcols[4]";
}
if ($FORM{'cbtim'} ne '') {
print "\t$timfmt";
}
} else {
print "$tcols[0]";
print "\t$tcols[1]";
}
print "\n";
}
if ($TEST{'seq'} eq 'std') {
@tcols = split(/&/,$tentries[$hiidx]);
shift @tcols;
print "$tcols[0]$colspan";
if ($FORM{'cbscore'} ne '') {
print "\t$tcols[3]";
}
print "\t$xlatphrase[715]";
if ($FORM{'cbtim'} ne '') {
print "\t$tcols[5]";
}
print "\n";
@tcols = split(/&/,$tentries[$loidx]);
shift @tcols;
print "$tcols[0]$colspan";
if ($FORM{'cbscore'} ne '') {
print "\t$tcols[3]";
}
print "\t$xlatphrase[716]";
if ($FORM{'cbtim'} ne '') {
print "\t$tcols[5]";
}
print "\n";
$tcols[0] = $xlatphrase[717];
$tcols[2] = int($avgscore / $avgcount);
$tcols[3] = ($tcols[3] >= 70) ? "$xlatphrase[718]" : "$xlatphrase[719]";
print "$tcols[0]$colspan";
if ($FORM{'cbscore'} ne '') {
print "\t$tcols[3]";
}
if ($FORM{'cbpf'} ne '') {
print "\t$tcols[4]";
}
if ($FORM{'cbtim'} ne '') {
$tcols[5] = int($timetaken / $avgcount);
$timfmt = &formatTimeFromSeconds($tcols[5],"h:m:s");
print "\t$timfmt";
}
print "\n";
}
@tentries = ();
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "3", "Exec Report $FORM{'rptno'} completed");
}
################################################################################
#
# Subroutine Name
# GetTestHeader
#
# Description
# This subroutine returns the header of the test file
#
# Inputs
# $clientId -- The id of the client to search through
#
# Outputs
# None
#
# Returns
# @testFields -- An array of fields in the header
#
#adt080401###############################################################################
sub GetTestHeader
{
my $clientId = $_[0];
my @testList = &get_data("tests.$clientId");
my $testHdr = $testList[0];
my $testFields;
chop( $testHdr );
@testFields = split( /&/, $testHdr );
return @testFields;
}
#adt080401###############################################################################
#
# Subroutine Name
# GetTestsByOwner
#
# Description
# This subroutine searches through the test definition file of the given
# client for all the tests that are owned by the given user id or are public
#
# Inputs
# $clientId -- The id of the client to search through
# $ownedBy -- The name of the owner of the test to search for
#
# Outputs
# None
#
# Returns
# @tests -- An array of tests owned by the given user id
#
################################################################################
sub GetTestsByOwner
{
my $clientId = $_[0];
my $ownedBy = $_[1];
my %currHash;
my @testList = &get_data("tests.$clientId");
my @currField;
my @tests;
my $testHdr = $testList[0];
my $testFields;
my $testCntr;
@testFields = &GetTestHeader( $clientId );
for( $testCntr = 1; $testCntr < $#testList; $testCntr++ )
{
#print "<b>$testList[$testCntr]</b><br>\n";
chop( $testList[$testCntr] );
@currField = split( '&', $testList[$testCntr] );
for( 0 .. $#testFields )
{
$currHash{$testFields[$_]} = $currField[$_];
}
#print "$currHash{'ownedby'} - $ownedBy<p>";
if( ( $currHash{'ownedby'} eq $ownedBy ) || ( $currHash{'ownedby'} eq "" ) )
{
push( @tests, $testList[$testCntr] );
#print "<font color=\"#ff0000\"><b>$testList[$testCntr]</b></font><br>\n";
}
}
return @tests;
}
#
# Return: Count of test result files in $dir matching regex with $clid
# and $testid, OR -1 if there was an error.
#
sub CountTestFilesByCnd {
my ($dir, $clid, $testid, $cndid) = @_;
if ( ! defined($dir) ) {
&logger::logerr("Undefined directory for client ID '$clid', testid '$testid'");
return -1;
}
if ( ! defined($clid) ) {
&logger::logerr("Undefined client ID for directory '$dir', testid '$testid'");
return -1;
}
if ( ! defined($testid) ) {
&logger::logerr("Undefined test ID for directory '$dir', client ID '$clid'");
return -1;
}
my $tstcount = scalar(get_matching_files($dir, "^$clid".'\.'."$cndid".'\.'."$testid\$"));
return $tstcount;
}
#
# Return: Count of test result files in $dir matching regex with $clid
# and $testid, OR -1 if there was an error.
#
sub CountHistoricTests {
my ($dir, $clid, $testid, $cndid) = @_;
if ( ! defined($dir) ) {
&logger::logerr("Undefined directory for client ID '$clid', testid '$testid'");
return -1;
}
if ( ! defined($clid) ) {
&logger::logerr("Undefined client ID for directory '$dir', testid '$testid'");
return -1;
}
if ( ! defined($testid) ) {
&logger::logerr("Undefined test ID for directory '$dir', client ID '$clid'");
return -1;
}
my $historyfile = join($pathsep,$dir,"$clid.$testid.history");
open (HISTFILE,"<$historyfile") or return 0;
my @histentries = <HISTFILE>;
close HISTFILE;
my $sgrepfor=join('&',"\<\<\>\>$clid","$cndid","$testid","");
my @cndidentries = grep( /$sgrepfor/,@histentries);
my $tstcount = $#cndidentries + 1;
return $tstcount;
}
#
# Return: Count of cnd result files in $dir matching regex with $clid
# and $cndid, OR -1 if there was an error.
#
sub CountCndFiles {
my ($dir, $clid, $cndid) = @_;
if ( ! defined($dir) ) {
&logger::logerr("Undefined directory for client ID '$clid', cndid '$cndid'");
return -1;
}
if ( ! defined($clid) ) {
&logger::logerr("Undefined client ID for directory '$dir', cndid '$cndid'");
return -1;
}
if ( ! defined($cndid) ) {
&logger::logerr("Undefined cnd ID for directory '$dir', client ID '$clid'");
return -1;
}
return scalar(get_matching_files($dir, "^$clid".'\.'."$cndid".'\.\S+$'));
}
#
# Return: Sum of times taken during a test in seconds.
#
sub computeTestTime {
my ($dir, $clid, $testid, $cndid, $tstkey) = @_;
if ( ! defined($dir) ) {
&logger::logerr("Undefined directory for client ID '$clid', testid '$testid'");
return -1;
}
if ( ! defined($clid) ) {
&logger::logerr("Undefined client ID for directory '$dir', testid '$testid'");
return -1;
}
if ( ! defined($testid) ) {
&logger::logerr("Undefined test ID for directory '$dir', client ID '$clid'");
return -1;
}
my $timefile = join($pathsep,$dir,"$clid.$cndid.$testid.tim");
open (TLOGFILE,"<$timefile") or return 0;
my @tlogentries = <TLOGFILE>;
close TLOGFILE;
my $sgrepfor="^$tstkey\&(1)\.(2)\.(.*)\&$clid\&$cndid\&$testid\&(.*)";
my @cndidentries = grep( /$sgrepfor/,@tlogentries);
@tlogentries = ();
my $iidx;
my @tentrycols;
my $tottime;
$tottime = 0;
for $iidx (0 .. $#cndidentries) {
@tentrycols = split(/&/,$cndidentries[$iidx]);
$tottime += $tentrycols[7];
}
@tentrycols = ();
return $tottime;
}
sub formatTimeFromSeconds {
my ($t, $fmt) = @_;
my $h;
my $m;
my $s;
my $r;
my $j;
$m = int($t/60);
$s = $t - ($m * 60);
$h = int($m/60);
$m = $m - ($h * 60);
if ($fmt =~ m/h/i) {
$r = "00000$h";
$j=length($r)-2;
$r = substr($r,$j,2);
$fmt =~ s/h/$r/g;
}
if ($fmt =~ m/m/i) {
$r = "00000$m";
$j=length($r)-2;
$r = substr($r,$j,2);
$fmt =~ s/m/$r/g;
}
if ($fmt =~ m/s/i) {
$r = "00000$s";
$j=length($r)-2;
$r = substr($r,$j,2);
$fmt =~ s/s/$r/g;
}
return $fmt;
}