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.

1907 lines
64 KiB

#!/usr/bin/perl
##!/usr/local/bin/perl5.8.0
#
# $Id: creports.pl,v 1.24 2006/09/13 18:12:31 psims Exp $
#
# Source File: creports.pl
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
require 'tstatlib.pl';
require 'cybertestlib.pl';
use Time::Local;
$FORM{'frm'}="";
&app_initialize;
my $HBI_Debug = 0 ;
my $HBI_Key ;
if ($HBI_Debug) {
foreach $HBI_Key (sort keys %FORM) {
warn __FILE__ . " key $HBI_Key FORM $FORM{$HBI_Key} X" ;
}
}
if ($FORM{'pdf'}) {
print "Content-Type: application/pdf\n\n";
open(STDOUT, "| ".$cfgroot.$pathsep."html2pdf");
select(STDOUT); # needed for older versions of perl
} else {
print "Content-Type: text/html\n\n";
#print STDERR "Content-Type: text/html\n\n";
#open(STDOUT, "| filtertest.pl");
#select(STDOUT);
}
# ACT-C-001&Login Activity Report
# ACT-C-005&Login Activity by User
# ACT-C-002&Test Activity Report
# ACT-C-003&Test Reports by Candidate
# ACT-C-004&Test Statistics by Test
# ACT-C-004F&Test Statistics by Test User Filter
# ACT-C-006&Test Report by User
# ACT-C-007&Timing Statistics by Test
unless ($FORM{'tid'}) {
warn "ERROR: Empty Session ID " ;
&show_illegal_access_warning("user");
exit();
}
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
unless ($SESSION{'clid'}) {
warn "ERROR: Empty Client ID in Session data for Session ID $FORM{'tid'} " ;
&show_illegal_access_warning("user");
exit();
}
$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 (substr($FORM{'rptno'},0,5) ne 'ACT-C') {
# This is a custom report
my ($ret);
(my $rptapp, @rptparams) = split(/ /, $REPORT{'rptapp'});
unless ($ret=do $rptapp) {
warn "couldn't parse $REPORT{'rptapp'}: $@" if $@;
warn "couldn't do $REPORT{'rptapp'}: $!" unless defined $ret;
warn "couldn't run $REPORT{'rptapp'}" unless $ret;
}
# At this point the custom report takes over writing out all the html.
} elsif (($FORM{'frm'} eq '1') || ($FORM{'frm'} eq '5')) {
&show_index;
} else {
if ($FORM{'frm'} eq '2') {
&show_detail;
} else {
if ($FORM{'frm'} eq '') {
if ($FORM{'rptno'} eq 'ACT-C-004') {
$REPORT{'rptid'}=$FORM{'rptno'};
&show_index;
} elsif ($FORM{'rptno'} eq 'ACT-C-003') {
$REPORT{'rptid'}=$FORM{'rptno'};
# &show_index;
&show_frames_003;
} elsif ($FORM{'rptno'} eq 'ACT-C-006') {
$REPORT{'rptid'}=$FORM{'rptno'};
&show_detail;
} elsif ($FORM{'rptno'} eq 'ACT-C-007') {
$REPORT{'rptid'}=$FORM{'rptno'};
&show_frames_007;
} elsif ($FORM{'rptno'} eq 'ACT-C-002') {
$REPORT{'rptid'}=$FORM{'rptno'};
&show_frames_002;
} elsif ($FORM{'rptno'} eq 'ACT-C-001') {
$REPORT{'rptid'}=$FORM{'rptno'};
&show_frames_001;
} else {
&show_frames;
}
} 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";
}
}
}
}
close(STDOUT);
sub show_frames {
print "<HTML>\n";
print "<HEAD></HEAD>\n";
print "<FRAMESET frameborder=0 cols=\"30%,*\">\n";
print "<FRAME name=\"rptindex\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=1&rptno=$FORM{'rptno'}\">\n";
print "<FRAME name=\"rptdetail\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0&rptno=$FORM{'rptno'}\">\n";
print "</FRAMESET>\n";
print "</HTML>\n";
}
sub show_frames_001 {
print "<HTML>\n";
print "<HEAD></HEAD>\n";
print "<FRAMESET frameborder=0 rows=\"20%,*\">\n";
print "<FRAME name=\"rpthead\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=5&rptno=$FORM{'rptno'}\">\n";
print "\t<FRAMESET frameborder=0 cols=\"30%,*\">\n";
print "\t<FRAME name=\"rptindex\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0&rptno=$FORM{'rptno'}\">\n";
print "\t<FRAME name=\"rptdetail\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0&rptno=$FORM{'rptno'}\">\n";
print "\t</FRAMESET>\n";
print "</FRAMESET>\n";
print "</HTML>\n";
}
sub show_frames_002 {
print "<HTML>\n";
print "<HEAD></HEAD>\n";
print "<FRAMESET frameborder=0 rows=\"25%,*\">\n";
print "\t<FRAME name=\"rptindex\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=5&rptno=$FORM{'rptno'}\">\n";
print "\t<FRAME name=\"rptdetail\" frameborder=0 src=\"$urlroot/creports.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=1&rptno=$FORM{'rptno'}\">\n";
print "</FRAMESET>\n";
print "</HTML>\n";
}
sub show_frames_003 {
print "<HTML>\n";
print "<HEAD></HEAD>\n";
print "<FRAMESET frameborder=0 rows=\"60,*\">\n";
print "\t<FRAME noresize scrolling=\"no\" name=\"rptindx003\" frameborder=0 src=\"$urlroot/creports003.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=1&rptno=$FORM{'rptno'}\">\n";
print "\t<FRAMESET frameborder=0 cols=\"230,*\">\n";
print "\t\t<FRAME name=\"rpttidx003\" frameborder=0 src=\"$urlroot/creports003.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\">\n";
print "\t\t<FRAME name=\"rptdtl003\" frameborder=0 src=\"$urlroot/creports003.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\">\n";
print "\t</FRAMESET>\n";
print "</FRAMESET>\n";
print "</HTML>\n";
}
sub show_frames_007 {
print "<HTML>\n";
print "<HEAD></HEAD>\n";
print "<FRAMESET frameborder=0 rows=\"30%,*\">\n";
print "\t<FRAME name=\"rptindx007\" frameborder=0 src=\"$urlroot/creports007.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=1&rptno=$FORM{'rptno'}\">\n";
print "\t<FRAMESET frameborder=0 cols=\"30%,*\">\n";
print "\t\t<FRAME name=\"rptqidx007\" frameborder=0 src=\"$urlroot/creports007.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\">\n";
print "\t\t<FRAME name=\"rptdtl007\" frameborder=0 src=\"$urlroot/creports007.pl?lang=$SESSION{'lang'}&tid=$SESSION{'tid'}&frm=0\">\n";
print "\t</FRAMESET>\n";
print "</FRAMESET>\n";
print "</HTML>\n";
}
sub print_report_header() {
my $i;
$dform=1;
if ($REPORT{'rptid'} eq 'ACT-C-001') {
# C_001
my ($frm);
$faction="$cgiroot/creports.pl";
if ($FORM{"frm"} == 5) {
$ftarget="rptindex";
$frm=1;
} else {
$ftarget="rptdetail";
$frm=2
}
$fparms="<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">\n";
$fparms=join('',$fparms,"<input type=hidden name=\"frm\" value=\"$frm\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"dbfile\" value=\"\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"filter\" value=\"\">\n");
$fjscript="
function parmsC001(oform,dbf,fltr) {
oform.dbfile.value=dbf;
oform.filter.value=fltr;
oform.submit();
}
";
} elsif ($REPORT{'rptid'} eq 'ACT-C-002') {
# C_002
$dform=1;
my $testoptions="";
my $useroptions="";
my $groupoptions="";
my $yroptions="";
my $mooptions="";
my $dayoptions="";
my @flds;
#print STDERR "ACT-C-002: cbcomplete = $FORM{'cbcomplete'}\n";
#print STDERR " cbsort = $FORM{'cbsort'}\n";
my $st = time;
my @tmparray=&get_test_list($CLIENT{'clid'});
#my $end = time;
#my $dl = $end - $st;
#$st = $end;
#print STDERR "get_test_list($CLIENT{'clid'}) - $dl seconds\n";
print "<!-- $CLIENT{'id'} $CLIENT{'clid'} -->\n";
foreach (sort @tmparray[1..$#tmparray]) {
@flds=split(/&/,$_);
$testoptions=join('',$testoptions,"<option value=\"$flds[0]\">$flds[0]\n");
@flds=();
}
#$end = time; #$dl = $end - $st;
#print STDERR " sorting - $dl seconds\n";
#$st = time;
@tmparray=&get_client_cnd_list($CLIENT{'clid'});
#$end = time;
#$dl = $end - $st;
#print STDERR "get_client_cnd_list($CLIENT{'clid'}) - $dl seconds\n";
foreach (sort @tmparray[1..$#tmparray]) {
@flds=split(/&/,$_);
$useroptions=join('',$useroptions,"<option value=\"$flds[0]\">$flds[0]\n");
@flds=();
}
#$end = time;
#$dl = $end - $st;
#print STDERR " sorting - $dl seconds\n";
@tmparray=&get_client_groups($CLIENT{'clid'});
foreach (sort @tmparray[0..$#tmparray]) {
@flds=split(/&/,$_);
$groupoptions=join('',$groupoptions,"<option value=\"$flds[1]\">$flds[2]\n");
@flds=();
}
@tmparray=();
for $i (2000 .. scalar(1900+(localtime(time))[5])) {
$yroptions = join('',"<option value=$i>$i\n",$yroptions);
}
for $i (1 .. 12) { $mooptions = join('',$mooptions,"<option value=$i>$i\n"); }
for $i (1 .. 31) { $dayoptions = join('',$dayoptions,"<option value=$i>$i\n"); }
$faction="$cgiroot/creports.pl";
if ($FORM{'cbcomplete'} eq '') {
$FORM{'cbcomplete'}='2';
$FORM{'cbsort'}='0';
}
if ($FORM{'frm'} eq '5') {
$ftarget="rptdetail";
$fparms="<input type=hidden name=\"frm\" value=\"1\">\n";
if ($FORM{'cbcomplete'} eq '2') {
@optmarks = split(/&/,"&&checked");
} elsif ($FORM{'cbcomplete'} eq '1') {
@optmarks = split(/&/,"&checked&");
} else {
@optmarks = split(/&/,"checked&&");
}
if ($FORM{'cbsort'} eq '0') {
@srtmarks = split(/&/,"checked&");
} else {
@srtmarks = split(/&/,"&checked");
}
$flrtmarks[0] = ($FORM{'cbfiltertest'} ne '') ? "checked" : "&";
$flrtmarks[1] = ($FORM{'cbfilteruser'} ne '') ? "checked" : "&";
$flrtmarks[2] = ($FORM{'cbfilterdate'} ne '') ? "checked" : "&";
$foptions="<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" size=2>$xlatphrase[919] $xlatphrase[922]</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" size=2>$xlatphrase[920]</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" size=2>$xlatphrase[921]</FONT>
</TD>
</TR>
<TR>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>
<input type=radio name=\"cbcomplete\" value=\"2\" $optmarks[2] onClick=\"this.form.submit()\">Completed<br>
</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>
<input type=radio name=\"cbsort\" value=\"0\" $srtmarks[0] onClick=\"this.form.submit()\">$xlatphrase[919]<br>
</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>$xlatphrase[919]:
<select name=\"testfilter\" onChange=\"this.form.submit()\">
<option value=\"\">All
$testoptions
</select>
</FONT>
</TD>
</TR>
<TR>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>
<input type=radio name=\"cbcomplete\" value=\"1\" $optmarks[1] onClick=\"this.form.submit()\">In Progress<br>
</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>
<input type=radio name=\"cbsort\" value=\"1\" $srtmarks[1] onClick=\"this.form.submit()\">Username<br>
</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>User:
<select name=\"userfilter\" onChange=\"this.form.submit()\">
<option value=\"\">All
$useroptions
</select>
<nobr>
Group:
<select name=\"groupfilter\" onChange=\"this.form.submit()\">
<option value=\"\">All
$groupoptions
</select>
</FONT>
</TD>
</TR>
<TR>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>
<input type=radio name=\"cbcomplete\" value=\"0\" $optmarks[0] onClick=\"this.form.submit()\">Pending<br>
</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>
<input type=radio name=\"cbsort\" value=\"2\" $srtmarks[2] onClick=\"this.form.submit()\">Date<br>
</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>Date:
<nobr>
<select name=\"yearfilter\" onChange=\"this.form.submit()\">
<option value=\"\">All
$yroptions
</select>
<select name=\"monthfilter\" onChange=\"this.form.submit()\">
<option value=\"\">All
$mooptions
</select>
<select name=\"dayfilter\" onChange=\"this.form.submit()\">
<option value=\"\">All
$dayoptions
</select>
</nobr>
</FONT>
</TD>
</TR>
<TR>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>\&nbsp;</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>\&nbsp;</FONT>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<FONT size=2>Email Pattern:
<input type=textbox name=\"emailmask\" value=\"\" size=20 onChange=\"this.form.submit()\">
</FONT>
</TD>
</TR>
</TABLE>\n";
} else {
$ftarget="rptdetail002";
$fparms=join('',$fparms,"<input type=hidden name=\"frm\" value=\"2\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"cbcomplete\" value=\"$FORM{'cbcomplete'}\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"cbsort\" value=\"$FORM{'cbsort'}\">\n");
}
$fparms=join('',$fparms,"<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"dbfile\" value=\"\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"location\" value=\"\">\n");
$fjscript="
function parmsC002(oform,dbf,loctn) {
oform.dbfile.value=dbf;
oform.location.value=loctn;
oform.submit();
}
";
} elsif ($REPORT{'rptid'} eq 'ACT-C-003') {
# C_003
$faction="$cgiroot/creports.pl";
$ftarget="rptwindow";
$fparms="<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">\n";
$fparms=join('',$fparms,"<input type=hidden name=\"frm\" value=\"2\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"cndid\" value=\"\">\n");
$fjscript="
function parmsC003(oform,cnd) {
oform.cndid.value=cnd;
oform.submit();
}
";
} elsif ($REPORT{'rptid'} eq 'ACT-C-004') {
# C_004
$faction="$cgiroot/teststats.pl";
$ftarget="rptwindow";
$fparms="<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">\n";
$fparms=join('',$fparms,"<input type=hidden name=\"tstid\" value=\"\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"rptdesc\" value=\"$REPORT{'rptdesc'}\">\n");
$fparms=join('',$fparms,"<input type=hidden name=\"rptid\" value=\"$REPORT{'rptid'}\">\n");
$finputs="<table cellpadding=2 border=1>\n";
$finputs=join('',$finputs,"\t<tr>\n\t\t<td colspan=3 align=center valign=top>Advanced Options<br></td>\n</tr>\n");
$finputs=join('',$finputs,"<tr>\n");
$finputs=join('',$finputs,"\t\t<td valign=top><font size=2>\n<i>Question Statistics:</i><br>\n");
$finputs=join('',$finputs,"<input type=radio name=\"testsummary\" value=\"composite\" onClick=\"return reportOptions(this)\"> Question Statistics<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"showobs\" onClick=\"return reportOptions(this)\"> include inactive questions<br>\n");
#$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"exunans\"> exclude unanswered questions<br>\n");
$unansel = "<select name=minunans>\n";
$unansel .= build_number_select_list(5,20,spread);
$unansel .= "</select>\n";
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<nobr><input type=checkbox name=\"exunans\"> exclude questions with fewer than $unansel responses</nobr><br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"exnoresp\"> exclude No Response from stats<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<i>User Comments:</i><br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=radio name=\"showcmts\" value=\"donot\" onClick=\"return reportOptions(this)\"> do not include<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=radio name=\"showcmts\" value=\"withq\" onClick=\"return reportOptions(this)\"> include with question<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=radio name=\"showcmts\" value=\"atend\" onClick=\"return reportOptions(this)\"> include at end<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"anoncmts\"> anonymize comments and essay(narrative) responses<br>\n");
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t\t<td valign=top><font size=2>\n<i>$xlatphrase[28] $xlatphrase[923]</i><br>\n");
$finputs=join('',$finputs,"<input type=radio name=\"testsummary\" value=\"bycnd\" onClick=\"return reportOptions(this)\"> $xlatphrase[924]<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"statsbysubj\" onClick=\"return reportOptions(this)\"> $xlatphrase[925]<br>\n");
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t\t<td valign=top nowrap><font size=2>\n<i>$xlatphrase[926]:</i><br>");
$finputs=join('',$finputs,"<input type=radio name=\"testsummary\" value=\"extractemail\" onClick=\"return reportOptions(this)\"> $xlatphrase[927]<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"cndnme\" onClick=\"return reportOptions(this)\"> $xlatphrase[103] $xlatphrase[279]<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"cndeml\" onClick=\"return reportOptions(this)\"> $xlatphrase[103] $xlatphrase[188]<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"cndscr\" onClick=\"return reportOptions(this)\"> $xlatphrase[103] $xlatphrase[361]<br>\n");
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"cnddat\" onClick=\"return reportOptions(this)\"> $xlatphrase[163]<br>\n");
if ($CLIENT{'clcnd1'} ne "") {
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"excnd1\" onClick=\"return reportOptions(this)\"> $CLIENT{'clcnd1'}<br>\n");
}
if ($CLIENT{'clcnd2'} ne "") {
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"excnd2\" onClick=\"return reportOptions(this)\"> $CLIENT{'clcnd2'}<br>\n");
}
if ($CLIENT{'clcnd3'} ne "") {
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"excnd3\" onClick=\"return reportOptions(this)\"> $CLIENT{'clcnd3'}<br>\n");
}
if ($CLIENT{'clcnd4'} ne "") {
$finputs=join('',$finputs,"\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;<input type=checkbox name=\"excnd4\" onClick=\"return reportOptions(this)\"> $CLIENT{'clcnd4'}<br>\n");
}
### DED 4/6/07 Show pending rather than completed
$finputs=join('',$finputs,"<br>\n");
$finputs=join('',$finputs,"<input type=checkbox name=\"shwpending\" onClick=\"return reportOptions(this)\"> $xlatphrase[932]<br>\n");
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t</tr>\n");
$finputs=join('',$finputs,"\t</tr>\n");
$finputs=join('',$finputs,"\t\t<td align=left valign=top>&nbsp;\n");
$finputs=join('',$finputs,"\t\t</td>\n");
$finputs=join('',$finputs,"\t\t<td align=left valign=top colspan=2><font size=2>\n");
### DED 4/6/07 Filter indiv results/extractions by custom fields
$ffinputs = "";
if ($CLIENT{'clcnd1vals'} ne '' ) {
$ffinputs .= &print_clcnd_input($CLIENT{'clid'}, 1, 0, 0);
}
if ($CLIENT{'clcnd2vals'} ne '' ) {
$ffinputs .= &print_clcnd_input($CLIENT{'clid'}, 2, 0, 0);
}
if ($CLIENT{'clcnd3vals'} ne '' ) {
$ffinputs .= &print_clcnd_input($CLIENT{'clid'}, 3, 0, 0);
}
if ($CLIENT{'clcnd4vals'} ne '' ) {
$ffinputs .= &print_clcnd_input($CLIENT{'clid'}, 4, 0, 0);
}
if ($ffinputs ne "") {
$finputs .= "Filter Individual Results or Extractions by:<br>\n";
$finputs .= "<table>\n".$ffinputs."</table>\n";
}
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t</tr>\n");
$finputs=join('',$finputs,"\t</tr>\n");
$finputs=join('',$finputs,"\t\t<td align=left valign=top><font size=2>\n");
### DED 10/24/2002
### Added Filter-by-question options
#$finputs=join('',$finputs,"\&nbsp\;<br>\n");
$finputs=join('',$finputs,"<input type=checkbox name=\"filterbyques\" onClick=\"return filterCheck(this.form)\"> $xlatphrase[921] $xlatphrase[328]<br>\n");
$finputs=join('',$finputs,"<input type=checkbox name=\"specfilter\" onClick=\"return filterCheck(this.form)\"> $xlatphrase[921] $xlatphrase[928]<br>\n");
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t\t<td align=right valign=top><font size=2>\n");
my $j;
$finputs=join('',$finputs,"$xlatphrase[929]: <select name=\"mofm\">\n");
for $i (526 .. 537) {
$j=$i-525;
$finputs=join('',$finputs,"<option value=\"$j\">$xlatphrase[$i]\n");
}
$finputs=join('',$finputs,"</select><select name=\"dyfm\">\n");
for $i (1 .. 31) {
$finputs=join('',$finputs,"<option value=\"$i\">$i\n");
}
$finputs=join('',$finputs,"</select><select name=\"yrfm\">\n");
for $i (2000 .. 2099) {
$finputs=join('',$finputs,"<option value=\"$i\">$i\n");
}
$finputs=join('',$finputs,"</select><br>\n");
$finputs=join('',$finputs,"$xlatphrase[433]: <select name=\"moto\">\n");
for $i (526 .. 537) {
$j=$i-525;
$finputs=join('',$finputs,"<option value=\"$j\">$xlatphrase[$i]\n");
}
$finputs=join('',$finputs,"</select><select name=\"dyto\">\n");
for $i (1 .. 31) {
$finputs=join('',$finputs,"<option value=\"$i\">$i\n");
}
$finputs=join('',$finputs,"</select><select name=\"yrto\">\n");
for $i (2000 .. 2099) {
$finputs=join('',$finputs,"<option value=\"$i\">$i\n");
}
$finputs=join('',$finputs,"</select><br>\n");
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t\t<td align=right valign=top><font size=2>\n");
$finputs=join('',$finputs,"<input type=checkbox name=\"export\" onClick=\"return reportOptions(this)\"> $xlatphrase[930]<br>\n");
$finputs=join('',$finputs,"\t\t</font></td>\n");
$finputs=join('',$finputs,"\t</tr>\n");
$finputs=join('',$finputs,"</table>\&nbsp\;<br>\n");
$fjscript="
function onWdwLoad() {
var oform=document.rptform1;
oform.mofm.selectedIndex=0;
oform.dyfm.selectedIndex=0;
oform.yrfm.selectedIndex=0;
oform.moto.selectedIndex=oform.moto.options.length-1;
oform.dyto.selectedIndex=oform.dyto.options.length-1;
oform.yrto.selectedIndex=oform.yrto.options.length-1;
oform.testsummary[0].checked=true;
oform.showcmts[0].checked=true;
}
function filterCheck(oform) {
if (oform.specfilter.checked==true || oform.filterbyques.checked==true) {
oform.action=\"$cgiroot/creportsf.pl\";
} else {
oform.action=\"$cgiroot/teststats.pl\";
}
}
function parmsC004(oform,tst) {
oform.tstid.value=tst;
oform.submit();
}
function reportOptions(oinp) {
var oform=oinp.form,idx;
if (oinp.name==\"testsummary\") {
idx=(oform.testsummary[0].checked) ? 0 : -1;
idx=(oform.testsummary[1].checked) ? 1 : idx;
idx=(oform.testsummary[2].checked) ? 2 : idx;
return testsummaryClick(oform,idx);
} else {
if (oinp.name==\"showcmts\") {
idx=(oform.showcmts[0].checked) ? 0 : -1;
idx=(oform.showcmts[1].checked) ? 1 : idx;
idx=(oform.showcmts[2].checked) ? 2 : idx;
return showcmtsClick(oform,idx);
} else {
if (oinp.name==\"statsbysubj\") {
return statsbysubjClick(oform,oinp.checked);
} else {
if (oinp.name==\"showobs\") {
return showobsClick(oform,oinp.checked);
} else {
if (oinp.name==\"export\") {
return exportClick(oform,oinp.checked);
} else {
return dataextractOpts(oform);
}
}
}
}
}
}
function dataextractOpts(oform) {
if (!(oform.testsummary[2].checked)) {
oform.testsummary[2].checked=true;
oform.showcmts[0].checked=false;
oform.showcmts[1].checked=false;
oform.showcmts[2].checked=false;
oform.statsbysubj.checked=false;
oform.showobs.checked=false;
oform.exunans.checked=false;
oform.exnoresp.checked=false;
}
return true;
}
function testsummaryClick(oform,i) {
if (i==0) {
if (!((oform.showcmts[0].checked) || (oform.showcmts[1].checked) || (oform.showcmts[2].checked))) {
oform.showcmts[0].checked=true;
oform.statsbysubj.checked=false;
oform.showobs.checked=false;
oform.exunans.checked=false;
oform.cndnme.checked=false;
oform.cndeml.checked=false;
oform.exnoresp.checked=false;
if (\"$CLIENT{'clcnd1'}\" != \"\") {
oform.cnd1.checked=false;
}
if (\"$CLIENT{'clcnd2'}\" != \"\") {
oform.cnd2.checked=false;
}
if (\"$CLIENT{'clcnd3'}\" != \"\") {
oform.cnd3.checked=false;
}
if (\"$CLIENT{'clcnd4'}\" != \"\") {
oform.cnd4.checked=false;
}
oform.cndscr.checked=false;
}
} else {
if (i==1) {
oform.showcmts[0].checked=false;
oform.showcmts[1].checked=false;
oform.showcmts[2].checked=false;
oform.statsbysubj.checked=false;
oform.showobs.checked=false;
oform.exunans.checked=false;
oform.exnoresp.checked=false;
oform.cndnme.checked=false;
oform.cndeml.checked=false;
if (\"$CLIENT{'clcnd1'}\" != \"\") {
oform.cnd1.checked=false;
}
if (\"$CLIENT{'clcnd2'}\" != \"\") {
oform.cnd2.checked=false;
}
if (\"$CLIENT{'clcnd3'}\" != \"\") {
oform.cnd3.checked=false;
}
if (\"$CLIENT{'clcnd4'}\" != \"\") {
oform.cnd4.checked=false;
}
oform.cndscr.checked=false;
} else {
if (i==2) {
oform.showcmts[0].checked=false;
oform.showcmts[1].checked=false;
oform.showcmts[2].checked=false;
oform.statsbysubj.checked=false;
oform.showobs.checked=false;
oform.exunans.checked=false;
oform.exnoresp.checked=false;
}
}
}
return true;
}
function showcmtsClick(oform,i) {
if (!(oform.testsummary[0].checked)) {
oform.testsummary[0].checked=true;
oform.statsbysubj.checked=false;
oform.showobs.checked=false;
oform.exunans.checked=false;
oform.exnoresp.checked=false;
}
return true;
}
function statsbysubjClick(oform,chkd) {
if (chkd) {
if (!(oform.testsummary[1].checked)) {
oform.testsummary[1].checked=true;
oform.showcmts[0].checked=false;
oform.showcmts[1].checked=false;
oform.showcmts[2].checked=false;
oform.showobs.checked=false;
oform.exunans.checked=false;
oform.exnoresp.checked=false;
}
}
return true;
}
function showobsClick(oform,chkd) {
if (chkd) {
if (!(oform.testsummary[0].checked)) {
oform.testsummary[0].checked=true;
oform.showcmts[0].checked=true;
oform.statsbysubj.checked=false;
}
}
return true;
}
function exportClick(oform,chkd) {
return true;
}
window.onload=onWdwLoad;
";
} else {
# C_006
$dform=0;
$fjscript="";
$finputs="";
}
print "<HTML>
<HEAD>
<TITLE>$REPORT{'rptid'} - $REPORT{'rptdesc'}</TITLE>
<SCRIPT language=\"JavaScript\">
<!--
$fjscript
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'}\">
";
if ($dform) {
print "<FORM name=\"rptform1\" action=\"$faction\" METHOD=POST target=\"$ftarget\">\n$fparms\n";
}
if (($REPORT{'rptid'} eq 'ACT-C-004') || ($REPORT{'rptid'} eq 'ACT-C-003')) {
print "<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>$REPORT{'rptdesc'}\&nbsp;-\&nbsp;$REPORT{'rptid'}</B><BR>
</FONT>
</TD>
</TR>
</TABLE>
";
} else {
if (($REPORT{'rptid'} ne 'ACT-C-002') || (($REPORT{'rptid'} eq 'ACT-C-002') && ($FORM{'frm'} ne '1'))) {
print "<TABLE cellpadding=0 cellspacing=0 border=0 width=100\%>
<TR>
<TD VALIGN=\"top\">$CLIENT{'logo'}</TD>
</TR>
<TR>
<TD ALIGN=\"center\">
<FONT COLOR=\"$SYSTEM{'HEADERCOLOR'}\" size=2>
<B>$REPORT{'rptdesc'}\&nbsp;-\&nbsp;$REPORT{'rptid'}</B><BR>
</FONT>
</TD>
</TR>
</TABLE>
";
}
if (($REPORT{'rptid'} eq 'ACT-C-002') && ($FORM{'frm'} eq '5')) {
print "$foptions\n";
}
}
}
sub print_report_footer() {
if ($dform) { print "</FORM>\n";}
print "</BODY>\n</HTML>\n";
}
sub print_report_C_001 {
if ($FORM{"frm"} == 5) {
# print the chooser
# Filter by date
my ($j);
print "<Table><tr><td>";
#print "Filter by user <input type=checkbox name=\"specfilter\" onClick=\"return filterCheck(this.form)\"><br>\n";
#print "</td>\n<td>";
print "$xlatphrase[929]: <select name=\"mofm\">\n";
$i = 526; $j = $i-525;
print "<option value=\"$j\" selected>$xlatphrase[$i]\n";
for $i (527 .. 537) {
$j=$i-525;
print "<option value=\"$j\">$xlatphrase[$i]\n";
}
print "</select><select name=\"dyfm\">\n";
$i=1; print "<option value=\"$i\" selected>$i\n";
for $i (2 .. 31) {
print "<option value=\"$i\">$i\n";
}
print "</select><select name=\"yrfm\">\n";
$i = 2000; print "<option value=\"$i\" selected>$i\n";
for $i (2001 .. 2099) {
print "<option value=\"$i\">$i\n";
}
print "</select></td>\n<td>";
print "$xlatphrase[433]: <select name=\"moto\">\n";
for $i (526 .. 536) {
$j=$i-525;
print "<option value=\"$j\">$xlatphrase[$i]\n";
}
$i = 537; $j = $i-525;
print "<option value=\"$j\" selected>$xlatphrase[$i]\n";
print "</select><select name=\"dyto\">\n";
for $i (1 .. 30) {
print "<option value=\"$i\">$i\n";
}
$i=31; print "<option value=\"$i\" selected>$i\n";
print "</select><select name=\"yrto\">\n";
for $i (2000 .. 2036) {
print "<option value=\"$i\">$i\n";
}
$i = 2037; print "<option value=\"$i\" selected>$i\n";
print "</select></td></tr>\n";
# Filter by user/canidate
# Code taken from creports003.pl sub show_index_candidates.
# Unfortunately we couldn't use the subroutine directly since
# it writes the entire webpage, not just the section we need.
my @clrecs = &get_client_cnd_list($CLIENT{'clid'});
my @clnamesort=();
my @clidsort=();
my $namesort;
my $idsort;
for (1 .. $#clrecs) {
$clrecs[$_] =~ s/\n//g;
($id, $pwd, $sal, $nmf, $nmm, $nml) = split(/&/, $clrecs[$_]);
unless (($id eq '') || ($nml eq '')) {
$namesort=join('&',$nml,$nmf,$nmm,$id);
#print STDERR "$SESSION{'clid'}, $SESSION{'uid'}, $SESS{'clid'}, $SESS{'uid'}, $id is the super string\n";
$imaregistrar = &get_a_key("cnd.$SESSION{'clid'}", $SESSION{'uid'}, "registrar");
if ($imaregistrar eq 'Y') {
$mycreator = &get_a_key("cnd.$SESSION{'clid'}", $id, "createdby");
if ($SESSION{'uid'} eq $mycreator) {
push @clnamesort, $namesort;
}
} else {
push @clnamesort, $namesort;
}
}
}
@clrecs = &get_client_admin_list($CLIENT{'clid'});
foreach (@clrecs) {
s/\n//g;
($uid) = split(/&/, $_);
unless ($uid eq '') {
$namesort = "Admin User&&&$uid";
push @clnamesort, $namesort unless $imaregistrar eq 'Y';;
}
}
@clrecs = sort @clnamesort;
@clnamesort=();
print "<tr><td>\n";
print "$xlatphrase[279]:<SELECT name=\"cndnamesort\" onChange=\"return nameSelect(this.form)\">\n";
print "<OPTION value=\"0\">&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 "</td>\n<td>ID:<SELECT name=\"cndidsort\" onChange=\"return idSelect(this.form)\">\n";
print "<OPTION value=\"0\">&nbsp;</OPTION>\n";
for (0 .. $#clrecs) {
($id,$nml,$nmf,$nmm) = split(/&/, $clrecs[$_]);
print "<OPTION value=\"$id\">$id - $nml, $nmf $nmm\n";
}
print "</SELECT>\n";
print "</td></tr></table>\n";
print "<input type=\"submit\" value=\"Display\">\n";
} else {
# print the index
opendir(DIR, "$logroot");
@dircon = readdir(DIR);
closedir DIR;
#print STDERR Dumper(\@dircon);
@sdircon = sort {substr($a,5) <=> substr($b,5)} grep(/^sess\./,@dircon);
#print STDERR Dumper(\@sdircon);
my $from = timelocal(0,0,0,$FORM{'dyfm'},$FORM{'mofm'}-1,$FORM{'yrfm'});
my $to = timelocal(0,0,0,$FORM{'dyto'},$FORM{'moto'}-1,$FORM{'yrto'});
foreach $diritem (@sdircon) {
chomp ($diritem);
if ($diritem =~ /sess\.[0-9]/i ) {
@lines = &get_log($diritem);
foreach $line (@lines) {
chomp ($line);
($nm,$vlu)=split(/=/, $line);
$SESS{$nm}=$vlu;
}
if ($FORM{"inc$SESS{'uid'}"}) {
next;
}
my $time = substr($SESS{'tid'}, 0, -4);
if ($time < $from or $time > $to) {
next;
}
if ($FORM{'cndnamesort'} or $FORM{'cndidsort'}) {
if ($SESS{'uid'} ne $FORM{'cndnamesort'} and $SESS{'uid'} ne $FORM{'cndidsort'}) {
next;
}
}
if ($SESS{'clid'} eq $SESSION{'clid'}) {
$tmstr = &format_date_time("yy-mm-dd hh:nn", "1", "-10000", $time);
print "<FONT SIZE=2>$tmstr <A HREF=\"javascript:parmsC001(document.rptform1,\'$SESS{'clid'}.$SESS{'uid'}\',\'$SESS{'tid'}\')\;\">$SESS{'uid'}.$SESS{'clid'}</A></FONT><BR>\n";
}
}
}
}
}
sub candidateNameFromFile {
my ($diritem,$dirid) = @_;
my $cndid;
my $testid;
my $clid;
my $fname;
my @retvals;
my @testinfo;
if ($dirid == 2) {
$fname=join($pathsep,$testcomplete,$diritem);
} elsif ($dirid == 1) {
$fname=join($pathsep,$testinprog,$diritem);
} elsif ($dirid == 0) {
$fname=join($pathsep,$testpending,$diritem);
}
$retvals[0]=0;
$retvals[1]="";
$retvals[2]="";
$retvals[3]="";
#print STDERR "$fname\n";
if (-e $fname and open(TSTFILE, "<$fname")) {
@testinfo = <TSTFILE>;
close TSTFILE;
($clid,$cndid,$testid,$etc) = split(/&/,$testinfo[0]);
#print STDERR "($clid,$cndid,$testid,$etc)\n";
if ((&get_candidate_profile( $clid, $cndid))) {
$retvals[0]=1;
$retvals[1]="$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}";
$retvals[2]=$cndid;
$retvals[3]=$testid;
$retvals[4]=$CANDIDATE{'eml'};
}
}
return @retvals;
}
sub print_report_C_002O {
return;
}
sub print_report_C_002I {
my $dirname;
my $diritem;
my @dircon;
my @sdircon;
my @cndflds;
my @lines;
my @sorted;
my $trec;
my $curtst;
my $dirtitle;
my @testdates;
my $iopt;
my $j;
my $optval;
my $qcor;
my $qinc;
my $tscore;
my $filterok;
print "<TABLE border=0 cellpadding=0 cellspacing=0 width=100\%>\n";
if ($FORM{'cbcomplete'} eq '0') {
$dirname=$testpending;
$dirtitle="Tests Pending";
} elsif ($FORM{'cbcomplete'} eq '1') {
$dirname=$testinprog;
$dirtitle="Tests In Progress";
} else {
$dirname=$testcomplete;
$dirtitle="Completed Tests";
}
opendir(DIR, $dirname);
@dircon = readdir(DIR);
closedir DIR;
@sdircon = sort @dircon;
#print STDERR "print_report_C_002I - ".time."\n";
my @cnds = &get_data("cnd.".$SESSION{'clid'});
shift @cnds;
my %cnds;
foreach (@cnds) {
my @flds = split(/&/,$_);
$cnds{$flds[0]} = "$flds[5], $flds[3], $flds[4]";
}
#print STDERR Dumper(\%cnds);
$registrarkey = &get_a_key("cnd.$SESSION{'clid'}", $SESSION{'uid'}, "registrar");
foreach $diritem (@sdircon) {
if ($diritem =~ /\.(tim|history)$/) {next;}
$filterok=0;
chomp ($diritem);
@registrarchk = split(/\./, $diritem);
$percnd_creator = &get_a_key("cnd.$SESSION{'clid'}", $registrarchk[1], "createdby");
if ($registrarkey eq 'Y') {
next unless $SESSION{'uid'} eq $percnd_creator;
}
@cndflds = (0,'','','');
if ($diritem =~ /$SESSION{'clid'}\.([\-\w]+\.[\-\w]+\.[\-\w]+\.[\-\w]+)\.([\-\w]+)/i ) {
($cndflds[2],$cndflds[3]) = ($1,$2);
$filterok=1;
} elsif ($diritem =~ /$SESSION{'clid'}\.([\-\w]+\.[\-\w]+\.[\-\w]+)\.([\-\w]+)/i ) {
($cndflds[2],$cndflds[3]) = ($1,$2);
$filterok=1;
} elsif ($diritem =~ /$SESSION{'clid'}\.([\-\w+\.\-\w]+)\.([\-\w]+)/i ) {
($cndflds[2],$cndflds[3]) = ($1,$2);
$filterok=1;
} elsif ($diritem =~ /$SESSION{'clid'}\.([\-\w]+)\.([\-\w]+)/i ) {
($cndflds[2],$cndflds[3]) = ($1,$2);
$filterok=1;
}
if ($filterok == 1) {
#@cndflds=&candidateNameFromFile($diritem,$FORM{'cbcomplete'});
#$filterok=($cndflds[0] != 0) ? 1 : 0;
if (exists $cnds{$cndflds[2]}) {
$filterok=1;
$cndflds[1] = $cnds{$cndflds[2]};
$cndflds[0] = 1;
} else {
$filterok=0;
}
}
if ($filterok == 1 && $FORM{'groupfilter'} ne '') {
my @grpcnds = &get_group_cnds($SESSION{'clid'}, $FORM{'groupfilter'});
$grpcnds = join(':', @grpcnds);
@grpcnds = ();
$grpcnds = ":$grpcnds:";
}
if ($filterok == 1) {
if ($FORM{'testfilter'} ne '') {
$filterok=($cndflds[3] eq $FORM{'testfilter'}) ? 1 : 0;
}
if ($filterok == 1) {
if ($FORM{'userfilter'} ne '') {
$filterok=($cndflds[2] eq $FORM{'userfilter'}) ? 1 : 0;
}
}
if ($filterok == 1) {
if ($FORM{'groupfilter'} ne '') {
$filterok=($grpcnds =~ /:$cndflds[2]:/i) ? 1 : 0;
}
}
if ($filterok == 1) {
if ($FORM{'emailmask'} ne '') {
$filterok=($cndflds[4] =~ /$FORM{'emailmask'}/i) ? 1 : 0;
}
}
if ($filterok == 1) {
if (($FORM{'yearfilter'} ne '') || ($FORM{'monthfilter'} ne '') || ($FORM{'dayfilter'} ne '')) {
$filterok=1;
}
}
}
if ($filterok == 1) {
if ($FORM{'cbsort'} eq '0') {
$trec = join('&',$cndflds[3],$cndflds[1],$diritem,$cndflds[2]);
push @lines, $trec;
} elsif ($FORM{'cbsort'} eq '1') {
$trec = join('&',$cndflds[1],$cndflds[3],$diritem,$cndflds[2]);
push @lines, $trec;
} else {
if ($FORM{'cbcomplete'} eq '2') {
#print "<!-- getHistoricTests $testcomplete,$CLIENT{'clid'},$cndflds[3],$cndflds[2] -->\n";
@testdates = getHistoricTests($testcomplete,$CLIENT{'clid'},$cndflds[3],$cndflds[2]);
for $iopt (0 .. $#testdates) {
$j=$#testdates-$iopt;
($optval,$qcor,$qinc,$tscore) = split(/&/, $testdates[$j]);
$optdesc = $optval;
$optval =~ s/ /_/g;
$optdesc =~ s/ GMT//g;
$trec = join('&',$cndflds[3],$cndflds[1],$diritem,$cndflds[2],$optdesc);
push @lines, $trec;
#print "<!-- $trec -->\n";
}
@testdates = ();
} else {
$trec = join('&',$cndflds[1],$cndflds[3],$diritem,$cndflds[2]);
push @lines, $trec;
}
}
}
}
#print STDERR " - ".time."\n";
@sorted = sort @lines;
@lines = ();
print "<TR><TD align=center><B>$dirtitle</B></td></tr>\n";
if ($FORM{'cbsort'} eq '1') {
print "<TR>\n";
print "<TD>User Name</TD>\n";
print "<TD align=left><FONT SIZE=2>Test/Survey ID</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>Date</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>User ID</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>File Name</FONT></TD>\n";
print "</TR>\n";
} else {
print "<TR>\n";
print "<TD>Test/Survey ID</TD>\n";
print "<TD align=left><FONT SIZE=2>User Name</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>Date</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>User ID</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>File Name</FONT></TD>\n";
print "</TR>\n";
}
my $curtst = "";
for $i (0 .. $#sorted) {
@cndflds = split(/&/,$sorted[$i]);
if ($curtst ne $cndflds[0]) {
print "<TR><TD>$cndflds[0]</TD></TR>\n";
$curtst=$cndflds[0];
}
print "<TR>\n";
print "<TD>\&nbsp;</TD>\n";
print "<TD align=left><FONT SIZE=2><A HREF=\"javascript:parmsC002(document.rptform1,\'$cndflds[2]\',\'$FORM{'cbcomplete'}\')\;\">$cndflds[1]</A></FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>$cndflds[4]</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>$cndflds[3]</FONT></TD>\n";
print "<TD align=left><FONT SIZE=2>$cndflds[2]</FONT></TD>\n";
print "</TR>\n";
}
print "</TABLE>\n";
#print STDERR " - ".time."\n";
}
sub print_report_C_003 {
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'} );
if( $CANDIDATE{'grpowner'} eq 'Y' ) {
$isGroupOwner = 1;
} else {
$isGroupOwner = 0;
}
if( $isGroupOwner ) {
@ownerGroups = &get_gradebooks_list( $SESSION{'clid'}, $SESSION{'uid'} );
foreach $group ( @ownerGroups ) {
chop( $group ); # Remove newline character
@fields = split( /&/, $group ); # Separate into fields
$groupId = $fields[1];
push( @groups, $groupId );
$groupNames{$groupId} = $fields[2];
foreach $candidate ( split( /,/, $fields[3] ) ) {
$tempName = join( ':', $groupId, $candidate );
$groupCand{$tempName} = 1;
}
}
}
@cndrecs = &get_data("cnd.$SESSION{'clid'}");
$flds = shift @cndrecs;
chop ($flds);
@flds = split(/&/, $flds);
$nflds = $#flds;
@myunalphaidx=();
foreach $cndrec (@cndrecs) {
chop ($cndrec);
@fldvals = split(/&/, $cndrec);
for (0 .. $nflds) { $RECFLD{$flds[$_]} = $fldvals[$_];}
$idxline = $RECFLD{'nml'};
# v sac report alpha indexing
$myalpha=uc(substr($idxline,0,1));
unless ( $myalphaindex =~ /.$myalpha/) {
$myalphaindex=join('',$myalphaindex,$myalpha);
push @myunalphaidx, $myalpha;
}
# ^ sac report alpha indexing
$idxline = join('', $idxline, ", ", $RECFLD{'nmf'}, " ", $RECFLD{'nmm'});
$idxline = join('', $idxline, ", ", $RECFLD{'sal'});
$idxline = join('&', $idxline, $RECFLD{'uid'});
if( $isGroupOwner ) {
$cntr = 0;
foreach $group ( @groups ) {
$tempName = join( ':', $group, $RECFLD{'uid'} );
if( defined( $groupCand{$tempName} ) ) {
$idxline2 = join( '&', $group, $idxline );
push( @cndlist, $idxline2 );
}
}
} else {
push( @cndlist, $idxline );
}
} #end foreach
# v sac report alpha indexing
@myalphaidx=sort @myunalphaidx;
@myunalphaidx=();
$myalphaindex="";
foreach $myalpha (@myalphaidx) {
$myalphaindex=join(' ',$myalphaindex,"<a href=\"\#alpha$myalpha\">$myalpha</a>");
}
$myalpha="";
# ^ sac report alpha indexing
print "<CENTER><B>Test/Survey Results by Candidate</B><br>\n";
print "$finputs";
print "<TABLE cellpadding=1 cellspacing=1 border=0 width=\"100\%\">\n";
print "<tr>\n";
print "\t<td colspan=5><HR WIDTH=\"100\%\"></td>\n";
print "</tr>\n";
print "<TR>\n";
print "\t<TD valign=top><B><FONT SIZE=2>Candidate Name</FONT></B></TD>\n";
print "\t<TD valign=top><B><FONT SIZE=2>ID</FONT></B></TD>\n";
print "\t<TD align=right valign=top><B><FONT SIZE=2>Cmp</FONT></B></TD>\n";
print "\t<TD align=right valign=top><B><FONT SIZE=2>InP</FONT></B></TD>\n";
print "\t<TD align=right valign=top><B><FONT SIZE=2>Pnd</FONT></B></TD>\n";
print "</TR>\n";
if( !$isGroupOwner )
{
print "<TR>\n";
print "\t<TD colspan=5><HR WIDTH=\"100\%\"></TD>\n";
print "</TR>\n";
}
@sortedlist = sort {uc($a) cmp uc($b)} @cndlist;
@cndlist = ();
@cndrecs = ();
foreach $cndrec (@sortedlist) {
if( $isGroupOwner ) {
($groupId, $href, $id) = split(/&/, $cndrec);
} else {
($href, $id) = split(/&/, $cndrec);
}
# v sac report alpha indexing
unless (uc(substr($href,0,1)) eq $myalpha ) {
if ($#myalphaidx != -1) {
$myalpha=shift @myalphaidx;
print "<tr><td colspan=5>";
print "<a name=\"alpha$myalpha\">Index:</a>$myalphaindex";
print "</td></tr>";
}
}
# ^ sac report alpha indexing
$testscompleted = CountCndTests($testcomplete, $CLIENT{'clid'},$id);
$testscompleted = CountCndFiles($testcomplete, $CLIENT{'clid'},$id);
$testsinprogress = CountCndFiles($testinprog, $CLIENT{'clid'},$id);
$testspending = CountCndFiles($testpending, $CLIENT{'clid'},$id);
if( ( $isGroupOwner ) && ( $groupId ne $prevGroup ) ) {
$groupName = $groupNames{$groupId};
print "<TR>\n";
print "\t<TD colspan=5><HR WIDTH=\"100\%\"><font size=2><b>Course ID:</b> $groupId<br><b>Course Name:</b>$groupName</font></TD>\n";
print "</TR>\n";
}
print "<TR>\n";
print "\t<TD valign=top><FONT SIZE=2><A HREF=\"javascript:parmsC003(document.rptform1,\'$id\')\;\">$href</A></FONT></td>\n";
print "\t<TD valign=top><FONT SIZE=2>$id</FONT></TD>\n";
print "\t<TD align=right valign=top><FONT SIZE=2>$testscompleted</FONT></TD>\n";
print "\t<TD align=right valign=top><FONT SIZE=2>$testsinprogress</FONT></TD>\n";
print "\t<TD align=right valign=top><FONT SIZE=2>$testspending</FONT></TD>\n";
print "</TR>\n";
$prevGroup = $groupId;
}
@sortedlist = ();
print "</table>\n\n";
}
sub print_report_C_004 {
@trecs = &get_test_list($CLIENT{'clid'}); #tests in an array
@tmptrecs = ();
for (1 .. $#trecs) {
($id, $desc) = split(/&/, $trecs[$_]); #id=testid, descr=test description
$trecs[$_] = join('&', "$desc", "$id"); #reverses the order for some reason
push @tmptrecs, $trecs[$_];
}
@trecs = sort @tmptrecs;
for (0 .. $#trecs) {
($desc,$id) = split(/&/, $trecs[$_]);
$testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id);
$testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id);
$testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id);
$href="javascript:parmsC004(document.rptform1,\'$id\')\;";
$tstoption =" <TR>
<TD valign=top><FONT SIZE=2><a href=\"$href\">$id</a></FONT></TD>
<TD valign=top><FONT SIZE=2>$desc</FONT></TD>
<TD align=right valign=top><FONT SIZE=2>$testscompleted</FONT></TD>
<TD align=right valign=top><FONT SIZE=2>$testsinprogress</FONT></TD>
<TD align=right valign=top><FONT SIZE=2>$testspending</FONT></TD>
</TR>\n";
$tstoptions = join('', $tstoptions, $tstoption);
}
print "<CENTER><B>$xlatphrase[919] $xlatphrase[800] $xlatphrase[923]</B><br>
$finputs
<TABLE cellpadding=1 cellspacing=1 border=0 width=\"100\%\">
<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
<TR>
<TD valign=top><B><FONT SIZE=1>Test ID</FONT></B></TD>
<TD valign=top><B><FONT SIZE=1>Description</FONT></B></TD>
<TD align=right valign=top><B><FONT SIZE=1>Cmp</FONT></B></TD>
<TD align=right valign=top><B><FONT SIZE=1>InP</FONT></B></TD>
<TD align=right valign=top><B><FONT SIZE=1>Pnd</FONT></B></TD>
</TR>
<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
$tstoptions
<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
</TABLE>
";
}
sub print_report_C_007 {
@trecs = &get_test_list($CLIENT{'clid'});
@tmptrecs = ();
for (1 .. $#trecs) {
($id, $desc) = split(/&/, $trecs[$_]);
$trecs[$_] = join('&', "$desc", "$id");
push @tmptrecs, $trecs[$_];
}
@trecs = sort @tmptrecs;
for (0 .. $#trecs) {
($desc,$id) = split(/&/, $trecs[$_]);
$testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id);
$testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id);
$testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id);
$href="javascript:parmsC004(document.rptform1,\'$id\')\;";
$tstoption =" <TR>
<TD valign=top><FONT SIZE=2><a href=\"$href\">$id</a></FONT></TD>
<TD valign=top><FONT SIZE=2>$desc</FONT></TD>
<TD align=right valign=top><FONT SIZE=2>$testscompleted</FONT></TD>
<TD align=right valign=top><FONT SIZE=2>$testsinprogress</FONT></TD>
<TD align=right valign=top><FONT SIZE=2>$testspending</FONT></TD>
</TR>\n";
$tstoptions = join('', $tstoptions, $tstoption);
}
print "<CENTER><B>Test Question Timing Statistics</B><br>
$finputs
<TABLE cellpadding=1 cellspacing=1 border=0 width=\"100\%\">
<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
<TR>
<TD valign=top><B><FONT SIZE=1>Test ID</FONT></B></TD>
<TD valign=top><B><FONT SIZE=1>Description</FONT></B></TD>
<TD align=right valign=top><B><FONT SIZE=1>Cmp</FONT></B></TD>
<TD align=right valign=top><B><FONT SIZE=1>InP</FONT></B></TD>
<TD align=right valign=top><B><FONT SIZE=1>Pnd</FONT></B></TD>
</TR>
<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
$tstoptions
<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
</TABLE>
";
}
sub show_index {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}");
&get_client_profile($SESSION{'clid'});
&print_report_header();
if ($REPORT{'rptid'} eq 'ACT-C-001') {
&print_report_C_001();
} elsif ($REPORT{'rptid'} eq 'ACT-C-002') {
if ($FORM{'frm'} eq '5') {
&print_report_C_002O();
} else {
&print_report_C_002I();
}
} elsif ($REPORT{'rptid'} eq 'ACT-C-003') {
&print_report_C_003();
} elsif ($REPORT{'rptid'} eq 'ACT-C-004') {
&print_report_C_004();
} elsif ($REPORT{'rptid'} eq 'ACT-C-007') {
&print_report_C_007();
} else {
print "<CENTER>\n";
print "Nothing Selected or Report $FORM{rptno} is not yet available.\n";
print "Please select a report to view from the list.\n";
print "</CENTER>\n";
}
&print_report_footer();
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "3", "Exec Report $FORM{'rptno'} completed");
}
# ACT-C-001&Login Activity Report
# ACT-C-005&Login Activity by User
# ACT-C-002&Test Activity Report
# ACT-C-003&Test Reports by Candidate
# ACT-C-004&Test Statistics by Test
# ACT-C-006&Test Report by User
sub show_detail {
my $sTitle;
if ($REPORT{'rptid'} eq 'ACT-C-001') {
$sTitle="$REPORT{'rptid'} - Log File $FORM{'dbfile'}";
&print_detail_header($sTitle);
&print_detail_C_001();
} elsif ($REPORT{'rptid'} eq 'ACT-C-002') {
$sTitle="$REPORT{'rptid'} - Test File $FORM{'dbfile'}";
&print_detail_header($sTitle);
&print_detail_C_002();
} elsif ($REPORT{'rptid'} eq 'ACT-C-003') {
$sTitle="$REPORT{'rptid'} - Test Results Summary";
&print_detail_header($sTitle);
&print_detail_C_003();
} elsif ($REPORT{'rptid'} eq 'ACT-C-006') {
$sTitle="$REPORT{'rptid'} - Test Results Summary";
&print_detail_header($sTitle);
&print_detail_C_006();
} else {
$sTitle="$REPORT{'rptid'}";
&print_detail_header($sTitle);
print "Please Select a Report to View from the frame to the left.<BR>\n";
}
&print_report_footer();
}
sub print_detail_header {
my ($sTitle) = @_;
print "<HTML>
<HEAD>
<TITLE>$sTitle</TITLE>
<SCRIPT language=\"JavaScript\">
<!--
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'}\">
\n";
}
sub print_detail_C_001 {
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Log Report $FORM{'dbfile'}");
print "<H4>$REPORT{'rptid'} - $REPORT{'rptdesc'}</H4><BR>\n";
if ($FORM{'filter'}!='') {
print "<B>Session $FORM{'filter'}</B><BR>\n";
@lines = &get_log("sess.$FORM{'filter'}");
foreach $line (@lines) {
chomp ($line);
print "$line<BR>\n";
}
print "<HR WIDTH=\"100\%\">\n";
}
@lines = &get_log($FORM{'dbfile'});
foreach $line (@lines) {
chomp ($line);
if ($FORM{'filter'}!='') {
if ($line =~ /,$FORM{'filter'},/ ) {
print "$line<BR>\n";
}
} else {
print "$line<BR>\n";
}
}
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Log Report $FORM{'dbfile'} completed");
}
sub print_detail_C_002 {
$msg = "";
@locations = ( $testpending, $testinprog, $testcomplete);
$trash = join($pathsep, $locations[$FORM{'location'}], $FORM{'dbfile'});
open (TESTFILE, "<$trash") or $msg="failed";
if ($msg eq 'failed') {
print "Unable to open file.";
} else {
@lines = <TESTFILE>;
close TESTFILE;
if ($trash =~ /$testinprog/ ) {
print "<A HREF=\"\#terminate\">TERMINATE THIS TEST</A><BR>\n";
}
foreach $line (@lines) {
chomp ($line);
print "$line<BR>\n";
}
if ($trash =~ /$testinprog/ ) {
print "<FORM METHOD=POST ACTION=\"$cgiroot/testterm.pl\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"tid\" VALUE=\"$SESSION{'tid'}\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"dbfile\" VALUE=\"$FORM{'dbfile'}\">\n";
print "<A NAME=\"terminate\">Reason for Terminating The Test:</A><BR>\n";
print "<TEXTAREA NAME=\"reason\" ROWS=\"4\" COLS=\"40\"></TEXTAREA><BR>\n";
print "<INPUT TYPE=SUBMIT VALUE=\"Terminate Test\">\n";
print "</FORM>\n";
}
}
}
sub print_detail_C_003 {
&get_client_profile($SESSION{'clid'});
my @testList = &GetTestsByOwner( $CLIENT{'clid'}, $SESSION{'uid' } );
my @testFields = &GetTestHeader( $CLIENT{'clid'} );
my $searchStr = "";
my $currHash;
my @found=();
&get_candidate_profile( $SESSION{'clid'}, $SESSION{'uid'} );
if( $CANDIDATE{'grpowner'} eq 'Y' )
{
foreach $test ( @testList )
{
#print "$test<p>\n";
chop( $test );
@currField = split( '&', $test );
for( 0 .. $#testFields )
{
$currHash{$testFields[$_]} = $currField[$_];
}
$searchStr = "$searchStr|$currHash{'id'}";
}
$searchStr = substr( $searchStr, 1 );
}
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
print "<CENTER><B>Test Results Summary</B><BR>\n";
print "<TABLE cellpadding=\"0\" cellspacing=\"0\" border=0 width=\"100%\">\n";
print "<TR>\n";
print "<TD>\n";
print "$CANDIDATE{'sal'} $CANDIDATE{'nmf'} $CANDIDATE{'nmm'} $CANDIDATE{'nml'}<BR>\n";
print "$CANDIDATE{'adr'}<BR>\n";
print "$CANDIDATE{'cty'}, $CANDIDATE{'ste'} $CANDIDATE{'pst'}<BR>\n";
print "$CANDIDATE{'ctry'}<BR>\n";
print "<\TD>\n";
print "<TD>\n";
print "$CANDIDATE{'eml'}<BR>\n";
print "$CANDIDATE{'cnd1'}<BR>\n";
print "$CANDIDATE{'cnd2'}<BR>\n";
print "$CANDIDATE{'cnd3'}<BR>\n";
print "$CANDIDATE{'cnd4'}<BR>\n";
print "<\TD>\n";
print "<\TR>\n";
print "</TABLE>\n";
print "<TABLE cellpadding=\"3\" cellspacing=\"2\" border=0 width = 100\%>\n";
print "<TR>\n";
print "<TD colspan=7><HR WIDTH=\"100%\"></TD>\n";
print "<\TR>\n";
print "<TR>\n";
print "<TD><B>Date</B></TD>\n";
print "<TD><B>Status</B></TD>\n";
print "<TD><B>Time Stats</B></TD>\n";
print "<TD><B>Test Description</B></TD>\n";
print "<TD align=center NOWRAP><B>$xlatphrase[137]</B></TD>\n";
print "<TD align=center NOWRAP><B>Incorrect</B></TD>\n";
print "<TD align=center NOWRAP><B>Score</B></TD>\n";
print "<\TR>\n";
print "<TR>\n";
print "<TD colspan=7><HR WIDTH=\"100%\"></TD>\n";
print "<\TR>\n";
@tstoptions = ();
opendir (GDIR, $testinprog);
@rdots = readdir(GDIR);
closedir GDIR;
#ADT v limit groupowner viewing of testids, copied code section from 106
$replaceStr = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.";
$myRmMask = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.($searchStr)";
$rrmmask = $myRmMask;
@found = grep(/^$rrmmask/i, @rdots);
@rdots = sort @found;
@found=();
foreach $rmfile (@rdots) {
if ($rmfile =~ /$rrmmask/i ) {
#print "<font color=\"#ff0000\">$rmfile - $rrmmask</font><br>\n";
$trash = join($pathsep, $testinprog, $rmfile);
open (TMPFILE, "<$trash");
$mtime = (stat(TMPFILE))[9];
close TMPFILE;
$completedat = &format_date_time("yyyy-mm-dd hh:nn", "2", "-10000", $mtime);
$tstid = $rmfile;
$tstid =~ s/$replaceStr//g;
#ADT ^
#$trash = join($pathsep, $testcomplete, "$CLIENT{'clid'}.$CANDIDATE{'uid'}.$tstid.tim");
#$timestats = "<a href=\"$cgiroot/creports007.pl?tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=$CANDIDATE{'uid'}&tstid=$tstid&frm=4\" TARGET=\"testreport\">Times</a>";
#open (TMPFILE, "<$trash") or $timestats="";
#close TMPFILE;
&get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $tstid, $testinprog);
$state = $TEST_SESSION{'state'};
($tstate, $tseq, $tqst) = split(/\./, $state);
&get_test_profile($CLIENT{'clid'}, $TEST{'id'});
$tstoption = "<TR>
<TD valign=top NOWRAP>$completedat</TD>
<TD valign=top>$TEST_STATE_DESCRIPTION{$tstate}<BR>Segment:$TEST_SEGMENT_DESCRIPTION{$tseq}<BR>Question:$tqst</TD>
<TD valign=top NOWRAP>$timestats</TD>
<TD valign=top NOWRAP>$TEST{'desc'}</TD>
<TD valign=top align=center></TD>
<TD valign=top align=center></TD>
<TD valign=top align=center></TD>
<\TR>\n";
push @tstoptions, $tstoption;
}
}
opendir (GDIR, $testpending);
@rdots = readdir(GDIR);
closedir GDIR;
#ADT v groupowner filter
#$rrmmask = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.";
$replaceStr = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.";
$rrmmask = $myRmMask;
@found = grep(/^$rrmmask/i, @rdots);
@rdots = sort @found;
@found=();
foreach $rmfile (@rdots) {
if ($rmfile =~ /$rrmmask/i ) {
#print "<font color=\"#ff0000\">$rmfile - $rrmmask</font><br>\n";
$trash = join($pathsep, $testpending, $rmfile);
#print "$trash<p>\n";
open (TMPFILE, "<$trash");
$mtime = (stat(TMPFILE))[9];
close TMPFILE;
$completedat = &format_date_time("yyyy-mm-dd hh:nn", "2", "-10000", $mtime);
$tstid = $rmfile;
$tstid =~ s/$replaceStr//g;
#ADT ^
#wac merge ^ (selected lines, since rrmfile wasn't part of original code)
&get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $tstid, $testpending);
&get_test_profile($CLIENT{'clid'}, $TEST{'id'});
$tstoption = "<TR>
<TD valign=top NOWRAP>$completedat</TD>
<TD valign=top>$TEST_STATE_DESCRIPTION{0}</TD>
<TD valign=top NOWRAP></TD>
<TD valign=top NOWRAP>$TEST{'desc'}</TD>
<TD colspan=3 valign=top align=left>
Print\&nbsp\;
<A HREF=\"$cgiroot/tmaster.pl?tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=$CANDIDATE{'uid'}&tstid=$TEST{'id'}\" TARGET=\"prtwindow\">Master/Key</A>
</TD>
<\TR>\n";
push @tstoptions, $tstoption;
}
}
opendir (GDIR, $testcomplete);
@rdots = readdir(GDIR);
closedir GDIR;
#ADT v groupowner filter
#$rrmmask = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.";
$replaceStr = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.";
$rrmmask = $myRmMask;
@found = grep(/^$rrmmask/i, @rdots);
@rdots = sort @found;
@found=();
foreach $rmfile (@rdots) {
if ($rmfile =~ /$rrmmask/i ) {
#print "<font color=\"#ff0000\">$rmfile - $rrmmask</font><br>\n";
$trash = join($pathsep, $testcomplete, $rmfile);
open (TMPFILE, "<$trash");
$mtime = (stat(TMPFILE))[9];
close TMPFILE;
$completedat = &format_date_time("yyyy-mm-dd hh:nn", "2", "-10000", $mtime);
$tstid = $rmfile;
#####
@mysegs=split(/\./, $rmfile);
$mysegcnt = $#mysegs;
@myclidsegs=split(/\./, $CLIENT{'clid'});
$myclidsegcnt=$#myclidsegs+1;
@myclidsegs=();
$myclid=$mysegs[0];
$mytstid=$mysegs[$mysegcnt];
$mysegcnt--;
$mycndid="";
$mysegjoint="";
for ($myclidsegcnt .. $mysegcnt) {
$mycndid=join($mysegjoint,$mycndid,$mysegs[$_]);
$mysegjoint=".";
}
$CANDIDATE{'uid'}=$mycndid;
$tstid=$mytstid;
#ADT ^
#$trash = join($pathsep, $testcomplete, "$CLIENT{'clid'}.$CANDIDATE{'uid'}.$tstid.tim");
#$timestats = "<a href=\"$cgiroot/creports007.pl?tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=$CANDIDATE{'uid'}&tstid=$tstid&frm=4\" TARGET=\"testreport\">Times</a>";
#open (TMPFILE, "<$trash") or $timestats="";
#close TMPFILE;
#wac ^ merge selected lines.
&get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $tstid, $testcomplete);
($correctans, $incorrectans, $score, $trash) = split(/&/, $SUBTEST_SUMMARY{2});
$state = $TEST_SESSION{'state'};
($tstate, $tseq, $tqst) = split(/\./, $state);
&get_test_profile($CLIENT{'clid'}, $TEST{'id'});
$tstoption = "<TR>
<TD valign=top NOWRAP>$completedat</TD>
<TD valign=top>$TEST_STATE_DESCRIPTION{$tstate}</TD>
<TD valign=top NOWRAP>$timestats</TD>
<TD valign=top NOWRAP><a href=\"$cgiroot/testreport.pl?tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=$CANDIDATE{'uid'}&tstid=$tstid\" TARGET=\"testreport\">$TEST{'desc'}</a></TD>
<TD valign=top align=center>$correctans</TD>
<TD valign=top align=center>$incorrectans</TD>
<TD valign=top align=center>$score\%</TD>
<\TR>\n";
push @tstoptions, $tstoption;
}
}
@sorted = sort @tstoptions;
@tstoptions = ();
for (0 .. $#sorted) {
print $sorted[$_];
}
@sorted = ();
print "</TABLE>\n";
}
sub print_detail_C_006 {
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
print "<CENTER><B>Test Results Summary</B><BR>\n";
print "<TABLE cellpadding=\"0\" cellspacing=\"0\" border=0 width=\"100%\">\n";
print "<TR>\n";
print "<TD>\n";
print "$CANDIDATE{'sal'} $CANDIDATE{'nmf'} $CANDIDATE{'nmm'} $CANDIDATE{'nml'}<BR>\n";
print "$CANDIDATE{'adr'}<BR>\n";
print "$CANDIDATE{'cty'}, $CANDIDATE{'ste'} $CANDIDATE{'pst'}<BR>\n";
print "$CANDIDATE{'ctry'}<BR>\n";
print "<\TD>\n";
print "<TD>\n";
print "$CANDIDATE{'eml'}<BR>\n";
print "$CANDIDATE{'cnd1'}<BR>\n";
print "$CANDIDATE{'cnd2'}<BR>\n";
print "$CANDIDATE{'cnd3'}<BR>\n";
print "$CANDIDATE{'cnd4'}<BR>\n";
print "<\TD>\n";
print "<\TR>\n";
print "</TABLE>\n";
print "<TABLE cellpadding=\"3\" cellspacing=\"2\" border=0 width = 100\%>\n";
print "<TR>\n";
print "<TD colspan=6><HR WIDTH=\"100%\"></TD>\n";
print "<\TR>\n";
print "<TR>\n";
print "<TD><B>Date</B></TD>\n";
print "<TD><B>Status Information</B></TD>\n";
print "<TD><B>Test Description</B></TD>\n";
print "<TD align=center NOWRAP><B>$xlatphrase[137]</B></TD>\n";
print "<TD align=center NOWRAP><B>Incorrect</B></TD>\n";
print "<TD align=center NOWRAP><B>Score</B></TD>\n";
print "<\TR>\n";
print "<TR>\n";
print "<TD colspan=6><HR WIDTH=\"100%\"></TD>\n";
print "<\TR>\n";
@tstoptions = ();
opendir (GDIR, $testcomplete);
@rdots = readdir(GDIR);
closedir GDIR;
$rrmmask = "$CLIENT{'clid'}.$CANDIDATE{'uid'}.";
foreach $rrmfile (@rdots) {
if ($rrmfile =~ /$rrmmask/ ) {
$trash = join($pathsep, $testcomplete, $rrmfile);
open (TMPFILE, "<$trash");
$mtime = (stat(TMPFILE))[9];
close TMPFILE;
$completedat = &format_date_time("yyyy-mm-dd hh:nn", "2", "-10000", $mtime);
$tstid = $rrmfile;
$tstid =~ s/$rrmmask//g;
&get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $tstid, $testcomplete);
($correctans, $incorrectans, $score, $trash) = split(/&/, $SUBTEST_SUMMARY{2});
$state = $TEST_SESSION{'state'};
($tstate, $tseq, $tqst) = split(/\./, $state);
&get_test_profile($CLIENT{'clid'}, $TEST{'id'});
$tstoption = "<TR>
<TD valign=top NOWRAP>$completedat</TD>
<TD valign=top>$TEST_STATE_DESCRIPTION{$tstate}</TD>
<TD valign=top NOWRAP><a href=\"$cgiroot/testreport.pl?tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=$CANDIDATE{'uid'}&tstid=$tstid\" TARGET=\"rptdetail\">$TEST{'desc'}</a></TD>
<TD valign=top align=center>$correctans</TD>
<TD valign=top align=center>$incorrectans</TD>
<TD valign=top align=center>$score\%</TD>
<\TR>\n";
push @tstoptions, $tstoption;
}
}
@sorted = sort @tstoptions;
@tstoptions = ();
for (0 .. $#sorted) {
print $sorted[$_];
}
@sorted = ();
print "</TABLE>\n";
}
################################################################################
#
# 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;
}