#!/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 "\n"; print "\n"; print " \n"; print "\n"; } } } } } sub show_index_candidates { &log_entry($SESSION{'clid'}, $SESSION{'uid'}, "2", "Exec Report $FORM{'rptno'}"); &get_client_profile($SESSION{'clid'}); print " $REPORT{'rptid'} - $REPORT{'rptdesc'}
$REPORT{'rptid'} - $REPORT{'rptdesc'}
"; 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:\n"; @clrecs = sort @clidsort; @clidsort=(); print "\ ID:\n"; @clrecs=(); print "
"; } 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 " $REPORT{'rptid'} - $REPORT{'rptdesc'}
$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}
"; 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
$xlatphrase[721]
"; &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 = "\n"); $styles = "SELECT {\"font-size: 8pt;\"}\n"; $styles = join('',$styles,"INPUT {\"font-size: 8pt;height: 20px;\"}\n"); print " $REPORT{'rptid'} - $REPORT{'rptdesc'}
$xlatphrase[686]
$testdescriptions
"; if ($TEST{'seq'} eq 'std') { print " "; $colspan="colspan=2"; } else { print " "; $colspan=""; } print "
$xlatphrase[687]
$lstdates
$xlatphrase[688]
$xlatphrase[163]
$xlatphrase[361]
$xlatphrase[691]
$xlatphrase[690]
$xlatphrase[689]
$xlatphrase[137]
$xlatphrase[692]
$xlatphrase[361]
$xlatphrase[693]
$xlatphrase[687]
$lstdates
"; $testspending = CountTestFilesByCnd($testpending, $CLIENT{'clid'},$id,$FORM{'cndid'}); if ($testspending > 0) { print " Print\ \; Master/Key"; } print "\ 
\ $xlatphrase[708]


"; } 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 " $REPORT{'rptid'} - $REPORT{'rptdesc'}
$CLIENT{'logo'} $xlatphrase[710]
$cndid - $cndname
$testtitle

\ \;
$xlatphrase[713] "; if ($FORM{'cbtim'} ne '') { print "\t\t$xlatphrase[714]\n"; } print "\t\t
"; $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 "\n"; } if ($FORM{'cbinc'} ne '') { print "\n"; } if ($FORM{'cbscore'} ne '') { print "\n"; } if ($FORM{'cbpf'} ne '') { print "\n"; } if ($FORM{'cbtim'} ne '') { print "\n"; } } else { print "\n"; print "\n"; print "\n"; print "\n"; } print "\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 "\n"; print "\n"; if ($FORM{'cbcor'} ne '') { $colspan++; print "\n"; } if ($FORM{'cbinc'} ne '') { $colspan++; print "\n"; } if ($FORM{'cbscore'} ne '') { print "\n"; } if ($FORM{'cbpf'} ne '') { print "\n"; } if ($FORM{'cbtim'} ne '') { print "\n"; } } else { print " "; } print "\n"; } if ($TEST{'seq'} eq 'std') { @tcols = split(/&/,$tentries[$hiidx]); shift @tcols; $tcols[0] =~ tr/+/ /; print "\n"; print "\n"; if ($FORM{'cbscore'} ne '') { print "\n"; } print "\n"; if ($FORM{'cbtim'} ne '') { print "\n"; } print "\n"; @tcols = split(/&/,$tentries[$loidx]); shift @tcols; $tcols[0] =~ tr/+/ /; print "\n"; print "\n"; if ($FORM{'cbscore'} ne '') { print "\n"; } print "\n"; if ($FORM{'cbtim'} ne '') { print "\n"; } print "\n"; $tcols[0] = $xlatphrase[717]; $tcols[3] = int($avgscore / $avgcount); $tcols[4] = ($tcols[2] >= 70) ? "$xlatphrase[718]" : "$xlatphrase[719]"; print "\n"; print "\n"; if ($FORM{'cbscore'} ne '') { print "\n"; } if ($FORM{'cbpf'} ne '') { print "\n"; } if ($FORM{'cbtim'} ne '') { $tcols[5] = int($timetaken / $avgcount); $timfmt = &formatTimeFromSeconds($tcols[5],"h:m:s"); print "\n"; } print "\n"; } @tentries = (); print "
$xlatphrase[711]$xlatphrase[137]$xlatphrase[692]$xlatphrase[361]$xlatphrase[712]$xlatphrase[694]
\($xlatphrase[363]\)
". "$tstdate". "\ $testid\ Only Responses". "\ \ \ \ \ Only Incorrect Responses". "$tcols[1]$tcols[2]$tcols[3] \%$tcols[4]$timfmt
$tstdate". "   CSV Format". " $tcols[1]
$tcols[0]$tcols[3] \%$xlatphrase[715]$tcols[5]
$tcols[0]$tcols[3] \%$xlatphrase[716]$tcols[5]
$tcols[0]$tcols[3] \%$tcols[4]$timfmt
"; &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 "$testList[$testCntr]
\n"; chop( $testList[$testCntr] ); @currField = split( '&', $testList[$testCntr] ); for( 0 .. $#testFields ) { $currHash{$testFields[$_]} = $currField[$_]; } #print "$currHash{'ownedby'} - $ownedBy

"; if( ( $currHash{'ownedby'} eq $ownedBy ) || ( $currHash{'ownedby'} eq "" ) ) { push( @tests, $testList[$testCntr] ); #print "$testList[$testCntr]
\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 = ; 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 = ; 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; }