#!/usr/bin/perl # # Source File: IntegroPassion.pl # Get config use FileHandle; use Time::Local; use Data::Dumper; use IntegroLib; require 'sitecfg.pl'; require 'testlib.pl'; require 'tstatlib.pl'; require 'LikertData.pl'; use strict; use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST %SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS %SYSTEM %REPORT %SUBTEST_RESPONSES @xlatphrase); use vars qw($testcomplete $cgiroot $pathsep $dataroot @rptparams $testpending $testinprog $testcomplete); &app_initialize; $FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI # Make sure we have a valid session, and exit if we don't if (not &get_session($FORM{'tid'})) { exit(0); } &LanguageSupportInit(); #print STDERR Dumper(\%SESSION); &get_client_profile($SESSION{'clid'}); # Populate $CLIENT{} if ($FORM{'tstid'}) { &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); # Populate $TEST{} } elsif (!$rptparams[0]) { # Check for multiple tests my @trecs = &get_test_list($CLIENT{'clid'}); #tests in an array my @tmptrecs = (); for (1 .. $#trecs) { my ($id, $desc) = split(/&/, $trecs[$_]); #id=testid, descr=test description if ($id =~ "^passion") {push @tmptrecs, join('&', "$desc", "$id");} } @trecs = sort @tmptrecs; if ($#trecs > 0) { # show test chooser &print_test_chooser(@trecs); } } # Get the group filters, if any my ($idlist,$groups); if (exists $FORM{'grouping'} and $FORM{'grouping'} eq 'subset') { #my @tmp = split(/,/,$FORM{'idlist'}); my @tmp = param('idlist'); $FORM{'idlist'} = join(',', @tmp); @{$groups}{@tmp} = @tmp; $idlist = &getIdlist($CLIENT{'clid'},$FORM{'idlist'}); } # $idlist is a reference to an un-named hash. # The keys are candidate ids in the selected groups. # Get the time stamp style my $timestamp; if ($FORM{'timestamp'} eq 'currenttime') { $timestamp = scalar(localtime(time)); } elsif ($FORM{"timestamp"} eq 'custom' and $FORM{'customtime'} ne '') { $timestamp = $FORM{'customtime'}; } elsif ($FORM{'timestamp'} eq 'mostrecent' and $FORM{'tstid'}) { my $file = join($pathsep,$testcomplete,"$CLIENT{'clid'}.$FORM{'tstid'}.history"); my $fh = new FileHandle; if ($fh->open($file)) { my @history = map([split(/(?:<<>>|&)/,$_,4)],<$fh>); #print "
".Dumper(\@history)."
"; if (defined $idlist) { foreach (reverse @history) { if (exists $idlist->{$_->[2]}) { $timestamp = scalar(localtime(toGMSeconds($_->[0]))); last; } } } else { $timestamp = scalar(localtime(toGMSeconds($history[$#history]->[0]))); } } else { print STDERR "Could not open $file in Integro.pl\n"; } } if (substr($FORM{'reportname'},-3) ne 'csv') { if (defined $timestamp) { $timestamp = "$timestamp

