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.

558 lines
28 KiB

#!/usr/bin/perl
#
# $Id: Integro.pl,v 1.48 2005/11/07 16:36:06 ddoughty Exp $
#
# Source File: Integro.pl
# Get config
use FileHandle;
use Time::Local;
use Data::Dumper;
use IntegroLib;
require 'sitecfg.pl';
require 'testlib.pl';
require 'tstatlib.pl';
use strict;
use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST
%SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS %SYSTEM %REPORT
%SUBTEST_RESPONSES);
use vars qw($testcomplete $cgiroot $pathsep $dataroot );
&app_initialize;
$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI
&LanguageSupportInit();
#print STDERR Dumper(\%SESSION);
&get_client_profile($SESSION{'clid'});
&get_test_profile($CLIENT{'clid'}, $FORM{'tstid'});
# Make sure we have a valid session, and exit if we don't
if (not &get_session($FORM{'tid'})) {
exit(0);
}
# Get the group filters, if any
my ($idlist,$groups);
if (exists $FORM{'grouping'} and $FORM{'grouping'} eq 'subset') {
my @tmp = split(/,/,$FORM{'idlist'});
@{$groups}{@tmp} = @tmp;
$idlist = &getIdlist($CLIENT{'clid'},$FORM{'idlist'});
}
# 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 "<pre>".Dumper(\@history)."</pre>";
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 (defined $timestamp) {
$timestamp = "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$timestamp</b></font><br><BR>\n";
} else {
$timestamp = "<br>\n";
}
# Generate the reports
if ($FORM{'reportname'} eq 'commeffect') {
&CommEffectReport($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'commeffectsummary') {
&CommEffectSummary($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'trustlevel') {
&TrustLevelReport($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'trustlevelsummary') {
&TrustLevelSummary($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'values') {
&ValuesReport($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'valuessummary') {
&ValuesSummary($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'comments') {
&CommentsReport($idlist, $timestamp);
} elsif ($FORM{'reportname'} eq 'people') {
&KindsOfPeopleReport($idlist, $groups, $timestamp);
} elsif ($FORM{'reportname'} eq 'peoplesummary') {
&KindsOfPeopleSummary($idlist, $groups, $timestamp);
} else {
&ReportChooser();
}
# There should only be function definitions beyond this point.
exit(0);
sub HTMLHeader {
return "<html>\n<head>\n<title>$_[0]</title>\n".
"<script language=\"JavaScript\">\n<!-- \n$_[1]\n -->\n</script>\n</head>\n".
"<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"".
" TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"".
" VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\">\n";
}
sub HTMLHeaderPlain {
return "<html>\n<head>\n<title>$_[0]</title>\n".
"<script language=\"JavaScript\">\n<!-- \n$_[1]\n -->\n</script>\n</head>\n".
"<BODY>\n";
}
sub HTMLFooter {
return "<br><center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">Copyright (c) 2006, Integro Leadership Institute<center></font></body>\n</html>\n";
}
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".
"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/teststats.pl';\n\t".
"oform.submit();\n};\n";
my $orgname = $CLIENT{'clnmc'};
my ($tstid) = grep((/(SAS01\S*)&/ && ($_=$1)),get_data("tests.$CLIENT{'clid'}"));
if (not $tstid) {
print HTMLHeader("Error! No Strategic Alignment Survey Found.");
print "<h1>Error! No Strategic Alignment Survey Found.</h1>\n";
print HTMLFooter();
}
#print STDERR get_data("tests.$CLIENT{'clid'}");
#print STDERR "Test ID = $tstid\n";
print HTMLHeader("Integro Learning Custom Reports",$js);
print "<form name=\"integrorpt\" action=\"/cgi-bin/creports.pl\" method=\"Post\" target=\"rptwindow\" enctype=\"multipart/form-data\" >\n";
print "<input type=\"hidden\" name=\"tid\" value=\"$SESSION{'tid'}\">\n";
# For development purposes we hardcode the survey id.
# Fix this before production
print "<input type=hidden name=\"tstid\" value=\"$tstid\">\n";
print "<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">\n";
print "<input type=hidden name=\"rptdesc\" value=\"$REPORT{'rptdesc'}\">\n";
print "<input type=hidden name=\"rptid\" value=\"$REPORT{'rptid'}\">\n";
print "<input type=\"hidden\" name=\"reportname\" value=\"\">\n";
print "<center>\n<table border>\n<caption>Integro Learning Custom Reports</Caption>\n".
"<tr><td valign=\"top\"><input type=\"radio\" name=\"grouping\" value=\"all\" checked>All Groups</td>\n".
"<td valign=\"top\"><input type=\"radio\" name=\"grouping\" value=\"subset\">Choose Groups<br>\n".
"<select name=\"idlist\" onchange='this.form.grouping[1].click();' multiple>\n";
foreach (sort {$a->{'grpnme'} cmp $b->{'grpnme'}} values %$groups) {
print "<option value=\"$_->{'grpid'}\">$_->{'grpnme'}</option>\n";
}
print "<tr><td colspan=\"2\">Organization Name: <input type=\"text\" name=\"orgname\" value=\"$orgname\"></td></tr>\n";
print "<tr><td colspan=\"2\">Time Stamp:<ul style=\"list-style: none\">".
"<li><input type=\"radio\" name=\"timestamp\" value=\"mostrecent\" checked>Most Recent Survey Taken</li>".
"<li><input type=\"radio\" name=\"timestamp\" value=\"currenttime\">Current Time</li>".
"<li><input type=\"radio\" name=\"timestamp\" value=\"custom\">Custom Value: ".
"<input type=\"text\" name=\"customtime\"></li></tr></td>";
print "</table></center>\n";
print "<hr>\n";
#print "<input type=\"checkbox\" name=\"pdf\">Display reports as PDF\n";
print "<p>Section 1<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'people');\">Kinds of People Report</a></li>".
"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'peoplesummary');\">Kinds of People Summary</a></li></ul></p>\n";
print "<p>Section 2<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'trustlevel');\">Group Trust Level Report</a></li>".
"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'trustlevelsummary');\">Group Trust Level Summary</a></li></ul></p>\n";
print "<p>Section 3<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'values');\">Values That Build Trust Report</a></li>".
"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'valuessummary');\">Values That Build Trust Summary</a></li></ul></p>\n";
print "<p>Section 4<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'commeffect');\">Group Alignment Report</a></li>".
"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'commeffectsummary');\">Group Alignment Summary</a></li></ul></p>\n";
print "<p>General Reports<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'comments');\">Comments</a></li>";
print "<input type=hidden name=\"testsummary\" value=\"composite\">\n";
print "<input type=hidden name=\"showcmts\" value=\"donot\">\n";
#my $commurl = "/cgi-bin/teststats.pl?tstid=$tstid".
# "&tid=$FORM{'tid'}&rptid=ACT-C-004&rptdesc=Test%20Statistics%20by%20Test".
# "&testsummary=composite&showcmts=donot";
print "<li><a href=\"javascript:commIntegro(document.integrorpt);\">Question Statistics</a></li></p>\n";
print "</form>";
print HTMLFooter();
}
# Also known as the Group Alignment report
sub CommEffectReport {
my ($idlist,$groups,$timestamp) = @_;
my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
my $claritysum = $data->{'organization'}->{'claritysum'};
my $approvalsum = $data->{'organization'}->{'approvalsum'};
my $histograms = $data->{'organization'}->{'histogram'};
print HTMLHeaderPlain("Section 4 - Group Alignment Report");
print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 4 - Group Alignment Report</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The degree to which Employees are Aligned with the Organization</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border><tr><th>&nbsp;&nbsp;&nbsp;&nbsp;</th><th><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Very Unclear</b></font></th><th>&nbsp;&nbsp;&nbsp;&nbsp;</th>".
"<th><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Moderately Unclear</b></font></th><th>&nbsp;&nbsp;&nbsp;&nbsp;</th><th><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Moderately Clear</b></font></th>".
"<th>&nbsp;&nbsp;&nbsp;&nbsp;</th><th><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Very Clear</b></font></th><th><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Group Clarity</b></font></th>".
"<th><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Group Approval</b></font></th></tr>\n";
# fill in the rows
my $overall = {'clarity' => 0, 'approval' => 0};
foreach my $row (qw(Purpose Values Vision Goals Procedures Roles)) {
print "<tr><th>$row</th>";
for my $i (0..6) {
print "<td align=\"center\">";
if ($histograms->{$row}->{'Clarity'}->[$i]) {
if ($histograms->{$row}->{'Approval'}->[$i]->[2]) {
print "<img src=\"/graphic/face-smile.gif\">".
"<sub>$histograms->{$row}->{'Approval'}->[$i]->[2]</sub><br>";
}
if ($histograms->{$row}->{'Approval'}->[$i]->[1]) {
print "<img src=\"/graphic/face-red.gif\">".
"<sub>$histograms->{$row}->{'Approval'}->[$i]->[1]</sub><br>";
}
if ($histograms->{$row}->{'Approval'}->[$i]->[0]) {
print "<img src=\"/graphic/face-blue.gif\">".
"<sub>$histograms->{$row}->{'Approval'}->[$i]->[0]</sub>";
}
} else {
print "&nbsp;";
}
print "</td>";
}
printf "<td align=\"center\">%.1f %%</td>\n", $claritysum->{$row}->{'value'};
printf "<td align=\"center\">%.1f %%</td>\n", $approvalsum->{$row}->{'value'};
print "</tr>\n";
}
print "</table>\n<p>Position = Group Clarity</p>\n<p>Countenance = Personal Approval</p>\n";
print "<table border><caption><b>Overall Group Alignment</b></caption>\n";
printf "<tr><th>Clarity</th><td>%.1f %%</td></tr>\n", $data->{'organization'}->{'overallclarity'};
printf "<tr><th>Approval</th><td>%.1f %%</td></tr>\n", $data->{'organization'}->{'overallapproval'};
print "</table></b></font>\n";
print HTMLFooter();
}
sub CommEffectSummary {
my ($idlist,$groups,$timestamp) = @_;
my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
$groups = getGroups($CLIENT{'clid'});
print HTMLHeaderPlain("Section 4 - Group Alignment Summary");
print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 4 - Group Alignment Summary</i></b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The degree to which Employees are Aligned with the Organization</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
print "<tr><td>&nbsp;</th><th>Clarity</th><th>Approval</th></tr>\n";
print "<tr><td>Overall</td>";
printf "<td>%.1f %%</td>",$data->{'organization'}->{'overallclarity'};
printf "<td>%.1f %%</td></tr>\n", $data->{'organization'}->{'overallapproval'};
if (exists $data->{'groups'}) {
print "<tr><th colspan=3 align=\"left\">Group Breakdown</th></tr>\n";
print "<tr><th>Group</th><th>Clarity</th><th>Approval</th></tr>\n";
foreach my $grp (sort keys %{$data->{'groups'}}) {
print "<tr><td>$groups->{$grp}->{'grpnme'}</td>";
printf "<td>%.1f %%</td>", $data->{'groups'}->{$grp}->{'overallclarity'};
printf "<td>%.1f %%</td></tr>\n", $data->{'groups'}->{$grp}->{'overallapproval'};
}
}
print "</table></b></font>\n";
print HTMLFooter();
}
sub TrustLevelReport {
my ($idlist,$groups,$timestamp) = @_;
my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
my $histograms = $data->{'organization'}->{'histogram'};
my $trust = $data->{'organization'}->{'trust'};
print HTMLHeaderPlain("Section 2 - Group Trust Level Report");
print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 2 - Group Trust Level Report</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The level of Trust Building behaviors</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border><tr><th>&nbsp;</th><th>&nbsp;</th><th>Group Trust Level</th></tr>\n";
my $baseurl = "/cgi-bin/bargraph.pl?labels=Low::::Medium::::High&title=Trust%20Level&ylabel=Respondents";
$baseurl .= "&xdim=500&ydim=150";
foreach my $row (qw(Congruence Openness Acceptance Reliability)) {
print "<tr><th>$row</th>";
print "<td><img src=\"$baseurl&values=".join(":",@{$histograms->{$row}})."\"></td>";
printf "<td align=\"center\">%.1f%% </td></tr>\n", $trust->{$row}->{'value'};
}
print "</table></b></font>\n";
printf "<P><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>Overall Group Trust Level</b></font> = %.1f %%.</p>\n",$data->{'organization'}->{'overalltrust'};
print HTMLFooter();
}
sub TrustLevelSummary {
my ($idlist,$groups,$timestamp) = @_;
my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
$groups = getGroups($CLIENT{'clid'});
print HTMLHeaderPlain("Section 2 - Group Trust Level Summary");
print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 2 - Group Trust Level Summary</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The level of Trust Building behaviors</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Summary</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
print "<tr><td>&nbsp;</th><th>Group Trust Level</th></tr>\n";
print "<tr><td>Overall</td>";
printf "<td>%.1f %%</td></tr>\n", $data->{'organization'}->{'overalltrust'};
if (exists $data->{'groups'}) {
print "<tr><th colspan=2 align=\"left\">Group Breakdown</th></tr>\n";
print "<tr><th>Group</th><th>Group Trust Level</th></tr>\n";
foreach my $grp (sort keys %{$data->{'groups'}}) {
print "<tr><td>$groups->{$grp}->{'grpnme'}</td>";
printf "<td>%.1f %%</td></tr>\n", $data->{'groups'}->{$grp}->{'overalltrust'};
}
}
print "</table></b></font>\n";
print HTMLFooter();
}
# Aka Gap Analysis
sub ValuesReport {
my ($idlist,$groups,$timestamp) = @_;
my $data = &ValuesData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
print HTMLHeaderPlain("Section 3 - Values That Build Trust");
print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 3 - Values That Build Trust</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Expectation and the degree to <br>which the Organization operates by these Values</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
$timestamp;
printf "<table border><tr><td>Your Trust Values Gap Score is %.1f",$data->{'organization'}->{'gap'};
#print "<br>World Class Standard ?<br>International Benchmark ?<br>";
print "</td></tr></table>\n";
print "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">The graphs below show the Personal Importance and Perceptions of Work Performance".
" for each of the eight values.</font>";
print "<tr><td>&nbsp;</td><th>Gap</th></tr>\n";
my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Importance:Work%20Performance".
"&xdim=500&ydim=60&hbar=1&ymax=11&ymin=0&yticknum=11";
foreach ('Straightforwardness', 'Honesty', 'Receptivity', 'Disclosure', 'Respect',
'Recognition', 'Seeks Excellence', 'Keeps Commitments') {
my $url;
my $pinum = (int(10*$data->{'organization'}->{$_}->{'Personal Importance'}+0.5)/10);
my $wpnum = (int(10*$data->{'organization'}->{$_}->{'Work Performance'}+0.5)/10);
my $diff = $pinum - $wpnum;
$diff = sprintf("%1.1f", $diff);
$url = $baseurl."&values=".$pinum.":";
$url = $url."&values2=:".$wpnum;
print "<tr><th colspan=\"2\" align=\"left\">$_</th></tr>\n";
#print "<tr><td><img src=\"$url\"></td><td align=\"center\">$data->{'organization'}->{$_}->{'count'}</td></tr>\n";
print "<tr><td><img src=\"$url\"></td><td align=\"center\">$diff</td></tr>\n";
}
print "</table></b></font>\n";
print HTMLFooter();
}
sub ValuesSummary {
my ($idlist,$groups,$timestamp) = @_;
my $data = &ValuesData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
$groups = getGroups($CLIENT{'clid'});
print HTMLHeaderPlain("Section 3 - Values That Build Trust Summary");
print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 3 - Values That Build Trust Summary</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Expectation and the degree to <br>which the Organization operates by these Values</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
print "<tr><td>&nbsp;</th><th>Trust Values Gap</th></tr>\n";
print "<tr><td>Overall</td>";
printf "<td align=center>%.1f</td></tr>\n", $data->{'organization'}->{'gap'};
if (exists $data->{'groups'}) {
print "<tr><th colspan=2 align=\"left\">Group Breakdown</th></tr>\n";
print "<tr><th>Group</th><th>Trust Values Gap</th></tr>\n";
foreach my $grp (sort keys %{$data->{'groups'}}) {
print "<tr><td>$groups->{$grp}->{'grpnme'}</td>";
printf "<td align=center>%.1f</td></tr>\n", $data->{'groups'}->{$grp}->{'gap'};
}
}
print "</table></b></font>\n";
print HTMLFooter();
}
sub KindsOfPeopleReport {
my ($idlist,$groups,$timestamp) = @_;
my $data = KindsOfPeopleData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
print HTMLHeaderPlain("Section 1 - Kinds of People");
print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 1 - Kinds of People</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>Employee behavior perceived by coworkers</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>";
my $url;
if (exists $data->{'self'}) {
my @self = @{$data->{'self'}}{'Rebellious','Compliant','Self-Directed'};
$url = "/cgi-bin/piechart.pl?title=Self%20Perception&values=".
join(':',map(int($_+0.5),@self)).
"&labels=Rebellious:Compliant:Self-Directed";
print "<tr><td><img src=\"$url\"></td></tr>\n";
}
if (exists $data->{'organization'}) {
my @other = @{$data->{'organization'}}{'Rebellious','Compliant','Self-Directed'};
$url = "/cgi-bin/piechart.pl?title=Perception%20of%20Others&values=".
join(':',map(int(10*$_+0.5)/10,@other)).
"&labels=Rebellious:Compliant:Self-Directed";
print "<tr><td><img src=\"$url\"></td></tr>\n";
print "</table>\n";
print "<p><table border><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>Overall Group Values</b></font>\n";
foreach ('Rebellious','Compliant','Self-Directed') {
printf "<tr><th>$_</th><td>%.1f %%</td></tr>\n", $data->{'organization'}->{$_};
}
print "</table></b></font>\n";
} else {
print "<h1>No valid Data</h1>\n";
}
#print "<pre>".Dumper($data)."</pre>\n";
print HTMLFooter();
}
sub KindsOfPeopleSummary {
my ($idlist,$groups,$timestamp) = @_;
my $data = KindsOfPeopleData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
$groups = getGroups($CLIENT{'clid'});
print HTMLHeaderPlain("Section 1 - Kinds of People Summary");
print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 1 - Kinds of People Summary</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>Employee behavior perceived by coworkers</b></font><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
print "<tr><td>&nbsp;</th><th>Rebellious</th><th>Compliant</th><th>Self-Directed</th></tr>\n";
print "<tr><td>Overall</td>";
printf "<td>%.1f %%</td>", $data->{'organization'}->{'Rebellious'};
printf "<td>%.1f %%</td>", $data->{'organization'}->{'Compliant'};
printf "<td>%.1f %%</td></tr>\n", $data->{'organization'}->{'Self-Directed'};
if (exists $data->{'groups'}) {
print "<tr><th colspan=4 align=\"left\">Group Breakdown</th></tr>\n";
print "<tr><th>Group</th><th>Rebellious</th><th>Compliant</th><th>Self-Directed</th></tr>\n";
foreach my $grp (sort keys %{$data->{'groups'}}) {
print "<tr><td>$groups->{$grp}->{'grpnme'}</td>";
printf "<td>%.1f %%</td>\n", $data->{'groups'}->{$grp}->{'Rebellious'};
printf "<td>%.1f %%</td>\n", $data->{'groups'}->{$grp}->{'Compliant'};
printf "<td>%.1f %%</td></tr>\n", $data->{'groups'}->{$grp}->{'Self-Directed'};
}
}
print "</table></b></font>\n";
print HTMLFooter();
}
sub CommentsReport {
my ($idlist) = @_;
my @filelist = &get_test_result_files($testcomplete, $CLIENT{'clid'},$TEST{'id'});
my @comments;
for (my $i=0; $i<=59; $i++) {$comments[$i] = [];}
my @questions = map([split(/&/,$_)],&get_question_list($TEST{'id'},$CLIENT{'clid'}));
foreach (@questions) {$_->[4] =~ s/:::.*$//;}
foreach my $file (@filelist) {
my $user = $file;
$user =~ s/.$TEST{'id'}$//;
$user =~ s/^$CLIENT{'clid'}.//;
if (defined $idlist and not $idlist->{$user}) {
next;
}
my ($answers,$usercomm) = &get_survey_results( $CLIENT{'clid'}, $user, $TEST{'id'});
for (my $i=1; $i<=58; $i++) {
if ($usercomm->[$i] == -1) {
$comments[$i] = -1;
} elsif ($usercomm->[$i]) {
push @{$comments[$i]},$usercomm->[$i];
}
}
if ($answers->[59]) {
push @{$comments[59]},$answers->[59];
}
}
print HTMLHeaderPlain("Comments Report");
print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Comments Report</b></font><br><br>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
if (defined $idlist) {
my $groups = getGroups($CLIENT{'clid'});
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
.join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
} else {
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Organization-wide Report</b></font><br>\n";
}
print $timestamp;
print "</center>\n";
for (my $i=1; $i <=59; $i++) {
if ($comments[$i] == -1) {
# inactive question
next;
}
print "<hr width=\"100%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>\n";
print "$questions[$i]->[0] - $questions[$i]->[4]<p>\n";
if (@{$comments[$i]}) {
print "<ul>\n";
foreach (@{$comments[$i]}) {
print "<li>$_</li>\n";
}
print "</ul>\n";
} else {
print "<ul><li><small><i>No Comments</i></small></li></ul>\n";
}
print "</b></font>\n";
}
print "<hr width=\"100%\">\n";
#print "<pre>".Dumper(\@questions,\@comments)."</pre>\n";
print "<center>".HTMLFooter();
}