\n"; } else { $timestamp = "
\n"; } } # Generate the reports if ($FORM{'reportname'} eq 'PassionPeopleGroups') { # Section 1 &PassionPeopleGroups($idlist, $groups, $timestamp); } elsif ($FORM{'reportname'} eq 'PassionPeopleSummary') { # Section 1 &PassionPeopleSummary($timestamp); } elsif ($FORM{'reportname'} eq 'PassionIndexGroups') { # Section 2 &PassionIndexGroups($idlist, $groups, $timestamp); # } elsif ($FORM{'reportname'} eq 'PassionVertGroups') { # Section 2 # &PassionVertGroups($idlist, $groups, $timestamp); } elsif ($FORM{'reportname'} eq 'PassionIndexSummary') { # Section 2 &PassionIndexSummary($timestamp); } elsif ($FORM{'reportname'} eq 'values') { # Section 3 &ValuesReport($idlist, $groups, $timestamp); } elsif ($FORM{'reportname'} eq 'valuessummary') { # Section 3 &ValuesSummary($idlist, $groups, $timestamp); } elsif ($FORM{'reportname'} eq 'valuescsv') { # Section 3 &ValuesCSV($idlist, $groups, $timestamp); } elsif ($FORM{'reportname'} eq 'comments') { # General Reports &CommentsReport($idlist, $timestamp, 0); # Disable because there are comments on only one question. # } elsif ($FORM{'reportname'} eq 'comments2') { # General Reports # &CommentsReport($idlist, $timestamp, 1); } else { &ReportChooser(); } # There should only be function definitions beyond this point. exit(0); sub grepa { # Parms # (\@boola, \@data) # Returned value. # Array of the @data array with a cooresponding value of @boola that is true. my (@reta, $bool, $data, $index) ; ($bool, $data) = @_ ; for ($index=0; $index<=$#$data ; $index++) { push @reta, $$data[$index] if ($$bool[$index]) ; } return @reta ; } sub HTMLHeader { return "\n\n$_[0]\n". "\n". "\n\n". "\n"; } sub HTMLHeaderPlain { return "\n\n$_[0]\n". "\n" . "$_[2]" . "\n". "\n"; } sub HTMLFooter { my $year = `date +%Y`; my $ionline; if ($ENV{'SERVER_NAME'} =~ "integroonline.com") { $ionline = " - Copyright (c) $year, Integro Learning Company"; } return "
Copyright (c) $year, Integro Leadership Institute$ionline\n\n"; # return "\n\n"; # return "" ; } sub ReportChooser { # Links w/javascript for chosing report # Radio button to choose between all and select group(s) # Menu box to chose one or more groups my $groups = &getGroups($CLIENT{'clid'}); my $js = "function parmsIntegro(oform,rpt) {\n\t". "if (rpt.indexOf('csv') > 0) { oform.csv.value=1; } else{ oform.csv.value=0; }\n\t". "oform.reportname.value=rpt;\n\t". "oform.action='/cgi-bin/creports.pl';\n\t". "oform.submit();\n};\n"; $js .= "\nfunction commIntegro(oform) {\n\t". "oform.rptid.value='ACT-C-004';\n\t". "oform.rptdesc.value='Test Statistics by Test'\n\t". "oform.action='/cgi-bin/IntegroTS.pl';\n\t". "oform.submit();\n};\n"; my $organizationname = $CLIENT{'clnmc'}; my $uberheader; my $test; if ($FORM{'tstid'}) { $test = $FORM{'tstid'}; } elsif ($rptparams[0]) { $test = $rptparams[0]; } else { $test = "passion"; # Default test id for this report. HBI } my ($tstid) = grep((/($test\s*)&/ && ($_=$1)),get_data("tests.$CLIENT{'clid'}")); if (not $tstid) { print HTMLHeader("Error! No Employee Passion Survey Found."); print "

Error! No Employee Passion Survey Found.

\n"; print HTMLFooter(); } #print STDERR get_data("tests.$CLIENT{'clid'}"); #print STDERR "Test ID = $tstid\n"; print HTMLHeader("Integro Learning Custom Reports",$js); print "
\n"; print "\n"; # For development purposes we hardcode the survey id. # Fix this before production print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n\n\n". "\n". "\n"; print "\n"; print ""; print "
Integro Learning Custom Reports
All GroupsChoose Groups
\n". "\n"; #print "
$xlatphrase[797] $xlatphrase[279]:
\n"; print "
Organization Name:
Header Override:
Time Stamp:
    ". "
  • Most Recent Survey Taken
  • ". "
  • Current Time
  • ". "
  • Custom Value: ". "
\n"; print "
\n"; #print "Display reports as PDF\n"; print "

Section 1

" ; print "

Section 2

\n" . "" ; print "

Section 3

\n"; # print "

Section 4

\n"; # print "

Section 5

\n"; print "

General Reports