diff --git a/.gitignore b/.gitignore index 6c479a684..753822bbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ *~ -*/log +sess.* diff --git a/survey-nginx/cgi-bin/InMem.pm.bu20110318 b/survey-nginx/cgi-bin/InMem.pm.bu20110318 deleted file mode 100755 index 45a15ac80..000000000 --- a/survey-nginx/cgi-bin/InMem.pm.bu20110318 +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2011 Hank Ivy - -# Package to load data into memory for multiple usage. -# use strict ; -# use warnings ; -# require 'sitecfg.pl' ; - -package InMem ; -use Exporter () ; -@ISA = qw(Exporter) ; -@EXPORT = qw(InsertQuesResp InsertQuesComment $GlobalData) ; -@EXPORT_OK = qw( ) ; - -local $GlobalData = {} ; -my $ValidClientChar = "0\-9a\-zA\-Z\_\-" ; -my $ValidCandidateChar = "0\-9a\-zA\-Z\\_\\- " ; -my $ValidTestIDChar = "0\-9a\-zA\-Z\_\-" ; -my %ValidTestTypes = (complete => 1, pending => 1, inprog => 1 ) ; -my $InMem_Debug = 0 ; - -unless ($GlobalData) { - $GlobalData = {'CLIENTS' => {}} ; - warn "Init. GlobalData" if ($InMem_Debug) ; -} - -sub ValidateClientStr { - # Validate just the characters in the str. - # A positive result does not mean the Client exists. - # Parameters - # $ClientID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($ClientID ) = @_ ; - if ((length $ClientID) == 0) { - return 0 ; - } - if ($ClientID =~ m/^[${ValidClientChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidateTestIDStr { - # Validate just the characters in the str. - # A positive result does not mean the TestID exists. - # Parameters - # $TestID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($TestID ) = @_ ; - if ((length $TestID) == 0) { - return 0 ; - } - if ($TestID =~ m/^[${ValidTestIDChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidateCandidateStr { - # Validate just the characters in the str. - # A positive result does not mean the Candidate exists. - # Parameters - # $CandidateID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($CandidateID ) = @_ ; - if ((length $CandidateID) == 0) { - return 0 ; - } - if ($CandidateID =~ m/^[${ValidCandidateChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidQId { - # Validate the scalar as a numeric greater than 0. - # A positive result does not mean the Question ID exists. - # Parameters - # $QuesId - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($QuesId ) = @_ ; - unless ($QuesId) { - return 0 ; - } - unless ($QuesId =~ m/^\d+$/ ) { - warn "Bad $QuesId QuesId" if ($InMem_Debug) ; - return 0 ; - } - unless ($QuesId > 0) { - warn "Bad $QuesId QuesId" if ($InMem_Debug) ; - return 0 ; - } - return 1 ; -} - -sub CreateClientSkeleton { - # Create a very minimal data structure for a client. - # Parameters - # $ClientID - Character String. - my ($ClientID ) = @_ ; - unless ($ClientID) { - die "Error: CreateClientSkeleton called with an empty ClientID" ; - } - unless (&ValidateClientStr($ClientID)) { - die "Error: CreateClientSkeleton called with an invalid ClientID character." - } - unless($GlobalData) { - $GlobalData = {'CLIENTS' => {}} ; - } - unless($GlobalData -> {'CLIENTS'} -> {$ClientID}) { - warn "Initialize $ClientID Client" if ($InMem_Debug) ; - $GlobalData -> {'CLIENTS'} -> {$ClientID} = {} ; - } - return 1 ; -} - -sub CreateCandidateSkeleton { - # Create a very minimal data structure for a candidate associated with a client. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - my ($ClientID, $CandidateID ) = @_ ; - unless ( &CreateClientSkeleton($ClientID) ) { - warn "Fail $ClientID, $CandidateID CreateCandidateSkeleton" if ($InMem_Debug) ; - return 0 ; - } - unless ($CandidateID) { - die "Error: CreateCandidateSkeleton called with an empty CandidateID" ; - } - unless ($CandidateID =~ m/^[${ValidCandidateChar}]+$/o ) { - die "Error: CreateCandidateSkeleton called with an invalid CandidateID character." - } - unless ($GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} ) { - $GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} = {} ; - warn "Initialize $CandidateID CandidateID" if ($InMem_Debug) ; - } - unless ($GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} -> {$CandidateID}) { - $GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} -> {$CandidateID} = {} ; - warn "Initialize $CandidateID CandidateID" if ($InMem_Debug) ; - } - return 1 ; -} - -sub GetClientsInMem { - # Return an array of the Client Names in Memory. - my @Clients ; - if ($GlobalData and $GlobalData -> {'CLIENTS'}) { - @Clients = keys %{$GlobalData -> {'CLIENTS'}} ; - } - return @Clients ; -} - -sub ImportAllClientIDs { - # Populate the data structure for all clients. - # Parameters - No input parms. - # Return 0 if there is a problem, 1 if all is OK. - my $ClientFile = $main::PATHS{'dataroot'} . $main::pathsep . "clients.dat" ; - my $line_cnt = 0 ; - my @field_ids = () ; -} - -sub CreateCanTestSkel { - # Create a very minimal data structure for a test taken by a candidate. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID) = @_ ; - unless ( &CreateCandidateSkeleton($ClientID, $CandidateID)) { - return 0 ; - } - unless (&ValidateTestIDStr ($TestID)) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'} ) { - warn "Initialize $ClientID, $CandidateID CandidateID Tests" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'} = {} ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} ) { - warn "Initialize $ClientID, $CandidateID CandidateID Tests" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} = {} ; - } - return 1 ; -} - -sub CreateCanTestTypeSkel { - # Create a very minimal data structure for a test type taken by a candidate. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType) = @_ ; - unless (&CreateCanTestSkel($ClientID, $CandidateID, $TestID)) { - return 0 ; - } - unless ($ValidTestTypes{$TestType}) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} ) { - warn "Initialize $ClientID, $CandidateID, $TestType TestType" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} = {} ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType} ) { - warn "Initialize $ClientID, $CandidateID, $TestType TestType" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType} = {} ; - } - return 1 ; -} - -sub CreateCanTestTypeQIdSkel { - # Create a very minimal data structure for a Question in a test taken. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID) = @_ ; - unless (&CreateCanTestTypeSkel($ClientID, $CandidateID, $TestID, $TestType)) { - return 0 ; - } - unless (&ValidQId($QuesID)) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID} ) { - warn "Initialize $ClientID, $CandidateID, $TestType, $QuesID QuesID" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID} = {} ; - } - return 1 ; -} - -sub InsertQuesComment { - # Place a Comment in a data structure for a Question in a test taken. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # $Comment - A string. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID, $Comment) = @_ ; - unless (&CreateCanTestTypeQIdSkel($ClientID, $CandidateID, $TestID, $TestType, $QuesID)) { - return 0 ; - } - # Any Character string, even an empty string is valid. - unless ($Comment) { - $Comment = "" ; - } - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID}->{'Comment'} = $Comment ; - warn "Add Comment CLI $ClientID User $CandidateID Tst $TestID Type $TestType QID $QuesID Text $Comment X" ; - return 1 ; -} - -sub InsertQuesResp { - # Place a Text Response answer for a Question in a test taken in a data structure. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # $Resp - A string. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID, $Resp) = @_ ; - unless (&CreateCanTestTypeQIdSkel($ClientID, $CandidateID, $TestID, $TestType, $QuesID)) { - return 0 ; - } - # Any Character string, even an empty string is valid. - unless ($Resp) { - $Resp = "" ; - } - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID}->{'Resp'} = $Resp ; - warn "Add Response CLI $ClientID User $CandidateID Tst $TestID Type $TestType QID $QuesID Text $resp X" ; - return 1 ; -} - -1 ; # End of a library perl file. - diff --git a/survey-nginx/cgi-bin/InMem.pm.bu20110404 b/survey-nginx/cgi-bin/InMem.pm.bu20110404 deleted file mode 100755 index 1f01c94f2..000000000 --- a/survey-nginx/cgi-bin/InMem.pm.bu20110404 +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2011 Hank Ivy - -# Package to load data into memory for multiple usage. -# use strict ; -# use warnings ; -# require 'sitecfg.pl' ; - -package InMem ; -use Exporter () ; -@ISA = qw(Exporter) ; -@EXPORT = qw(InsertQuesResp InsertQuesComment $GlobalData) ; -@EXPORT_OK = qw( ) ; - -local $GlobalData = {} ; -my $ValidClientChar = "0\-9a\-zA\-Z\_\-" ; -my $ValidCandidateChar = "0\-9a\-zA\-Z\\_\\-\@\. " ; -my $ValidTestIDChar = "0\-9a\-zA\-Z\_\-" ; -my %ValidTestTypes = (complete => 1, pending => 1, inprog => 1 ) ; -my $InMem_Debug = 0 ; - -unless ($GlobalData) { - $GlobalData = {'CLIENTS' => {}} ; - warn "Init. GlobalData" if ($InMem_Debug) ; -} - -sub ValidateClientStr { - # Validate just the characters in the str. - # A positive result does not mean the Client exists. - # Parameters - # $ClientID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($ClientID ) = @_ ; - if ((length $ClientID) == 0) { - return 0 ; - } - if ($ClientID =~ m/^[${ValidClientChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidateTestIDStr { - # Validate just the characters in the str. - # A positive result does not mean the TestID exists. - # Parameters - # $TestID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($TestID ) = @_ ; - if ((length $TestID) == 0) { - return 0 ; - } - if ($TestID =~ m/^[${ValidTestIDChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidateCandidateStr { - # Validate just the characters in the str. - # A positive result does not mean the Candidate exists. - # Parameters - # $CandidateID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($CandidateID ) = @_ ; - if ((length $CandidateID) == 0) { - return 0 ; - } - if ($CandidateID =~ m/^[${ValidCandidateChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidQId { - # Validate the scalar as a numeric greater than 0. - # A positive result does not mean the Question ID exists. - # Parameters - # $QuesId - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($QuesId ) = @_ ; - unless ($QuesId) { - return 0 ; - } - unless ($QuesId =~ m/^\d+$/ ) { - warn "Bad $QuesId QuesId" if ($InMem_Debug) ; - return 0 ; - } - unless ($QuesId > 0) { - warn "Bad $QuesId QuesId" if ($InMem_Debug) ; - return 0 ; - } - return 1 ; -} - -sub CreateClientSkeleton { - # Create a very minimal data structure for a client. - # Parameters - # $ClientID - Character String. - my ($ClientID ) = @_ ; - unless ($ClientID) { - die "Error: CreateClientSkeleton called with an empty ClientID" ; - } - unless (&ValidateClientStr($ClientID)) { - die "Error: CreateClientSkeleton called with an invalid ClientID character." - } - unless($GlobalData) { - $GlobalData = {'CLIENTS' => {}} ; - } - unless($GlobalData -> {'CLIENTS'} -> {$ClientID}) { - warn "Initialize $ClientID Client" if ($InMem_Debug) ; - $GlobalData -> {'CLIENTS'} -> {$ClientID} = {} ; - } - return 1 ; -} - -sub CreateCandidateSkeleton { - # Create a very minimal data structure for a candidate associated with a client. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - my ($ClientID, $CandidateID ) = @_ ; - unless ( &CreateClientSkeleton($ClientID) ) { - warn "Fail $ClientID, $CandidateID CreateCandidateSkeleton" if ($InMem_Debug) ; - return 0 ; - } - unless ($CandidateID) { - die "Error: CreateCandidateSkeleton called with an empty CandidateID" ; - } - unless ($CandidateID =~ m/^[${ValidCandidateChar}]+$/o ) { - die "Error: CreateCandidateSkeleton called with an invalid CandidateID character" . $CandidateID . "." ; - } - unless ($GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} ) { - $GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} = {} ; - warn "Initialize $CandidateID CandidateID" if ($InMem_Debug) ; - } - unless ($GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} -> {$CandidateID}) { - $GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} -> {$CandidateID} = {} ; - warn "Initialize $CandidateID CandidateID" if ($InMem_Debug) ; - } - return 1 ; -} - -sub GetClientsInMem { - # Return an array of the Client Names in Memory. - my @Clients ; - if ($GlobalData and $GlobalData -> {'CLIENTS'}) { - @Clients = keys %{$GlobalData -> {'CLIENTS'}} ; - } - return @Clients ; -} - -sub ImportAllClientIDs { - # Populate the data structure for all clients. - # Parameters - No input parms. - # Return 0 if there is a problem, 1 if all is OK. - my $ClientFile = $main::PATHS{'dataroot'} . $main::pathsep . "clients.dat" ; - my $line_cnt = 0 ; - my @field_ids = () ; -} - -sub CreateCanTestSkel { - # Create a very minimal data structure for a test taken by a candidate. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID) = @_ ; - unless ( &CreateCandidateSkeleton($ClientID, $CandidateID)) { - return 0 ; - } - unless (&ValidateTestIDStr ($TestID)) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'} ) { - warn "Initialize $ClientID, $CandidateID CandidateID Tests" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'} = {} ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} ) { - warn "Initialize $ClientID, $CandidateID CandidateID Tests" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} = {} ; - } - return 1 ; -} - -sub CreateCanTestTypeSkel { - # Create a very minimal data structure for a test type taken by a candidate. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType) = @_ ; - unless (&CreateCanTestSkel($ClientID, $CandidateID, $TestID)) { - return 0 ; - } - unless ($ValidTestTypes{$TestType}) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} ) { - warn "Initialize $ClientID, $CandidateID, $TestType TestType" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} = {} ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType} ) { - warn "Initialize $ClientID, $CandidateID, $TestType TestType" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType} = {} ; - } - return 1 ; -} - -sub CreateCanTestTypeQIdSkel { - # Create a very minimal data structure for a Question in a test taken. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID) = @_ ; - unless (&CreateCanTestTypeSkel($ClientID, $CandidateID, $TestID, $TestType)) { - return 0 ; - } - unless (&ValidQId($QuesID)) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID} ) { - warn "Initialize $ClientID, $CandidateID, $TestType, $QuesID QuesID" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID} = {} ; - } - return 1 ; -} - -sub InsertQuesComment { - # Place a Comment in a data structure for a Question in a test taken. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # $Comment - A string. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID, $Comment) = @_ ; - unless (&CreateCanTestTypeQIdSkel($ClientID, $CandidateID, $TestID, $TestType, $QuesID)) { - return 0 ; - } - # Any Character string, even an empty string is valid. - unless ($Comment) { - $Comment = "" ; - } - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID}->{'Comment'} = $Comment ; - warn "Add Comment CLI $ClientID User $CandidateID Tst $TestID Type $TestType QID $QuesID Text $Comment X" ; - return 1 ; -} - -sub InsertQuesResp { - # Place a Text Response answer for a Question in a test taken in a data structure. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # $Resp - A string. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID, $Resp) = @_ ; - unless (&CreateCanTestTypeQIdSkel($ClientID, $CandidateID, $TestID, $TestType, $QuesID)) { - return 0 ; - } - # Any Character string, even an empty string is valid. - unless ($Resp) { - $Resp = "" ; - } - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID}->{'Resp'} = $Resp ; - # warn "Add Response CLI $ClientID User $CandidateID Tst $TestID Type $TestType QID $QuesID Text $resp X" ; - return 1 ; -} - -1 ; # End of a library perl file. - diff --git a/survey-nginx/cgi-bin/InMem.pm.bu20131217 b/survey-nginx/cgi-bin/InMem.pm.bu20131217 deleted file mode 100755 index a31594c29..000000000 --- a/survey-nginx/cgi-bin/InMem.pm.bu20131217 +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2011 Hank Ivy - -# Package to load data into memory for multiple usage. -# use strict ; -# use warnings ; -# require 'sitecfg.pl' ; - -package InMem ; -use Exporter () ; -@ISA = qw(Exporter) ; -@EXPORT = qw(InsertQuesResp InsertQuesComment $GlobalData) ; -@EXPORT_OK = qw( ) ; - -local $GlobalData = {} ; -my $ValidClientChar = "0\-9a\-zA\-Z\_\-" ; -my $ValidCandidateChar = "0\-9a\-zA\-Z\\_\\-\@\., " ; -my $ValidTestIDChar = "0\-9a\-zA\-Z\_\-" ; -my %ValidTestTypes = (complete => 1, pending => 1, inprog => 1 ) ; -my $InMem_Debug = 0 ; - -unless ($GlobalData) { - $GlobalData = {'CLIENTS' => {}} ; - warn "Init. GlobalData" if ($InMem_Debug) ; -} - -sub ValidateClientStr { - # Validate just the characters in the str. - # A positive result does not mean the Client exists. - # Parameters - # $ClientID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($ClientID ) = @_ ; - if ((length $ClientID) == 0) { - return 0 ; - } - if ($ClientID =~ m/^[${ValidClientChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidateTestIDStr { - # Validate just the characters in the str. - # A positive result does not mean the TestID exists. - # Parameters - # $TestID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($TestID ) = @_ ; - if ((length $TestID) == 0) { - return 0 ; - } - if ($TestID =~ m/^[${ValidTestIDChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidateCandidateStr { - # Validate just the characters in the str. - # A positive result does not mean the Candidate exists. - # Parameters - # $CandidateID - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($CandidateID ) = @_ ; - if ((length $CandidateID) == 0) { - return 0 ; - } - if ($CandidateID =~ m/^[${ValidCandidateChar}]+$/o ) { - return 1 ; - } else { - return 0 ; - } -} - -sub ValidQId { - # Validate the scalar as a numeric greater than 0. - # A positive result does not mean the Question ID exists. - # Parameters - # $QuesId - Character String. - # Returns 1 for a valid string, 0 for invalid. - my ($QuesId ) = @_ ; - unless ($QuesId) { - return 0 ; - } - unless ($QuesId =~ m/^\d+$/ ) { - warn "Bad $QuesId QuesId" if ($InMem_Debug) ; - return 0 ; - } - unless ($QuesId > 0) { - warn "Bad $QuesId QuesId" if ($InMem_Debug) ; - return 0 ; - } - return 1 ; -} - -sub CreateClientSkeleton { - # Create a very minimal data structure for a client. - # Parameters - # $ClientID - Character String. - my ($ClientID ) = @_ ; - unless ($ClientID) { - die "Error: CreateClientSkeleton called with an empty ClientID" ; - } - unless (&ValidateClientStr($ClientID)) { - die "Error: CreateClientSkeleton called with an invalid ClientID character." - } - unless($GlobalData) { - $GlobalData = {'CLIENTS' => {}} ; - } - unless($GlobalData -> {'CLIENTS'} -> {$ClientID}) { - warn "Initialize $ClientID Client" if ($InMem_Debug) ; - $GlobalData -> {'CLIENTS'} -> {$ClientID} = {} ; - } - return 1 ; -} - -sub CreateCandidateSkeleton { - # Create a very minimal data structure for a candidate associated with a client. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - my ($ClientID, $CandidateID ) = @_ ; - unless ( &CreateClientSkeleton($ClientID) ) { - warn "Fail $ClientID, $CandidateID CreateCandidateSkeleton" if ($InMem_Debug) ; - return 0 ; - } - unless ($CandidateID) { - die "Error: CreateCandidateSkeleton called with an empty CandidateID" ; - } - unless ($CandidateID =~ m/^[${ValidCandidateChar}]+$/o ) { - die "Error: CreateCandidateSkeleton called with an invalid CandidateID character" . $CandidateID . "." ; - } - unless ($GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} ) { - $GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} = {} ; - warn "Initialize $CandidateID CandidateID" if ($InMem_Debug) ; - } - unless ($GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} -> {$CandidateID}) { - $GlobalData -> {'CLIENTS'} -> {$ClientID} -> {'CANDIDATES'} -> {$CandidateID} = {} ; - warn "Initialize $CandidateID CandidateID" if ($InMem_Debug) ; - } - return 1 ; -} - -sub GetClientsInMem { - # Return an array of the Client Names in Memory. - my @Clients ; - if ($GlobalData and $GlobalData -> {'CLIENTS'}) { - @Clients = keys %{$GlobalData -> {'CLIENTS'}} ; - } - return @Clients ; -} - -sub ImportAllClientIDs { - # Populate the data structure for all clients. - # Parameters - No input parms. - # Return 0 if there is a problem, 1 if all is OK. - my $ClientFile = $main::PATHS{'dataroot'} . $main::pathsep . "clients.dat" ; - my $line_cnt = 0 ; - my @field_ids = () ; -} - -sub CreateCanTestSkel { - # Create a very minimal data structure for a test taken by a candidate. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID) = @_ ; - unless ( &CreateCandidateSkeleton($ClientID, $CandidateID)) { - return 0 ; - } - unless (&ValidateTestIDStr ($TestID)) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'} ) { - warn "Initialize $ClientID, $CandidateID CandidateID Tests" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'} = {} ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} ) { - warn "Initialize $ClientID, $CandidateID CandidateID Tests" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} = {} ; - } - return 1 ; -} - -sub CreateCanTestTypeSkel { - # Create a very minimal data structure for a test type taken by a candidate. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType) = @_ ; - unless (&CreateCanTestSkel($ClientID, $CandidateID, $TestID)) { - return 0 ; - } - unless ($ValidTestTypes{$TestType}) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} ) { - warn "Initialize $ClientID, $CandidateID, $TestType TestType" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID} = {} ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType} ) { - warn "Initialize $ClientID, $CandidateID, $TestType TestType" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType} = {} ; - } - return 1 ; -} - -sub CreateCanTestTypeQIdSkel { - # Create a very minimal data structure for a Question in a test taken. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID) = @_ ; - unless (&CreateCanTestTypeSkel($ClientID, $CandidateID, $TestID, $TestType)) { - return 0 ; - } - unless (&ValidQId($QuesID)) { - return 0 ; - } - unless ($GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID} ) { - warn "Initialize $ClientID, $CandidateID, $TestType, $QuesID QuesID" if ($InMem_Debug) ; - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID} = {} ; - } - return 1 ; -} - -sub InsertQuesComment { - # Place a Comment in a data structure for a Question in a test taken. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # $Comment - A string. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID, $Comment) = @_ ; - unless (&CreateCanTestTypeQIdSkel($ClientID, $CandidateID, $TestID, $TestType, $QuesID)) { - return 0 ; - } - # Any Character string, even an empty string is valid. - unless ($Comment) { - $Comment = "" ; - } - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID}->{'Comment'} = $Comment ; - warn "Add Comment CLI $ClientID User $CandidateID Tst $TestID Type $TestType QID $QuesID Text $Comment X" ; - return 1 ; -} - -sub InsertQuesResp { - # Place a Text Response answer for a Question in a test taken in a data structure. - # Parameters - # $ClientID - Character String. - # $CandidateID - Character String. - # $TestID - Character String. - # $TestType - Character String, limited values. - # $QuesID - a one based integer. - # $Resp - A string. - # Return 1 for success, 0 for failure. - my ($ClientID, $CandidateID, $TestID, $TestType, $QuesID, $Resp) = @_ ; - unless (&CreateCanTestTypeQIdSkel($ClientID, $CandidateID, $TestID, $TestType, $QuesID)) { - return 0 ; - } - # Any Character string, even an empty string is valid. - unless ($Resp) { - $Resp = "" ; - } - $GlobalData->{'CLIENTS'}->{$ClientID}->{'CANDIDATES'}->{$CandidateID}->{'Tests'}->{$TestID}->{$TestType}->{$QuesID}->{'Resp'} = $Resp ; - # warn "Add Response CLI $ClientID User $CandidateID Tst $TestID Type $TestType QID $QuesID Text $resp X" ; - return 1 ; -} - -1 ; # End of a library perl file. - diff --git a/survey-nginx/cgi-bin/Integro3_ausco.pl.bu20131217 b/survey-nginx/cgi-bin/Integro3_ausco.pl.bu20131217 deleted file mode 100755 index 90d72daf8..000000000 --- a/survey-nginx/cgi-bin/Integro3_ausco.pl.bu20131217 +++ /dev/null @@ -1,1015 +0,0 @@ -#!/usr/bin/perl -# -# $Id: Integro3.pl,v 1.4 2006/05/04 20:55:48 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'; -require 'LikertData.pl' ; -require 'grepa.pm' ; - -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 ); - -&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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
".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 (defined $timestamp) { - $timestamp = "$timestamp

\n"; -} else { - $timestamp = "
\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, 0); -} elsif ($FORM{'reportname'} eq 'comments2') { - &CommentsReport($idlist, $timestamp, 1); -} elsif ($FORM{'reportname'} eq 'people') { - &KindsOfPeopleReport($idlist, $groups, $timestamp); -} elsif ($FORM{'reportname'} eq 'peoplesummary') { - &KindsOfPeopleSummary($idlist, $groups, $timestamp); -} elsif ($FORM{'reportname'} eq 'improvepie') { # Section 5 - Improvement Pie Chart - undef $idlist ; undef $groups ; - &ImprovementPieChart($idlist, $groups, $timestamp); -} elsif ($FORM{'reportname'} eq 'improvesummary') { # Section 5 - Improvement Summary - undef $idlist ; undef $groups ; - &ImprovementSummary($idlist, $groups, $timestamp); -} else { - &ReportChooser(); -} - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\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"; -} - -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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - my $organizationname = $CLIENT{'clnmc'}; - my $uberheader; - my $test; - if ($rptparams[0]) { - $test = $rptparams[0]; - } else { - $test = "SAS01"; - } - my ($tstid) = grep((/($test\S*)&/ && ($_=$1)),get_data("tests.$CLIENT{'clid'}")); - if (not $tstid) { - print HTMLHeader("Error! No Strategic Alignment Survey Found."); - print "

Error! No Strategic Alignment 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\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

\n"; - print "

Section 2

\n"; - print "

Section 3

\n"; - print "

Section 4

\n"; - print "

Section 5" ; - print "

\n"; - print "

General Reports

  • Comments
  • "; - print "
  • Comments by Category
  • "; - print "\n"; - print "\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 "
  • Question Statistics
  • \n"; - print ""; - 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'}; - my %intlc; - my %intla; - $intlc{'Purpose'} = "86"; - $intla{'Purpose'} = "88"; - $intlc{'Values'} = "77"; - $intla{'Values'} = "86"; - $intlc{'Vision'} = "72"; - $intla{'Vision'} = "78"; - $intlc{'Goals'} = "79"; - $intla{'Goals'} = "85"; - $intlc{'Procedures'} = "78"; - $intla{'Procedures'} = "71"; - $intlc{'Roles'} = "84"; - $intla{'Roles'} = "70"; - print HTMLHeaderPlain("Section 4 - Group Alignment Report"); - print "
    Strategic Alignment Survey
    Section 4 - Group Alignment Report


    \n"; - print "The Degree to which Group Members are in Alignment
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "". - "". - "". - "". - "". - "\n"; - # fill in the rows - my $overall = {'clarity' => 0, 'approval' => 0}; - foreach my $row (qw(Purpose Values Vision Goals Procedures Roles)) { - print ""; - for my $i (0..6) { - print ""; - } - printf "\n", $claritysum->{$row}->{'value'}; - printf "\n", $approvalsum->{$row}->{'value'}; - printf "\n", $intlc{$row}; - printf "\n", $intla{$row}; - print "\n"; - } - print "
        Very Unclear    Moderately Unclear    Moderately Clear    Very ClearGroup ClarityGroup ApprovalInt'l ClarityInt'l Approval
    $row"; - if ($histograms->{$row}->{'Clarity'}->[$i]) { - if ($histograms->{$row}->{'Approval'}->[$i]->[2]) { - print "". - "$histograms->{$row}->{'Approval'}->[$i]->[2]
    "; - } - if ($histograms->{$row}->{'Approval'}->[$i]->[1]) { - print "". - "$histograms->{$row}->{'Approval'}->[$i]->[1]
    "; - } - if ($histograms->{$row}->{'Approval'}->[$i]->[0]) { - print "". - "$histograms->{$row}->{'Approval'}->[$i]->[0]"; - } - } else { - print " "; - } - print "
    %.1f %%%.1f %%%.1f %%%.1f %%
    \n

    Position = Group Clarity

    \n

    Countenance = Personal Approval

    \n"; - print HTMLFooter(); -} - -sub CommEffectSummary { - my ($idlist,$groups,$timestamp) = @_; - my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my @cols = ("Purpose","Values","Vision","Goals","Procedures","Roles"); - $groups = getGroups($CLIENT{'clid'}); - print HTMLHeaderPlain("Section 4 - Group Alignment Summary"); - print "
    Strategic Alignment Survey
    Section 4 - Group Alignment Summary


    \n"; - print "The Degree to which Group Members are in Alignment
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print ""; - foreach my $col (@cols) { - printf "", $data->{'organization'}->{'claritysum'}->{$col}->{'value'}; - printf "", $data->{'organization'}->{'approvalsum'}->{$col}->{'value'}; - } - if (exists $data->{'groups'}) { - print "\n"; - print ""; - foreach my $col (@cols) { - print ""; - } - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - foreach my $col (@cols) { - printf "", $data->{'groups'}->{$grp}->{'claritysum'}->{$col}->{'value'}; - printf "", $data->{'groups'}->{$grp}->{'approvalsum'}->{$col}->{'value'}; - } - print "\n"; - } - } - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - print "
     $col
     ClarityApproval
    Overall%.1f %%%.1f %%
    Group Breakdown
    Group$col
    $groups->{$grp}->{'grpnme'}%.1f %%%.1f %%
    International
    Average
    $col
    86%88%77%86%72%78%79%85%78%71%84%70%
    \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 "
    Strategic Alignment Survey
    Section 2 - Group Trust Level Report


    \n"; - print "$xlatphrase[801]
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=Low::::Medium::::High&title=Trust%20Level&ylabel=Respondents"; - $baseurl .= "&xdim=400&ydim=100"; - my %intl; - $intl{'Congruence'} = "66"; - $intl{'Openness'} = "69"; - $intl{'Acceptance'} = "73"; - $intl{'Reliability'} = "79"; - foreach my $row (qw(Congruence Openness Acceptance Reliability)) { - print ""; - print ""; - printf "\n", $trust->{$row}->{'value'}; - printf "\n", $intl{$row}; - } - print "
      Group Trust LevelInt'l Average
    $row{$row}})."\">%.1f%% %.1f%%
    \n"; - #printf "

    Overall Group Trust Level = %.1f %%.

    \n",$data->{'organization'}->{'overalltrust'}; - print HTMLFooter(); -} - -sub TrustLevelSummary { - my ($idlist,$groups,$timestamp) = @_; - my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my @cols = ("Congruence","Openness","Acceptance","Reliability"); - $groups = getGroups($CLIENT{'clid'}); - print HTMLHeaderPlain("Section 2 - Group Trust Level Summary"); - print "
    Strategic Alignment Survey
    Section 2 - Group Trust Level Summary


    \n"; - print "$xlatphrase[801]
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[800]
    \n"; - } - print $timestamp; - print "\n"; - print ""; - } - print "\n"; - print ""; - foreach my $col (@cols) { - printf "", $data->{'organization'}->{'trust'}->{$col}->{'value'}; - } - print "\n"; - if (exists $data->{'groups'}) { - print "\n"; - print ""; - foreach my $col (@cols) { - print ""; - } - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - foreach my $col (@cols) { - printf "", $data->{'groups'}->{$grp}->{'trust'}->{$col}->{'value'}; - } - } - print "\n"; - } - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - print "
     "; - foreach my $col (@cols) { - print "$col
    Overall%.1f %%
    Group Breakdown
    Group$col
    $groups->{$grp}->{'grpnme'}%.1f %%
    International
    Average
    $col
    66%69%73%79%
    \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 "
    Strategic Alignment Survey
    Section 3 - Values That Build Trust


    \n"; - print "The gap between Employee Expectation and the degree to
    which the $xlatphrase[797] operates by these Values

    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - printf "
    Your Trust Values Gap Score is %.1f",$data->{'organization'}->{'gap'}; - #print "
    World Class Standard ?
    International Benchmark ?
    "; - print "
    \n"; - print "

    \n"; - print "The graphs below show the Personal Importance and Perceptions of Work Performance". - " for each of the eight values."; - print "\n"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Importance:Work%20Performance". - "&xdim=500&ydim=60&hbar=1&ymax=11&ymin=0&yticknum=11"; - my %intl; - $intl{'Straightforwardness'} = "2.0"; - $intl{'Honesty'} = "1.7"; - $intl{'Receptivity'} = "1.6"; - $intl{'Disclosure'} = "1.8"; - $intl{'Respect'} = "1.8"; - $intl{'Recognition'} = "2.2"; - $intl{'Seeks Excellence'} = "1.5"; - $intl{'Keeps Commitments'} = "1.9"; - 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 "\n"; - print "\n"; - } - print ""; - printf "", $data->{'organization'}->{'gap'}; - print "\n"; - print "
     GapInt'l
    Avg
    $_
    $diff$intl{$_}
    Total Trust Values Gap%.1f13.8
    \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 "

    Strategic Alignment Survey
    Section 3 - Values That Build Trust Summary


    \n"; - print "The gap between Employee Expectation and the degree to
    which the $xlatphrase[797] operates by these Values

    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - print "\n"; - print ""; - printf "", $data->{'organization'}->{'Personal Importance'}; - printf "", $data->{'organization'}->{'Work Performance'}; - printf "\n", $data->{'organization'}->{'gap'}; - if (exists $data->{'groups'}) { - print "\n"; - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - printf "", $data->{'groups'}->{$grp}->{'Personal Importance'}; - printf "", $data->{'groups'}->{$grp}->{'Work Performance'}; - printf "\n", $data->{'groups'}->{$grp}->{'gap'}; - } - } - print "\n"; - print ""; - printf "", 74.6; - printf "", 60.8; - printf "\n", 13.8; - print "
     Total ImportanceTotal PerformanceTrust Values Gap
    Overall%.1f%.1f%.1f
    Group Breakdown
    GroupTotal ImportanceTotal PerformanceTrust Values Gap
    $groups->{$grp}->{'grpnme'}%.1f%.1f%.1f
     Total ImportanceTotal PerformanceTrust Values Gap
    International Average%.1f%.1f%.1f
    \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 "
    Strategic Alignment Survey
    Section 1 - Kinds of People


    \n"; - print "$xlatphrase[802]
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print ""; - my $url; - #if (exists $data->{'self'}) { - if (0) { - 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 "\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 "\n"; - print "
    \n"; - print "

    \n"; - print "\n"; - printf "\n", $data->{'organization'}->{'Rebellious'}; - printf "\n", $data->{'organization'}->{'Compliant'}; - printf "\n", $data->{'organization'}->{'Self-Directed'}; - print "
    Overall Group ValuesInt'l Average
    Rebellious%.1f %%11%
    Compliant%.1f %%27%
    Self-Directed%.1f %%62%
    \n"; - } else { - print "

    No valid Data

    \n"; - } - #print "
    ".Dumper($data)."
    \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 "
    Strategic Alignment Survey
    Section 1 - Kinds of People Summary


    \n"; - print "$xlatphrase[802]
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - print "\n"; - print ""; - printf "", $data->{'organization'}->{'Rebellious'}; - printf "", $data->{'organization'}->{'Compliant'}; - printf "\n", $data->{'organization'}->{'Self-Directed'}; - if (exists $data->{'groups'}) { - print "\n"; - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - printf "\n", $data->{'groups'}->{$grp}->{'Rebellious'}; - printf "\n", $data->{'groups'}->{$grp}->{'Compliant'}; - printf "\n", $data->{'groups'}->{$grp}->{'Self-Directed'}; - } - } - print "\n"; - print "\n"; - print "
     RebelliousCompliantSelf-Directed
    Overall%.1f %%%.1f %%%.1f %%
    Group Breakdown
    GroupRebelliousCompliantSelf-Directed
    $groups->{$grp}->{'grpnme'}%.1f %%%.1f %%%.1f %%
     RebelliousCompliantSelf-Directed
    International Average11%27%62%
    \n"; - print HTMLFooter(); - -} - -sub CommentsReport { - my ($idlist, $timestamp, $bycat) = @_; - my @filelist = &get_test_result_files($testcomplete, $CLIENT{'clid'},$TEST{'id'}); - my @comments; - for (my $i=0; $i<=60; $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]; - } - # if ($usercomm->[59]) { - # push @{$comments[59]},"Comments 59 test\n", $usercomm->[59]; - # } - # if ($answers->[60]) { - # push @{$comments[60]},"Answers 60\n", $answers->[60]; - # } - if ($usercomm->[60]) { - push @{$comments[60]}, $usercomm->[60]; - } - } - print HTMLHeaderPlain("Comments Report"); - print "
    Strategic Alignment Survey
    Comments Report


    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "
    \n"; - print "
    \n"; - - my @outary = (); - for (my $i=1; $i <=60; $i++) { - if ($comments[$i] == -1) { - # inactive question - next; - } - $outary[$i] = "
    \n"; - $outary[$i] .= "$questions[$i]->[0] - $questions[$i]->[4]

    \n"; - if (@{$comments[$i]}) { - $outary[$i] .= "

      \n"; - foreach (@{$comments[$i]}) { - $outary[$i] .= "
    • $_
    • \n"; - } - $outary[$i] .= "
    \n"; - } else { - $outary[$i] .= "
    • No Comments
    \n"; - } - $outary[$i] .= "
    \n"; - } - - # Read in .rgo file which defines question presentation order - my $out; - my $lookupfile = join($pathsep,$dataroot,"IntegroSAS.rgo"); - if ($bycat && -e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - $out = ""; - my @lines = <$fh>; - $fh->close(); - shift @lines; - foreach (@lines) { - chomp; - my @line = split(/\&/,$_); - my $section = shift @line; - if ($section ne "") { - $out .= "
    \n"; - $out .= "$section\n"; - } - foreach my $sub (@line) { - my ($subheader, $quess) = split(/:/,$sub); - if ($subheader ne "") { - $out .= "
    $subheader:\n"; - } - my @ques = split(/\,/,$quess); - foreach my $quesid (@ques) { - $out .= $outary[$quesid]; - } - } - } - print $out; - } - } else { - for (1 .. $#outary) { - print $outary[$_]; - } - } - - print "
    \n"; - print "
    \n"; - #print "
    ".Dumper(\@questions,\@comments)."
    \n"; - print "
    ".HTMLFooter(); -} - - -# The original request was for a pie chart of all -# of the answers on the last question. I wrote the survey, -# so the question is a Likert Scale question that uses a value of -# "Improvement" for its super category. This function generates the -# report on the Improvement super category regardless of the -# question number. -# This version of the subroutine will have one 3-D piechart with a legend. -# It will have a table with three columns for each -# type: Name, Description, and Percentage. -sub ImprovementPieChart { - my ($idlist,$groups,$timestamp) = @_; - # warn "idlist $idlist .\n" ; - # warn "idlist keys " . join (" ",keys (%$idlist)) . ".\n" ; - # warn "groups $groups .\n" ; - # warn "groups keys " . join (" ",keys (%$groups)) . ".\n" ; - # warn "timestamp $timestamp .\n" ; - # warn "Client $CLIENT{'clid'} .\n" ; - # warn "Test Id $TEST{'id'} .\n" ; - # warn "Form Test Id $FORM{'tstid'} .\n" ; - my $data ; - my $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - my %Categories = () ; my $resp ; - # Client said he wanted to ignore the data for non-responding candidates, and "Not here last year" Candidates. - # $Categories{'NoResponse'} = $$data{'Improvement'}->{'NoResponses'} ; - # The Scores, and meanings. - # 2 - Disagree - # 3 - Somewhat Disagree - # 4 - Somewhat Agree - # 5 - Agree - # 1 - Unable to answer since I was not at ausco last year. - my $mystery = $data->{'Improvement'}->{'ScoreCount'} ; # Should be a reference to a hash. - # warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ; - foreach $resp ( keys %$mystery ) { - # each response score. - $Categories{$resp} = $data->{'Improvement'}->{'ScoreCount'}->{$resp} ; - } - # print HTMLHeaderPlain("Section 5 - Improvement Piechart"); - print HTMLHeaderPlain("Strategic Alignment Survey"); - print "
    " ; - print "Strategic Alignment Survey
    " ; - # print "The percentage of employees at each level of Improvement at Ausco

    \n"; - print "" ; - print "Positive Changes at Ausco

    \n"; - # print "
    \n" ; - print "$FORM{'orgname'}
    \n"; - - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - - my (@values , @Labels , $url, $mykey, @scores, $total) ; - $total = 0 ; - # @Labels = sort keys %Categories ; - @Labels = ("Disagree", "Somewhat Disagree", - "Somewhat Agree", "Agree") ; - foreach $mykey (sort keys %Categories) { - unless($mykey==1) { # We will not count the "Not here last year" response. - push @scores,$Categories{$mykey} ; - $total += $Categories{$mykey} ; - } - } - if ($total) { - @values = map ((100 * $_ / $total),@scores ) ; - } else { - # $total is zero. (Do not divide by zero.) - @values = @scores ; - } - $url = "/cgi-bin/piechart4.pl?values=" . - join(':',map(int($_+0.5),grepa(\@values,\@values))) . - # "&labels=" . - "&xdim=800&ydim=200" . - "&labels=" . join(":",grepa(\@values,\@Labels)) ; - # "&xdim=200&ydim=100&nolegend=1" ; - print "

    \n" ; - print "" ; - print "

    \n" ; - print ""; - # I just need to add the colors to each graph. - # The selected colors are "lred", "lorange", "lyellow", "lgreen", "lblue" - # The deselected colors are "dred", "dbrown", "dyellow", "dgreen", "dblue" - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Finish the Table and the page. - print "
    Disagree\n" ; - print " there have been positive changes at Ausco in the last year.\n"; - print "\n" ; - printf " %.1f", $values[0] ; - print " %" ; - print "
    Somewhat disagree\n" ; - print " there have been positive changes at Ausco in the last year.\n" ; - print "\n" ; - printf " %.1f", $values[1] ; - print " %" ; - print "
    Somewhat agree\n" ; - print " there have been positive changes at Ausco in the last year.\n" ; - print "\n" ; - printf " %.1f", $values[2] ; - print " %" ; - print "
    Agree\n" ; - print " there have been positive changes at Ausco in the last year.\n" ; - print "\n" ; - printf " %.1f", $values[3] ; - print " %" ; - print "
    \n"; - print "

    \n"; - print HTMLFooter(); -} # End ImprovementPieChart - -sub ImprovementSummary { - # This does the Summary on the Improvement Likert Scale, - # for everybody, and all of the Groups. - my ($idlist,$groups,$timestamp) = @_; - $groups = getGroups($CLIENT{'clid'}) ; - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$groups) ; - - # print HTMLHeaderPlain("Section 5 - Improvement Summary"); - print HTMLHeaderPlain("Strategic Alignment Survey"); - print "
    " ; - print "Strategic Alignment Survey
    " ; - print "Positive Changes at Ausco Summary


    \n"; - # print "Improvement as Perceived by Employees
    \n"; - # print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - # Print First Row, Some elements span 2 rows. - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - # Print Second Row of headers. - print "" ; - my $i ; - for ($i = 1; $i <= 6; $i ++) { print "" ; } - print "\n" ; - - # print ""; print keys %{$sumdata} ; print "\n" ; - # print ""; print keys %{$sumdata->{'Improvement'}} ; print "\n" ; - # print ""; print keys %{$sumdata->{'Improvement'}->{'ScoreCount'}} ; print "\n" ; - # Print row for overall values. - my $total = $sumdata->{'Improvement'}->{'NoResponses'}+$sumdata->{'Improvement'}->{'Responses'} ; - print ""; - print &rep_cell_str($sumdata->{'Improvement'}->{'ScoreCount'}->{2} , $total) ; # Disagree - print &rep_cell_str($sumdata->{'Improvement'}->{'ScoreCount'}->{3} , $total) ; # Somewhat Disagree - print &rep_cell_str($sumdata->{'Improvement'}->{'ScoreCount'}->{4} , $total) ; # Somewhat Agree - print &rep_cell_str($sumdata->{'Improvement'}->{'ScoreCount'}->{5} , $total) ; # Agree - print &rep_cell_str($sumdata->{'Improvement'}->{'NoResponses'} , $total) ; # No Response - print &rep_cell_str($sumdata->{'Improvement'}->{'ScoreCount'}->{1} , $total) ; # Not Here Last Year. - printf "", $total ; # Total test takers. - print "\n" ; - - # loop for groups. - my $group ; - foreach $group (sort keys %{$groups}) { - $total = $grpdata->{$group}->{'Improvement'}->{'NoResponses'}+$grpdata->{$group}->{'Improvement'}->{'Responses'} ; # Total test takers. - print ""; - print &rep_cell_str($grpdata->{$group}->{'Improvement'}->{'ScoreCount'}->{2} , $total) ; # Disagree - print &rep_cell_str($grpdata->{$group}->{'Improvement'}->{'ScoreCount'}->{3} , $total) ; # Somewhat Disagree - print &rep_cell_str($grpdata->{$group}->{'Improvement'}->{'ScoreCount'}->{4} , $total) ; # Somewhat Agree - print &rep_cell_str($grpdata->{$group}->{'Improvement'}->{'ScoreCount'}->{5} , $total) ; # Agree - print &rep_cell_str($grpdata->{$group}->{'Improvement'}->{'NoResponses'} , $total) ; # No Response - print &rep_cell_str($grpdata->{$group}->{'Improvement'}->{'ScoreCount'}->{1} , $total) ; # Not Here Last Year. - printf "", $grpdata->{$group}->{'Improvement'}->{'NoResponses'}+$grpdata->{$group}->{'Improvement'}->{'Responses'} ; # Total test takers. - print "\n" ; - } - print "
    GroupDisagreeSomewhat DisagreeSomewhat AgreeAgreeNo ResponseNot Here Last YearTotal
    CountPercent
    Overall%4i
    $group%4i
    \n" ; - - print HTMLFooter(); -} - -sub rep_cell_str { - # Parameters - # $count - required, number for the cell, integer. - # $total - dividend for the percent, integer. - # Returned Value - # $html_str - html string to print for the cell. - my ($count, $total) = @_ ; - my $html_str = "" ; - my ($percent, $percent_str, $count_str) ; - $count_str = sprintf("%4i", $count) ; - if ($total == 0) { - # total is 0, percent is undefined. - $percent_str = "-   - %" ; - } else { - $percent = 100.0 * $count / $total ; - $percent_str = sprintf("%5.1f %%", $percent) ; - } - # $html_str .= sprintf("%4i", $count) ; - # $html_str .= "" ; - # $html_str .= "" ; - $html_str .= "" ; - # $html_str .= "
    - $html_str .= "$count_str" ; - $html_str .= "$percent_str
    " ; - # $html_str .= "\n" ; - return $html_str ; -} - - diff --git a/survey-nginx/cgi-bin/IntegroLib.pm.bu20100610 b/survey-nginx/cgi-bin/IntegroLib.pm.bu20100610 deleted file mode 100755 index 17920571b..000000000 --- a/survey-nginx/cgi-bin/IntegroLib.pm.bu20100610 +++ /dev/null @@ -1,503 +0,0 @@ -package IntegroLib; - -# A collection of functions used for custom reports for Integro. -# Most data processing functions. -# -# $Id: IntegroLib.pm,v 1.5 2005/10/31 17:03:34 ddoughty Exp $ - -use FileHandle; -use Time::Local; -use Data::Dumper; - -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 ); -require 'sitecfg.pl'; -require 'testlib.pl'; -require 'tstatlib.pl'; - -require Exporter; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); -@ISA = qw(Exporter); -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. -@EXPORT = qw(get_survey_results CommEffectData TrustLevelData ValuesData diversityData KindsOfPeopleData); -@EXPORT_OK = qw(); -$VERSION = '0.01'; - -sub get_survey_results { - my ($client,$user,$test) = @_; - &main::get_test_sequence_for_reports($client,$user,$test); - #print STDERR Dumper(\%SUBTEST_RESPONSES,\%SUBTEST_QUESTIONS); - my (@answers,$i,@comments,@responses); - foreach (split(/\&/,$main::SUBTEST_RESPONSES{2})) { - my ($response,$comment) = split(/::/,$_); - push @responses, $response; - push @comments, $comment; - } - for ($i = 1; $i<=69; $i++) { - ($responses[$i] =~ /^\D*(\d+)/); - $answers[$i] = $1; - # Also need to get comments - } - if ($main::SUBTEST_QUESTIONS{2} =~ /\.057/) { - ($responses[57] =~ /^\D*(\d+)/); - $answers[57] = $1; - } else { - # Question 57 is suppressed in this survey - # Shift the last two questions to their - # correct position, and flag 57 - $comments[60] = $comments[59]; - $comments[59] = $comments[58]; - $comments[58] = $comments[57]; - $comments[57] = -1; - $responses[60] = $responses[59]; - $responses[59] = $responses[58]; - $responses[58] = $responses[57]; - $answers[57] = -1; - } - my ($slug,$steady,$energetic) = (5,5,5); - my @tmp = split(/\?/,$responses[58]); - for ($i = 1; $i<= 60; $i+=3) { - #print STDERR "$i - $tmp[$i] - $slug,\n"; - if ($tmp[$i] =~ /\d+/) { - last; - } else { - $slug += 5; - } - } - if ($slug == 105) {$slug = 0;} - foreach ($i = 2; $i<= 60; $i+=3) { - #print STDERR "$i - $tmp[$i] - $steady\n"; - if ($tmp[$i] =~ /\d+/) { - last; - } else { - $steady += 5; - } - } - if ($steady == 105) {$steady = 0;} - foreach ($i = 3; $i<= 60; $i+=3) { - #print STDERR "$i - $tmp[$i] - $energetic\n"; - if ($tmp[$i] =~ /\d+/) { - last; - } else { - $energetic += 5; - } - } - if ($energetic ==105) {$energetic = 0;} - if (($slug + $steady + $energetic) == 100) { - $answers[58] = [$slug,$steady,$energetic]; - } else { - #print STDERR "$slug, $steady, $energetic\n"; - $answers[58] = undef; - } - $answers[59] = $responses[59]; - #print STDERR Dumper(\@answers); - if (wantarray) { - return (\@answers,\@comments); - } else { - return \@answers; - } -} - -sub CommEffectData { - my ($client,$testid,$idlist,$groups) = @_; - my $grpMembership = &main::getGroupMemberships($client); - my $config = {'Purpose' => {'Clarity' => [17,25], - 'Approval' => [21,29]}, - 'Values' => {'Clarity' => [19,27], - 'Approval' => [23,31]}, - 'Vision' => {'Clarity' => [18,33], - 'Approval' => [22,37]}, - 'Goals' => {'Clarity' => [26,34], - 'Approval' => [30,38]}, - 'Procedures' => {'Clarity' => [20,35], - 'Approval' => [24,39]}, - 'Roles' => {'Clarity' => [28,36], - 'Approval' => [32,40]} - }; - #my (%histograms,$claritysum,$approvalsum); - my $res; - foreach (keys %$config) { - @{$res->{'organization'}->{'histogram'}->{$_}->{'Clarity'}} = (0,0,0,0,0,0,0); - foreach my $i (0..6) { - @{$res->{'organization'}->{'histogram'}->{$_}->{'Approval'}->[$i]} = (0,0,0); - } - } - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; - $user =~ s/^$client.//; - if (defined $idlist and not $idlist->{$user}) { - next; - } - my $answers = &get_survey_results( $client, $user, $testid); - foreach (keys %$config) { - my ($clarity, $approval); - if (defined $answers->[$config->{$_}->{'Clarity'}->[0]] and - defined $answers->[$config->{$_}->{'Clarity'}->[1]] and - defined $answers->[$config->{$_}->{'Approval'}->[0]] and - defined $answers->[$config->{$_}->{'Approval'}->[1]]) { - $clarity = $answers->[$config->{$_}->{'Clarity'}->[0]] + - $answers->[$config->{$_}->{'Clarity'}->[1]]; - $res->{'organization'}->{'histogram'}->{$_}->{'Clarity'}->[$clarity]++; - $res->{'organization'}->{'claritysum'}->{$_}->{'number'}++; - $res->{'organization'}->{'claritysum'}->{$_}->{'value'} += $clarity; - $approval = $answers->[$config->{$_}->{'Approval'}->[0]] + - $answers->[$config->{$_}->{'Approval'}->[1]]; - $res->{'organization'}->{'approvalsum'}->{$_}->{'number'}++; - $res->{'organization'}->{'approvalsum'}->{$_}->{'value'} += $approval; - my $approvalhist; - if ($approval < 3) {$approvalhist = 0;} - elsif ($approval < 5) {$approvalhist = 1;} - else {$approvalhist = 2;} - $res->{'organization'}->{'histogram'}->{$_}->{'Approval'}->[$clarity]->[$approvalhist]++; - #if () { - if ($grpMembership and exists $grpMembership->{$user}) { - foreach my $group (@{$grpMembership->{$user}}) { - if (defined $idlist and not exists $groups->{$group}) { - # a subset of groups was chosen, and this group is not in that list - next; - } - if (not exists $res->{'groups'}->{$group}) { - foreach my $conf (keys %$config) { - @{$res->{'groups'}->{$group}->{'histogram'}->{$conf}->{'Clarity'}} = (0,0,0,0,0,0,0); - foreach my $i (0..6) { - @{$res->{'groups'}->{$group}->{'histogram'}->{$conf}->{'Approval'}->[$i]} = (0,0,0); - } - } - } - $res->{'groups'}->{$group}->{'histogram'}->{$_}->{'Clarity'}->[$clarity]++; - $res->{'groups'}->{$group}->{'histogram'}->{$_}->{'Approval'}->[$clarity]->[$approvalhist]++; - $res->{'groups'}->{$group}->{'claritysum'}->{$_}->{'number'}++; - $res->{'groups'}->{$group}->{'claritysum'}->{$_}->{'value'} += $clarity; - $res->{'groups'}->{$group}->{'approvalsum'}->{$_}->{'number'}++; - $res->{'groups'}->{$group}->{'approvalsum'}->{$_}->{'value'} += $approval; - } - } - } - } - } - my @groups = ($res->{'organization'}); - if (exists $res->{'groups'}) {push @groups, values(%{$res->{'groups'}});} - foreach my $group (@groups) { - my ($count,$claritytot,$approvaltot) = (scalar(keys(%{$group->{'claritysum'}})),0,0); - foreach (values %{$group->{'claritysum'}}) { - $_->{'value'} = 100*$_->{'value'}/(6*$_->{'number'}); - $claritytot += $_->{'value'}; - } - foreach (values %{$group->{'approvalsum'}}) { - $_->{'value'} = 100*$_->{'value'}/(6*$_->{'number'}); - $approvaltot += $_->{'value'}; - } - $group->{'overallclarity'} = ($count ? $claritytot/$count : undef); - $group->{'overallapproval'} = ($count ? $approvaltot/$count : undef); - } - #print STDERR Dumper($res); - return $res; -} - -sub TrustLevelData { - my ($client,$testid,$idlist,$groups) = @_; - my $grpMembership = &main::getGroupMemberships($client); - my %reversed = (2 => 1, 13 => 1, 15 => 1); - my %config = ('Openness' => [1,5,9,13], - 'Congruence' => [2,6,10,14], - 'Acceptance' => [3,7,11,15], - 'Reliability' => [4,8,12,16] - ); - my ($res,%defhistograms); - @defhistograms{keys(%config)} = ([0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0]); - @{$res->{'organization'}->{'histogram'}}{keys(%config)} = ([0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0]); - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; - $user =~ s/^$client.//; - if (defined $idlist and not $idlist->{$user}) { - next; - } - my $answers = &get_survey_results( $client, $user, $testid); - CONFIG: foreach (keys %config) { - my $value; - foreach my $i (@{$config{$_}}) { - if (not defined $answers->[$i]) { - # We are missing a response in one of the data points for this category, - # skip the category for this canidate. - $value = 0; - next CONFIG; - } - if (exists $reversed{$i}) { - $value += (4 - $answers->[$i]); - } else { - $value += $answers->[$i]; - } - } - $res->{'organization'}->{'trust'}->{$_}->{'number'}++; - #print STDERR "$_: ($res->{'organization'}->{'trust'}->{$_}->{'number'}, $value => "; - my $hvalue = $value - 4; - $res->{'organization'}->{'trust'}->{$_}->{'value'}+=$value; - if ($hvalue < 0) {$hvalue = 0;} - if ($hvalue > 8) {$hvalue = 8}; - $res->{'organization'}->{'histogram'}->{$_}->[$hvalue]++; - if ($grpMembership and exists $grpMembership->{$user}) { - # it isn't clear what by group breakout should be - # when the reports are limited by groups, so skip it. - foreach my $group (@{$grpMembership->{$user}}) { - if (defined $idlist and not exists $groups->{$group}) { - # a subset of groups was chosen, and this group is not in that list - next; - } - if (not exists $res->{'groups'}->{$group}) { - @{$res->{'groups'}->{$group}->{'histogram'}}{keys(%config)} = ([0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0], - [0,0,0,0,0,0,0,0,0]); - } - $res->{'groups'}->{$group}->{'trust'}->{$_}->{'number'}++; - $res->{'groups'}->{$group}->{'trust'}->{$_}->{'value'}+=$value; - $res->{'groups'}->{$group}->{'histogram'}->{$_}->[$hvalue]++; - } - } - $value = 0; - $hvalue = 0; - } - } - #print STDERR Dumper($res->{'organization'}); - my @groups = ($res->{'organization'}); - if (exists $res->{'groups'}) {push @groups, values(%{$res->{'groups'}});} - foreach my $group (@groups) { - my ($count,$overall) = (scalar(keys(%{$group->{'trust'}})),0); - foreach (values %{$group->{'trust'}}) { - #print STDERR "($_->{'value'}, $_->{'number'})\n"; - $_->{'value'} = 100*$_->{'value'}/(16*$_->{'number'}); - $overall += $_->{'value'}; - } - $group->{'overalltrust'} = ($count ? $overall/$count : undef); - } - #print STDERR Dumper($res->{'organization'}); - return $res; -} - -sub ValuesData { - my ($client,$testid,$idlist,$groups) = @_; - my $grpMembership = &main::getGroupMemberships($client); - #print STDERR Dumper( $grpMembership ); - #my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - my %config ; - if ($testid eq "passion") { - %config = ('Straightforwardness' => 21, - 'Honesty' => 23, - 'Receptivity' => 25, - 'Disclosure' => 27, - 'Respect' => 29, - 'Recognition' => 31, - 'Seeks Excellence' => 33, - 'Keeps Commitments' => 35, - ); - } else { - %config = ('Straightforwardness' => 41, - 'Honesty' => 43, - 'Receptivity' => 45, - 'Disclosure' => 47, - 'Respect' => 49, - 'Recognition' => 51, - 'Seeks Excellence' => 53, - 'Keeps Commitments' => 55, - ); - } - # data is stored [Personal Importance, Work Performance] - my %levels = map(($_ => [0,0]), keys(%config)); - my %count = map(($_ => 0), keys(%config)); # number of responses - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - my $res = {}; - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; - $user =~ s/^$client.//; - if (defined $idlist and not $idlist->{$user}) { - next; - } - my $answers = &get_survey_results( $client, $user, $testid); - foreach (keys %config) { - if (not defined $answers->[$config{$_}] or not defined $answers->[$config{$_}+1]) { - next; - } - $res->{'organization'}->{$_}->{'count'}++; - $res->{'organization'}->{$_}->{'Personal Importance'} += $answers->[$config{$_}]+1; - $res->{'organization'}->{$_}->{'Work Performance'} += $answers->[$config{$_}+1]+1; - if ($grpMembership and exists $grpMembership->{$user}) { - # it isn't clear what by group breakout should be - # when the reports are limited by groups, so skip it. - foreach my $group (@{$grpMembership->{$user}}) { - if (defined $idlist and not exists $groups->{$group}) { - # a subset of groups was chosen, and this group is not in that list - next; - } - $res->{'groups'}->{$group}->{$_}->{'count'}++; -#my $bob = $answers->[$config{$_}]+1; -#print STDERR "User: $user Group: $group Value: $_ Answer: $bob\n"; - $res->{'groups'}->{$group}->{$_}->{'Personal Importance'} += $answers->[$config{$_}]+1; - $res->{'groups'}->{$group}->{$_}->{'Work Performance'} += $answers->[$config{$_}+1]+1; - } - } - } - } - my @tmp = ($res->{'organization'}); - if (exists $res->{'groups'}) {push @tmp, values(%{$res->{'groups'}});} - foreach my $grp (@tmp) { - foreach (keys %config) { - if (not $grp->{$_}->{'count'}) {next;} - $grp->{$_}->{'Personal Importance'} /= $grp->{$_}->{'count'}; - $grp->{$_}->{'Work Performance'} /= $grp->{$_}->{'count'}; - $grp->{'Personal Importance'} += $grp->{$_}->{'Personal Importance'}; - $grp->{'Work Performance'} += $grp->{$_}->{'Work Performance'}; - $grp->{'gap'} += $grp->{$_}->{'Personal Importance'} - $grp->{$_}->{'Work Performance'}; - } - } - return $res; -} - -sub diversityData { - my ($client,$testid,$idlist,$groups) = @_; -# warn "diversityData called" ; # HBI Debug - my $grpMembership = &main::getGroupMemberships($client); - #print STDERR Dumper( $grpMembership ); - #my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - my %config = ('Respectfulness' => 60, - 'Speaking Up' => 62, - 'Divergent Thinking' => 64, - 'Freedom from Harassment' => 66, - 'Fairness of Decisions' => 68 - ); - # data is stored [Personal Importance, Work Performance] - my %levels = map(($_ => [0,0]), keys(%config)); - my %count = map(($_ => 0), keys(%config)); # number of responses - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - my $res = {}; - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; - $user =~ s/^$client.//; - if (defined $idlist and not $idlist->{$user}) { - next; - } - my $answers = &get_survey_results( $client, $user, $testid); - foreach (keys %config) { - if (not defined $answers->[$config{$_}] or not defined $answers->[$config{$_}+1]) { - next; - } - $res->{'organization'}->{$_}->{'count'}++; - $res->{'organization'}->{$_}->{'Personal Importance'} += $answers->[$config{$_}]+1; - $res->{'organization'}->{$_}->{'Work Performance'} += $answers->[$config{$_}+1]+1; - if ($grpMembership and exists $grpMembership->{$user}) { - # it isn't clear what by group breakout should be - # when the reports are limited by groups, so skip it. - foreach my $group (@{$grpMembership->{$user}}) { - if (defined $idlist and not exists $groups->{$group}) { - # a subset of groups was chosen, and this group is not in that list - next; - } - $res->{'groups'}->{$group}->{$_}->{'count'}++; -#my $bob = $answers->[$config{$_}]+1; -#print STDERR "User: $user Group: $group Value: $_ Answer: $bob\n"; - $res->{'groups'}->{$group}->{$_}->{'Personal Importance'} += $answers->[$config{$_}]+1; - $res->{'groups'}->{$group}->{$_}->{'Work Performance'} += $answers->[$config{$_}+1]+1; - } - } - } - } - my @tmp = ($res->{'organization'}); - if (exists $res->{'groups'}) {push @tmp, values(%{$res->{'groups'}});} - foreach my $grp (@tmp) { - foreach (keys %config) { - if (not $grp->{$_}->{'count'}) {next;} - $grp->{$_}->{'Personal Importance'} /= $grp->{$_}->{'count'}; - $grp->{$_}->{'Work Performance'} /= $grp->{$_}->{'count'}; - $grp->{'Personal Importance'} += $grp->{$_}->{'Personal Importance'}; - $grp->{'Work Performance'} += $grp->{$_}->{'Work Performance'}; - $grp->{'gap'} += $grp->{$_}->{'Personal Importance'} - $grp->{$_}->{'Work Performance'}; - } - } - return $res; -} - -sub KindsOfPeopleData { - my ($client,$testid,$idlist,$groups) = @_; - my $grpMembership = &main::getGroupMemberships($client); - #print STDERR Dumper( $grpMembership ); - my @filelist = &main::get_test_result_files($main::testcomplete,$client,$testid); - my $res = {'self' =>{}}; - $res->{'self'}->{'count'} = 0; - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/\.$testid$//; - $user =~ s/^$client\.//; - #print STDERR " $user\n"; - my $answers = &get_survey_results( $client, $user, $testid); - if (defined $idlist and not $idlist->{$user}) { - #print STDERR "Skipping $user\n"; - next; - } - $res->{'Number of Surveys'}++; - #print STDERR Dumper($answers); - if (exists $res->{'self'} and defined $answers->[57] ) { -#print STDERR "BOOOO:$user:$answers->[57]:$answers->[57]->[0] $answers->[57]->[1] $answers->[57]->[2]\n"; - if ($answers->[57] >= 0) { - my @types = ('Rebellious', 'Compliant', 'Self-Directed'); - $res->{'self'}->{'count'}++; - $res->{'self'}->{$types[$answers->[57]]} += 100; - } - } - if (defined $answers->[58] ) { - #print STDERR "BOOOO::$user $answers->[58]->[0] $answers->[58]->[1] $answers->[58]->[2]\n"; - $res->{'organization'}->{'count'}++; - $res->{'organization'}->{'Rebellious'} += $answers->[58]->[0]; - $res->{'organization'}->{'Compliant'} += $answers->[58]->[1]; - $res->{'organization'}->{'Self-Directed'} += $answers->[58]->[2]; - if ($grpMembership and exists $grpMembership->{$user}) { - foreach my $group (@{$grpMembership->{$user}}) { - if (defined $idlist and not exists $groups->{$group}) { - # a subset of groups was chosen, and this group is not in that list - next; - } - $res->{'groups'}->{$group}->{'count'}++; - $res->{'groups'}->{$group}->{'Rebellious'} += $answers->[58]->[0]; - $res->{'groups'}->{$group}->{'Compliant'} += $answers->[58]->[1]; - $res->{'groups'}->{$group}->{'Self-Directed'} += $answers->[58]->[2]; - } - } - } - } - if ($res->{'self'}->{'count'} < 1) { - delete $res->{'self'}; - } - if (not defined $res) { - return undef; - } - my @tmp = ($res->{'organization'}); - if (exists $res->{'groups'}) {push @tmp, values(%{$res->{'groups'}});} - if (exists $res->{'self'}) {push @tmp, $res->{'self'};} - foreach (@tmp) { - if (not $_->{'count'}) { - $_ = undef; - next; - } - $_->{'Rebellious'} /= $_->{'count'}; - $_->{'Compliant'} /= $_->{'count'}; - $_->{'Self-Directed'} /= $_->{'count'}; - } - #print STDERR Dumper($res,$idlist); - return $res; -} - -1; diff --git a/survey-nginx/cgi-bin/IntegroPassion.pl.bu20100325 b/survey-nginx/cgi-bin/IntegroPassion.pl.bu20100325 deleted file mode 100755 index 26bdc659a..000000000 --- a/survey-nginx/cgi-bin/IntegroPassion.pl.bu20100325 +++ /dev/null @@ -1,1957 +0,0 @@ -#!/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

  • Comments
  • "; - # print "
  • Comments by Category
  • "; - print "\n"; - print "\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 "
  • Question Statistics
  • \n"; - print ""; - print HTMLFooter(); -} - -# The original request was for a pie chart of all -# of the answers on the last question, number 37. I wrote the survey, -# so question 37 is a Likert Scale question that uses a value of -# "Employee Passion" for its super category. This function generates the -# report on the Employee Passion super category regardless of the -# question number. -# This version of the subroutine will have one 3-D piechart with a legend. -# It will have a table with three columns for each -# type: Name, Description, and Percentage. -sub PassionPeopleGroups { - my ($idlist,$groups,$timestamp) = @_; - # warn "idlist $idlist .\n" ; - # warn "idlist keys " . join (" ",keys (%$idlist)) . ".\n" ; - # warn "groups $groups .\n" ; - # warn "groups keys " . join (" ",keys (%$groups)) . ".\n" ; - # warn "timestamp $timestamp .\n" ; - # warn "Client $CLIENT{'clid'} .\n" ; - # warn "Test Id $TEST{'id'} .\n" ; - my $data ; - my $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - my %Categories = () ; my $resp ; - # Keith said he wanted to ignore the data for non-responding candidates. - # $Categories{'NoResponse'} = $$data{'Employee Passion'}->{'NoResponses'} ; - my $mystery = $data->{'Employee Passion'}->{'ScoreCount'} ; # Should be a reference to a hash. - # warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ; - foreach $resp ( keys %$mystery ) { - # each response score. - $Categories{$resp} = $data->{'Employee Passion'}->{'ScoreCount'}->{$resp} ; - } - print HTMLHeaderPlain("Section 1 - Employee Passion"); - print "
    " ; - print "Section 1 - Employee Passion Report
    " ; - print "The percentage of employees at each level of Passion

    \n"; - print "
    \n" ; - print "$FORM{'orgname'}
    \n"; - - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - - my (@values , @Labels , $url, $mykey, @scores, $total) ; - $total = 0 ; - # @Labels = sort keys %Categories ; - @Labels = ("Level 5 - Job and Org", "Level 4 - Job", "Level 3 - Org", - "Level 2 - Conscientious", "Level 1 - Disconnected") ; - foreach $mykey (sort keys %Categories) { - push @scores,$Categories{$mykey} ; - $total += $Categories{$mykey} ; - } - if ($total) { - @values = map ((100 * $_ / $total),@scores ) ; - } else { - # $total is zero. (Do not divide by zero.) - @values = @scores ; - } - $url = "/cgi-bin/piechart4.pl?values=" . - join(':',map(int($_+0.5),grepa(\@values,\@values))) . - # "&labels=" . - "&xdim=700&ydim=200" . - "&labels=" . join(":",@Labels) ; - # "&xdim=200&ydim=100&nolegend=1" ; - print "

    \n" ; - print "" ; - print "

    \n" ; - print ""; - # I just need to add the colors to each graph. - # The selected colors are "lred", "lorange", "lyellow", "lgreen", "lblue" - # The deselected colors are "dred", "dbrown", "dyellow", "dgreen", "dblue" - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the percentage. - print "\n" ; - print "\n"; - # Finish the Table and the page. - print "
    Level 5 - Passionate about the job and the organization:\n" ; - print " Employees at level 5 are passionate about their work and the organization they work for.\n"; - print " They feel valued and respected and know that what they do makes a real difference." ; - print "\n" ; - printf " %.1f", $values[0] ; - print " %" ; - print "
    Level 4 - Passionate only about the job:\n" ; - print " Level 4 employees are passionate about their work " ; - print "and get great satisfaction from knowing they make a difference.\n"; - print " However they feel somewhat disengaged from the organization - " ; - print "they don't feel their contribution is valued." ; - print "\n" ; - printf " %.1f", $values[1] ; - print " %" ; - print "
    Level 3 - Passionate only about the organization:\n" ; - print " Employees at this level are passionate about the organization " ; - print "and believe it delivers real value.\n " ; - print " But they find their work unrewarding - it's just a job." ; - print "\n" ; - printf " %.1f", $values[2] ; - print " %" ; - print "
    Level 2 - Not Passionate, but still conscientious:\n" ; - print " Employees at level 2 are not passionate about the work " ; - print "they do, but are still conscientious about doing a good job. " ; - print "However they feel disconnected from the organization " ; - print "and what it stands for." ; - print "\n" ; - printf " %.1f", $values[3] ; - print " %" ; - print "
    Level 1 - Disconnected from the job and the organization:\n" ; - print " Level 1 employees feel really disconnected from both the work they do " ; - print "and their organization. If they could find another job, " ; - print "they would take it." ; - print "\n" ; - printf " %.1f", $values[4] ; - print " %" ; - print "
    \n"; - print "

    \n"; - print HTMLFooter(); -} - -# The request is for a pie chart on the People Passion question, -# on the Employee Passion Survey (id passion). The original request was for a pie chart of all -# of the answers on the last question, number 37. I wrote the survey, -# so question 37 is a Likert Scale question that uses a value of -# "Employee Passion" for its super category. This function generates the -# report on the Employee Passion super category regardless of the -# question number. -sub PassionPeopleSummary { - my ($timestamp) = @_; - # warn "timestamp $timestamp .\n" ; - # warn "Client $CLIENT{'clid'} .\n" ; - # warn "Test Id $TEST{'id'} .\n" ; - my $grp_data = getGroups($CLIENT{'clid'}) ; - my %id_grp = () ; # Hash of candidate ids, and groups. - # warn "Do GROUPS" ; - foreach my $grp_id (sort keys %{$grp_data}) { - # warn "Do grp_id $grp_id" ; - my $can_ids = $grp_data->{$grp_id}->{'grplist'} ; - foreach my $id (@$can_ids) { - if ($id_grp{$id}) { - # Candidate id already has a group id. - warn "Candidate id $id is in two groups $id_grp{$id} and $grp_id" ; - } else { - # Candidate id can be assigned. - $id_grp{$id} = $grp_id ; - # warn "GRP MEMBER $id GRP $grp_id" ; - } - } - } - my $data ; my $data_grp ; - ($data, $data_grp) = &GetLikertGrpData($CLIENT{'clid'},$TEST{'id'}, \%id_grp); - my %Categories = () ; my $resp ; - $Categories{'NoResponse'} = $$data{'Employee Passion'}->{'NoResponses'} ; - my $mystery = $data->{'Employee Passion'}->{'ScoreCount'} ; # Should be a reference to a hash. - # warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ; - foreach $resp ( keys %$mystery ) { - # each response score. - $Categories{$resp} = $data->{'Employee Passion'}->{'ScoreCount'}->{$resp} ; - } - print HTMLHeaderPlain("Section 1 - Employee Passion Summary"); - print "
    Section 1 - Employee Passion Summary



    \n"; - print "The percentage of employees at each level of passion.
    \n"; - print "Integro Leadership Institute


    \n"; - # print "$FORM{'orgname'}
    \n"; - print "
    \n" ; - print ""; - my (@values , @Labels , $url, $mykey) ; - @Labels = grep !/NoResponse/, sort keys %Categories ; - # The keys of the categories will be 1, 2, 3, 4, and 5. - # These are Person 1, etc. They are numbered backwards from Levels. - foreach $mykey (@Labels) { - push @values,$Categories{$mykey} ; - } - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - my $grp_name ; - - print "" ; - my $total = 0 ; my $percent ; - foreach $mykey (@Labels) { - $total += $Categories{$mykey} ; - } - foreach $mykey (@Labels) { - if ($total) { - # Compute percent - $percent = 100 * $Categories{$mykey} / $total ; - } else { - # $total is zero. Use 0% for all values. - $percent = 0 ; - } - printf "", $percent ; - } - print "\n" ; - - print "\n" ; - - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - foreach my $grp_id (sort keys %{$grp_data}) { - # Get the total for the group. - $total = 0 ; - foreach $mykey (@Labels) { - $total += $data_grp->{$grp_id}->{'Employee Passion'}->{'ScoreCount'}->{$mykey} ; - # warn "grp $grp_id new total $total" ; - } - my $group_name = $grp_data->{$grp_id}->{'grpnme'} ; - print "" ; - foreach $mykey (@Labels) { - if ($total) { - # Compute percent - $percent = 100 * $data_grp->{$grp_id}->{'Employee Passion'}->{'ScoreCount'}->{$mykey} / $total ; - } else { - # $total is zero. Use 0% for all values. - $percent = 0 ; - } - printf "", $percent ; - } - print "\n" ; - } - - print "
     Level 5Level 4Level 3Level 2Level 1
    Overall%.1f %
    Group Breakdown
    GroupLevel 5Level 4Level 3Level 2Level 1
    $group_name%.1f %
    \n"; - print "

    \n"; - print HTMLFooter(); -} - -# The request is for a bar chart on the Passion index, -# on the Employee Passion Survey (id passion). -# They want bar charts comparing the desire of the -# employees for a goal, vs. the Organizations ability -# to deliver that goal, and a summary gap number. -sub OldPassionIndexGroups { - my ($idlist,$groups,$timestamp) = @_; - my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" , - "Need for Meaning" , "Winning Team" ) ; - my @GoalSuffixes = ("Me" , "Org.") ; - my $data ; - $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - # Compute the Summary gap number. - # It is the average of the gaps for each Goal. - my $url; - my $Gap = 0 ; - my $goal ; - foreach $goal (@Goals) { - my $pigoal = $goal . " " . $GoalSuffixes[0] ; - my $wpgoal = $goal . " " . $GoalSuffixes[1] ; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - my $diff = $pinum - $wpnum; - $Gap += $diff ; - } - print HTMLHeaderPlain("Section 2 - Values That Build Passion"); - print "
    Employee Passion Survey
    Section 2 - Values That Build Passion


    \n"; - print "The gap between Employee Passion and the degree to
    which the $xlatphrase[797] operates by these Values

    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - printf "
    Your Trust Values Gap Score is %.1f",$Gap ; - print "
    \n"; - print "

    \n"; - print "The graphs below show the Personal Importance and Perceptions of Work Passion". - " for each of the values."; - print "\n"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Passion:Work%20Passion". - "&xdim=500&ydim=60&hbar=1&ymax=11&ymin=0&yticknum=11"; - my $goal ; - foreach $goal (@Goals) { - my $url; - my $pigoal = $goal . " " . $GoalSuffixes[0] ; - my $wpgoal = $goal . " " . $GoalSuffixes[1] ; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - my $diff = $pinum - $wpnum; - $diff = sprintf("%1.1f", $diff); - $url = $baseurl."&values=".$pinum.":"; - $url = $url."&values2=:".$wpnum; - print "\n"; - print "\n"; - } - print ""; - printf "", $Gap; - # print "\n" ; # International Average - print "\n"; - print "
     Gap
    $goal
    $diff
    Total Trust Values Gap%.1f13.8
    \n"; - print HTMLFooter(); -} - -# The request is for a summary of the Passion index, -# on the Employee Passion Survey (id passion). -sub PassionIndexSummary { - my ($timestamp) = @_; - my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" , - "Need for Meaning" , "Winning Team" ) ; - my @GoalPrefixes = ("Man", "Org") ; - my @GoalSuffixes = ("Me" , "Org.") ; - - # Get Groups Data - my $grp_data = getGroups($CLIENT{'clid'}) ; - my %id_grp = () ; # Hash of candidate ids, and groups. - foreach my $grp_id (sort keys %{$grp_data}) { - my $can_ids = $grp_data->{$grp_id}->{'grplist'} ; - foreach my $id (@$can_ids) { - if ($id_grp{$id}) { - # Candidate id already has a group id. - warn "Candidate id $id is in two groups $id_grp{$id} and $grp_id" ; - } else { - # Candidate id can be assigned. - $id_grp{$id} = $grp_id ; - } - } - } - - my ($data, $data_grp) = &GetLikertGrpData($CLIENT{'clid'},$TEST{'id'}, \%id_grp); - my $goal ; my $Gap = 0 ; my $pre_goal ; my %Summ= () ; - my $TotalImp = 0 ; my $TotalSat = 0 ; my $TotalGap = 0 ; - my $ImpAvail = 0 ; my $SatAvail = 0 ; - my $ImpScore = 0 ; my $SatScore = 0 ; - my $piaver ; - my $pinum ; - my $wpaver ; - my $wpnum ; - foreach $pre_goal(@GoalPrefixes) { - foreach $goal (@Goals) { - $ImpAvail = 0 ; $SatAvail = 0 ; - $ImpScore = 0 ; $SatScore = 0 ; - my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ; - my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ; - $ImpAvail = $data->{$pigoal}->{'PointsAvail'} ; - $ImpScore = $data->{$pigoal}->{'PointsEarned'} ; - $SatAvail = $data->{$wpgoal}->{'PointsAvail'} ; - $SatScore = $data->{$wpgoal}->{'PointsEarned'} ; - $piaver = $ImpAvail ? ($ImpScore/$ImpAvail) : 0 ; - $pinum = (int(100*$piaver + 0.5))/10 ; - $wpaver = $SatAvail ? ($SatScore/$SatAvail) : 0 ; - $wpnum = (int(100*$wpaver + 0.5))/10 ; - $Gap = $pinum - $wpnum; - $TotalImp += $pinum ; - $TotalSat += $wpnum ; - $TotalGap += $Gap ; - # warn "SUMM pigoal $pigoal wpgoal $wpgoal $TotalImpAvail $TotalImpScore $TotalSatAvail $TotalSatScore" ; - } - } - # $piaver = $TotalImpAvail ? ($TotalImpScore/$TotalImpAvail) : 0 ; - # $pinum = (int(100*$piaver + 0.5))/10 ; - # $wpaver = $TotalSatAvail ? ($TotalSatScore/$TotalSatAvail) : 0 ; - # $wpnum = (int(100*$wpaver + 0.5))/10 ; - # $Gap = $pinum - $wpnum; - - print HTMLHeaderPlain("Section 2 - The Passion Index Summary"); - print "

    Section 2 - The Passion Index Summary



    \n"; - print "The gap between Employee Needs and the degree to which the Needs are being satisfied
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - # } elsif (defined $idlist) { - # my $groups = getGroups($CLIENT{'clid'}); - # print "Groups: " - # .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - # } else { - # print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - print "


    \n" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - print "" ; - print "" ; - printf "", $TotalImp ; - printf "", $TotalSat ; - printf "", $TotalGap ; - print "\n" ; - - print "" ; - print "" ; - print "\n" ; - - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - my ($pigoal, $wpgoal) ; - foreach my $grp_id (sort keys %{$grp_data}) { - # Get the total for the group. - my $group_name = $grp_data->{$grp_id}->{'grpnme'} ; - $TotalImp = 0 ; $TotalSat = 0 ; - $TotalGap = 0 ; - foreach $pre_goal(@GoalPrefixes) { - foreach $goal (@Goals) { - $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ; - $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ; - $ImpAvail = $data_grp->{$grp_id}->{$pigoal}->{'PointsAvail'} ; - $ImpScore = $data_grp->{$grp_id}->{$pigoal}->{'PointsEarned'} ; - $SatAvail = $data_grp->{$grp_id}->{$wpgoal}->{'PointsAvail'} ; - $SatScore = $data_grp->{$grp_id}->{$wpgoal}->{'PointsEarned'} ; - $piaver = $ImpAvail ? ($ImpScore/$ImpAvail) : 0 ; - $pinum = (int(100*$piaver + 0.5))/10 ; - $wpaver = $SatAvail ? ($SatScore/$SatAvail) : 0 ; - $wpnum = (int(100*$wpaver + 0.5))/10 ; - $Gap = $pinum - $wpnum; - $TotalImp += $pinum ; - $TotalSat += $wpnum ; - $TotalGap += $Gap ; - # $TotalImpAvail += $data_grp->{$grp_id}->{$pigoal}->{'PointsAvail'} ; - # $TotalImpScore += $data_grp->{$grp_id}->{$pigoal}->{'PointsEarned'} ; - # $TotalSatAvail += $data_grp->{$grp_id}->{$wpgoal}->{'PointsAvail'} ; - # $TotalSatScore += $data_grp->{$grp_id}->{$wpgoal}->{'PointsEarned'} ; - } - } - # $piaver = $TotalImpAvail ? ($TotalImpScore/$TotalImpAvail) : 0 ; - # $pinum = (int(100*$piaver + 0.5))/10 ; - # $wpaver = $TotalSatAvail ? ($TotalSatScore/$TotalSatAvail) : 0 ; - # $wpnum = (int(100*$wpaver + 0.5))/10 ; - # $Gap = $pinum - $wpnum; - - print "" ; - print "" ; - printf "", $TotalImp ; - printf "", $TotalSat ; - printf "", $TotalGap ; - print "\n" ; - - } - print "
     Total ImportanceTotal SatisfactionPassion Gap
    Overall%.1f%.1f%.1f
    Group Breakdown
    GroupTotal ImportanceTotal SatisfactionPassion Gap
    $group_name%.1f%.1f%.1f
    \n" ; - - print HTMLFooter(); -} - -sub CommEffectSummary { - my ($idlist,$groups,$timestamp) = @_; - my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my @cols = ("Purpose","Values","Vision","Goals","Procedures","Roles"); - $groups = getGroups($CLIENT{'clid'}); - print HTMLHeaderPlain("Section 4 - Group Alignment Summary"); - print "
    Strategic Alignment Survey
    Section 4 - Group Alignment Summary


    \n"; - print "The Degree to which Group Members are in Alignment
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print ""; - foreach my $col (@cols) { - printf "", $data->{'organization'}->{'claritysum'}->{$col}->{'value'}; - printf "", $data->{'organization'}->{'approvalsum'}->{$col}->{'value'}; - } - if (exists $data->{'groups'}) { - print "\n"; - print ""; - foreach my $col (@cols) { - print ""; - } - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - foreach my $col (@cols) { - printf "", $data->{'groups'}->{$grp}->{'claritysum'}->{$col}->{'value'}; - printf "", $data->{'groups'}->{$grp}->{'approvalsum'}->{$col}->{'value'}; - } - print "\n"; - } - } - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - print "
     $col
     ClarityApproval
    Overall%.1f %%%.1f %%
    Group Breakdown
    Group$col
    $groups->{$grp}->{'grpnme'}%.1f %%%.1f %%
    International
    Average
    $col
    86%88%77%86%72%78%79%85%78%71%84%70%
    \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 "
    Strategic Alignment Survey
    Section 2 - Group Trust Level Report


    \n"; - print "$xlatphrase[801]
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=Low::::Medium::::High&title=Trust%20Level&ylabel=Respondents"; - $baseurl .= "&xdim=400&ydim=100"; - my %intl; - $intl{'Congruence'} = "66"; - $intl{'Openness'} = "69"; - $intl{'Acceptance'} = "73"; - $intl{'Reliability'} = "79"; - foreach my $row (qw(Congruence Openness Acceptance Reliability)) { - print ""; - print ""; - printf "\n", $trust->{$row}->{'value'}; - printf "\n", $intl{$row}; - } - print "
      Group Trust LevelInt'l Average
    $row{$row}})."\">%.1f%% %.1f%%
    \n"; - #printf "

    Overall Group Trust Level = %.1f %%.

    \n",$data->{'organization'}->{'overalltrust'}; - print HTMLFooter(); -} - -sub TrustLevelSummary { - my ($idlist,$groups,$timestamp) = @_; - my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my @cols = ("Congruence","Openness","Acceptance","Reliability"); - $groups = getGroups($CLIENT{'clid'}); - print HTMLHeaderPlain("Section 2 - Group Trust Level Summary"); - print "
    Strategic Alignment Survey
    Section 2 - Group Trust Level Summary


    \n"; - print "$xlatphrase[801]
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[800]
    \n"; - } - print $timestamp; - print "\n"; - print ""; - } - print "\n"; - print ""; - foreach my $col (@cols) { - printf "", $data->{'organization'}->{'trust'}->{$col}->{'value'}; - } - print "\n"; - if (exists $data->{'groups'}) { - print "\n"; - print ""; - foreach my $col (@cols) { - print ""; - } - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - foreach my $col (@cols) { - printf "", $data->{'groups'}->{$grp}->{'trust'}->{$col}->{'value'}; - } - } - print "\n"; - } - print "\n\n"; - foreach my $col (@cols) { - print ""; - } - print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - print "
     "; - foreach my $col (@cols) { - print "$col
    Overall%.1f %%
    Group Breakdown
    Group$col
    $groups->{$grp}->{'grpnme'}%.1f %%
    International
    Average
    $col
    66%69%73%79%
    \n"; - print HTMLFooter(); -} - -sub TrustLevelCSV { - my ($idlist,$groups,$timestamp) = @_; - my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my @cols = ("Congruence","Openness","Acceptance","Reliability"); - $groups = getGroups($CLIENT{'clid'}); - print "Content-Disposition: attachment; filename=TrustLevel.csv\n\n"; - print "Strategic Alignment Survey,Section 2 - Group Trust Level Summary,"; - print "$xlatphrase[801],"; - print "$FORM{'orgname'},"; - if ($FORM{'uberheader'} ne "") { - print $FORM{'uberheader'}; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups:," - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'}))); - } else { - print "$xlatphrase[798] $xlatphrase[800]"; - } - print ",".$timestamp."\n"; - print "Group"; - foreach my $col (@cols) { - print ",$col"; - } - print "\n"; - print "Overall"; - foreach my $col (@cols) { - printf ",%.1f %%", $data->{'organization'}->{'trust'}->{$col}->{'value'}; - } - print "\n"; - if (exists $data->{'groups'}) { - foreach my $grp (sort keys %{$data->{'groups'}}) { - print "$groups->{$grp}->{'grpnme'}"; - foreach my $col (@cols) { - printf ",%.1f %%", $data->{'groups'}->{$grp}->{'trust'}->{$col}->{'value'}; - } - print "\n"; - } - } -} - -# 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 "
    Section 3 - Values That Build Trust

    \n"; - print "The gap between Employee Expectation and the degree to
    which the $xlatphrase[797] operates by these Values

    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - printf "
    Your Trust Values Gap Score is %.1f",$data->{'organization'}->{'gap'}; - #print "
    World Class Standard ?
    International Benchmark ?
    "; - print "
    \n"; - print "

    \n"; - print "The graphs below show the Personal Importance and Perceptions of Work Performance". - " for each of the eight values."; - print "" ; - # print "" ; - print "\n"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Importance:Work%20Performance". - "&xdim=500&ydim=60&hbar=1&ymax=10&ymin=0&yticknum=10&r_margin=30"; - my %intl; - $intl{'Straightforwardness'} = "2.0"; - $intl{'Honesty'} = "1.7"; - $intl{'Receptivity'} = "1.6"; - $intl{'Disclosure'} = "1.8"; - $intl{'Respect'} = "1.8"; - $intl{'Recognition'} = "2.2"; - $intl{'Seeks Excellence'} = "1.5"; - $intl{'Keeps Commitments'} = "1.9"; - 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 "\n"; - print "" ; - # print "" ; - print "\n"; - } - print ""; - printf "", $data->{'organization'}->{'gap'}; - # print "\n"; # International Average - print "
     GapInt'l
    Avg
    $_
    $diff$intl{$_}
    Total Trust Values Gap%.1f13.8
    \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 "

    Section 3 - Values That Build Trust Summary

    \n"; - print "The gap between Employee Expectation and the degree to
    which the $xlatphrase[797] operates by these Values

    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "\n"; - print "\n"; - print ""; - printf "", $data->{'organization'}->{'Personal Importance'}; - printf "", $data->{'organization'}->{'Work Performance'}; - printf "\n", $data->{'organization'}->{'gap'}; - if (exists $data->{'groups'}) { - print "\n"; - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - printf "", $data->{'groups'}->{$grp}->{'Personal Importance'}; - printf "", $data->{'groups'}->{$grp}->{'Work Performance'}; - printf "\n", $data->{'groups'}->{$grp}->{'gap'}; - } - } - print "\n"; - # print ""; # International Average - # printf "", 74.6; # International Average - # printf "", 60.8; # International Average - # printf "\n", 13.8; # International Average - # print "\n" ; # International Average - print "
     Total ImportanceTotal PerformanceTrust Values Gap
    Overall%.1f%.1f%.1f
    Group Breakdown
    GroupTotal ImportanceTotal PerformanceTrust Values Gap
    $groups->{$grp}->{'grpnme'}%.1f%.1f%.1f
     Total ImportanceTotal PerformanceTrust Values Gap
    International Average%.1f%.1f%.1f
    \n"; - print HTMLFooter(); -} - -sub ValuesCSV { - my ($idlist,$groups,$timestamp) = @_; - my $data = &ValuesData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - $groups = getGroups($CLIENT{'clid'}); - print "Content-Disposition: attachment; filename=ValuesThatBuildTrust.csv\n\n"; - print "Strategic Alignment Survey,Section 3 - Values That Build Trust Summary,"; - print "The gap between Employee Expectation and the degree to which the $xlatphrase[797] operates by these Values,"; - print "$FORM{'orgname'},"; - if ($FORM{'uberheader'} ne "") { - print $FORM{'uberheader'}; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups:," - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'}))); - } else { - print "$xlatphrase[798] $xlatphrase[799]"; - } - print ",".$timestamp."\n"; - print "Group,Total Importance,Total Performance,Trust Values Gap\n"; - print "Overall,"; - printf "%.1f,", $data->{'organization'}->{'Personal Importance'}; - printf "%.1f,", $data->{'organization'}->{'Work Performance'}; - printf "%.1f\n", $data->{'organization'}->{'gap'}; - if (exists $data->{'groups'}) { - foreach my $grp (sort keys %{$data->{'groups'}}) { - print "$groups->{$grp}->{'grpnme'},"; - printf "%.1f,", $data->{'groups'}->{$grp}->{'Personal Importance'}; - printf "%.1f,", $data->{'groups'}->{$grp}->{'Work Performance'}; - printf "%.1f\n", $data->{'groups'}->{$grp}->{'gap'}; - } - } -} - -sub CommentsReport { - my ($idlist, $timestamp, $bycat) = @_; - 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 (@questions) {$_->[4] =~ s/\;//g ;} - 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'}); - # In the test passion, only question 37, allows comments. - for (my $i=37; $i<=37; $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 "
    Strategic Alignment Survey
    Comments Report


    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - print $timestamp; - print "
    \n"; - # print "
    \n"; - - my @outary = (); - for (my $i=37 ; $i <=37 ; $i++) { - if ($comments[$i] == -1) { - # inactive question - next; - } - $outary[$i] = "
    \n"; - $outary[$i] .= "$questions[$i]->[0] - $questions[$i]->[4]

    \n"; - if (@{$comments[$i]}) { - $outary[$i] .= "

      \n"; - foreach (@{$comments[$i]}) { - $outary[$i] .= "
    • $_
    • \n"; - } - $outary[$i] .= "
    \n"; - } else { - $outary[$i] .= "
    • No Comments
    \n"; - } - $outary[$i] .= "
    \n"; - } - - # Read in .rgo file which defines question presentation order - my $out; - my $lookupfile = join($pathsep,$dataroot,"IntegroSAS.rgo"); - if ($bycat && -e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - $out = ""; - my @lines = <$fh>; - $fh->close(); - shift @lines; - foreach (@lines) { - chomp; - my @line = split(/\&/,$_); - my $section = shift @line; - if ($section ne "") { - $out .= "
    \n"; - $out .= "$section\n"; - } - foreach my $sub (@line) { - my ($subheader, $quess) = split(/:/,$sub); - if ($subheader ne "") { - $out .= "
    $subheader:\n"; - } - my @ques = split(/\,/,$quess); - foreach my $quesid (@ques) { - $out .= $outary[$quesid] ; - } - } - } - print $out; - } - } else { - for (1 .. $#outary) { - print $outary[$_]; - } - } - - print "
    \n"; - # print "
    \n"; - #print "
    ".Dumper(\@questions,\@comments)."
    \n"; - print "
    ".HTMLFooter(); -} - -sub print_test_chooser { - my @trecs = @_; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) = split(/&/, $trecs[$_]); - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - $tstoption =" - $id - $desc - $testscompleted - $testsinprogress - $testspending - \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - print HTMLHeader("Integro Learning Custom Reports", $js); - print "
    Please choose the survey for which you would like reports:
    -
    - - - -
    - - - - - - - - - - - $tstoptions - -

    Test IDDescriptionCmpInPPnd


    -"; - print HTMLFooter(); - exit(); -} - -sub TwoBarCharts { -# TwoBarCharts prints the table rows for the Employee -# Importance, and Satisfaction of part of the Passion -# Index Report. -# Parms -# $data - Ref to a hash with all of the data. -# $pigoal - String for the Importance Super Category (Likert Scale question) -# $wpgoal - String for the Satisfaction Super Category (Likert Scale question) -# $IntlAver - Optional numeric value for international average. - my $data = @_[0] ; - my $pigoal = @_[1] ; - my $wpgoal = @_[2] ; - my $IntlAver = @_[3] ; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - # warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - # warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ; - my $diff = $pinum - $wpnum; - # warn "diff $diff X" ; - $diff = sprintf("%1.1f", $diff); - # $IntlAver = sprintf("%1.1f", $IntlAver); - my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal Importance:Workplace Satisfaction" . - "&colours=orange:blue" . - "&xdim=600&ydim=60&hbar=1&ymax=10&ymin=0&yticknum=10&r_margin=30" ; - my $url = $baseurl."&values=".$pinum.":"; - $url = $url."&values2=:".$wpnum; - print "" ; - print "" ; - print "" ; - print "" ; - print "$diff" ; - # print "$IntlAver" ; - print "\n"; -} - -# The request is for a bar chart on the Passion index, -# on the Employee Passion Survey (id passion). -# They want bar charts comparing the desire of the -# employees for a goal, vs. the Organizations ability -# to deliver that goal, and a summary gap number. -sub PassionIndexGroups { - my ($idlist,$groups,$timestamp) = @_; - my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" , - "Need for Meaning" , "Winning Team" ) ; - # The Goals are the general passion ignitors. - my @GoalSuffixes = ("Me" , "Org.") ; - # The suffix is "Me" for its importance to the Candidate. - # The suffix is "Org." for its delivery by the company. - my @GoalPrefixes = ("Man", "Org") ; - # The prefix is "Man" for the manager's delivery of the ignitor, - # or the delivery to the Candidate. - # The prefix is "Org" for the organization's delivery of the ignitor, - # or the delivery to the other employees. - - my $data ; - $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - # Compute the Summary gap number. - # It is the average of the gaps for each Goal. - my $url; - my $Gap = 0 ; - my $goal ; my $gen_goal ; my $pre_goal ; - foreach $pre_goal(@GoalPrefixes) { - foreach $goal (@Goals) { - my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ; - my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - # warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - # warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ; - my $diff = $pinum - $wpnum; - # warn "diff $diff X" ; - $Gap += $diff ; - } - } - - my $style_with_page = "" ; - $style_with_page .= "\n" ; - $style_with_page .= "\n" ; - $style_with_page .= "\n" ; -# The following is an enheritable class. - $style_with_page .= "\n" ; - print HTMLHeaderPlain("Section 2 - The Passion Index", - "", $style_with_page ); - # print "\n" ; - print "
    " ; - print "Section 2 - The Passion Index

    \n"; - print "" ; - print "Employee Needs That Ignite Passion" ; - print "
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - # printf "
    Your Employee Passion Gap Score is %.1f",$Gap ; - # print "
    \n"; - print "
    \n"; - print "" ; - print "The graphs below show employees' perceptions of the importance of these needs " ; - print "and the level of \"satisfaction\" being experienced.\n" ; - print ""; - print "" ; - # print "" ; - print "\n"; -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Need to be Respected Me", "Man Need to be Respected Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Need to be Respected Me", "Org Need to be Respected Org.") ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Learn and Grow Me", "Man Learn and Grow Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Learn and Grow Me", "Org Learn and Grow Org.") ; - -# Close the table, set up a page break for printing, and restart the table. - # print "
     GapIntl
    1. The Need To Be Respected 
    1a. My immediate manager or supervisor trusts me and treats me with respect. 
    1b. My organization's policies and practices regarding compensation, work/life balance, and valuing diversity demonstrate respect for all employees. 
    2. " ; - print "The Need to Learn and Grow 
    2a. I have the opportunity to increase my knowledge and develop new skills in my job. 
    2b. My organization invests in developing the potential of all employees. 
    \n"; - # Works for Firefox 8 on Linux, but not IE. - # print "
    \n" ; - # print "
    \n" ; - # Works for ???, but not IE. - # print "

    \n" ; - # Works for ???, but not IE. - # print "

    \n" ; - # Works for ???, but not IE. - # print "

    \n" ; - # print "

    \n" ; - # print "

    \n" ; - # print "
    " ; - # print "
    " ; - # print "
    " ; - # print "
    " ; - # print "
    " ; - # print "

    " ; - # print "\n" ; - # print "\n" ; - # print "\n" ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Need to be an Insider Me", "Man Need to be an Insider Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Need to be an Insider Me", "Org Need to be an Insider Org.") ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Need for Meaning Me", "Man Need for Meaning Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Need for Meaning Me", "Org Need for Meaning Org.") ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Winning Team Me", "Man Winning Team Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Winning Team Me", "Org Winning Team Org.") ; - -# Closing values. - print ""; - printf "", $Gap; - # print "\n" ; # International Average - print "\n"; - # print "
    3. " ; - print "The Need to Be an Insider 
    3a. My immediate manager or supervisor values my contribution and cares about my well-being. 
    3b. My organization is open with employees about information and organizational performance to help us understand the decisions that are being made. 
    4. " ; - print "The Need for Meaning 
    4a. The mission or purpose of my organization makes me feel proud to work here. 
    4b. The work I do is meaningful because it helps my organization fulfill our mission. 
    5. " ; - print "The Need to Be Part of a Winning Team 
    5a. My team is making a significant contribution to our organization. 
    5b. My team is focused on continually improving our performance. 
    Total Employee Passion Gap%.1f13.8
    \n"; - print "\n"; - print HTMLFooter(); -} - -# The request is for a bar chart on the Passion index, -# on the Employee Passion Survey (id passion). -# They want bar charts comparing the desire of the -# employees for a goal, vs. the Organizations ability -# to deliver that goal, and a summary gap number. -sub NewOldPassionIndexGroups { - my ($idlist,$groups,$timestamp) = @_; - my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" , - "Need for Meaning" , "Winning Team" ) ; - # The Goals are the general passion ignitors. - my @GoalSuffixes = ("Me" , "Org.") ; - # The suffix is "Me" for its importance to the Candidate. - # The suffix is "Org." for its delivery by the company. - my @GoalPrefixes = ("Man", "Org") ; - # The prefix is "Man" for the manager's delivery of the ignitor, - # or the delivery to the Candidate. - # The prefix is "Org" for the organization's delivery of the ignitor, - # or the delivery to the other employees. - - my $data ; - $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - # Compute the Summary gap number. - # It is the average of the gaps for each Goal. - my $url; - my $Gap = 0 ; - my $goal ; my $gen_goal ; my $pre_goal ; - foreach $pre_goal(@GoalPrefixes) { - foreach $goal (@Goals) { - my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ; - my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - # warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - # warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ; - my $diff = $pinum - $wpnum; - # warn "diff $diff X" ; - $Gap += $diff ; - } - } - - print HTMLHeaderPlain("Section 2 - Values That Build Passion"); - print "
    Employee Passion Survey
    Section 2 - Values That Build Passion


    \n"; - print "The gap between Employee Passion and the degree to
    which the $xlatphrase[797] operates by these Values

    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - printf "
    Your Trust Values Gap Score is %.1f",$Gap ; - print "
    \n"; - print "

    \n"; - print "The graphs below show the Personal Importance and Perceptions of Work Passion". - " for each of the values."; - print "\n"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Passion:Work%20Passion". - "&xdim=500&ydim=60&hbar=1&ymax=10&ymin=0&yticknum=10&r_margin=30"; - my $localteam ; - my $goal ; - foreach $pre_goal(@GoalPrefixes) { - foreach $goal (@Goals) { - my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ; - my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ; - my $url; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - my $diff = $pinum - $wpnum; - $diff = sprintf("%1.1f", $diff); - $url = $baseurl."&values=".$pinum.":"; - $url = $url."&values2=:".$wpnum; - $localteam = ($pre_goal eq "Man") ? "Manager" : "Organization" ; - print "\n"; - print "\n"; - } - } - print ""; - printf "", $Gap; - # print "\n" ; # International Average - print "\n"; - print "
     Gap
    $goal $localteam
    $diff
    Total Trust Values Gap%.1f13.8
    \n"; - print HTMLFooter(); -} - -# The original request was for a pie chart of all -# of the answers on the last question, number 37. I wrote the survey, -# so question 37 is a Likert Scale question that uses a value of -# "Employee Passion" for its super category. This function generates the -# report on the Employee Passion super category regardless of the -# question number. -# This version creates a table with 2 columns and 5 rows. -# One row for each type of enthusiasm. -# one column has the description for a type. -# The second column has a 2-D piechart with colors, -# and the color is lighter for the described type. -sub PassionPeopleGroups_obsolete { - my ($idlist,$groups,$timestamp) = @_; - # warn "idlist $idlist .\n" ; - # warn "idlist keys " . join (" ",keys (%$idlist)) . ".\n" ; - # warn "groups $groups .\n" ; - # warn "groups keys " . join (" ",keys (%$groups)) . ".\n" ; - # warn "timestamp $timestamp .\n" ; - # warn "Client $CLIENT{'clid'} .\n" ; - # warn "Test Id $TEST{'id'} .\n" ; - my $data ; - my $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - my %Categories = () ; my $resp ; - # Keith said he wanted to ignore the data for non-responding candidates. - # $Categories{'NoResponse'} = $$data{'Employee Passion'}->{'NoResponses'} ; - my $mystery = $data->{'Employee Passion'}->{'ScoreCount'} ; # Should be a reference to a hash. - # warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ; - foreach $resp ( keys %$mystery ) { - # each response score. - $Categories{$resp} = $data->{'Employee Passion'}->{'ScoreCount'}->{$resp} ; - } - print HTMLHeaderPlain("Section 1 - Employee Passion"); - print "

    " ; - print "Section 1 - Employee Passion Report
    " ; - print "The percentage of employees at each level of Passion

    \n"; - print "\n" ; - print "$FORM{'orgname'}
    \n"; - - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - - print ""; - my (@values , @Labels , $url, $mykey, @scores, $total) ; - $total = 0 ; - @Labels = sort keys %Categories ; - foreach $mykey (@Labels) { - push @scores,$Categories{$mykey} ; - $total += $Categories{$mykey} ; - } - if ($total) { - @values = map ((100 * $_ / $total),@scores ) ; - } else { - # $total is zero. (Do not divide by zero.) - @values = @scores ; - } - $url = "/cgi-bin/piechart4.pl?values=" . - join(':',map(int($_+0.5),grepa(\@values,\@values))) . - "&labels=" . - "&xdim=150&ydim=150&nolegend=1¬3d=1" ; - # "&labels=" . join(":",@Labels) . - # "&xdim=200&ydim=100&nolegend=1" ; - # I just need to add the colors to each graph. - # The selected colors are "lred", "lorange", "lyellow", "lgreen", "lblue" - # The deselected colors are "dred", "dbrown", "dyellow", "dgreen", "dblue" - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the pie chart. - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the pie chart. - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the pie chart. - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the pie chart. - print "\n"; - # Start a row. - print "\n"; - # Do the Description. - print "\n" ; - # Do the pie chart. - print "\n"; - # Finish the Table and the page. - print "
    Level 5 - Passionate about the job and the organization:\n" ; - print " Employees at level 5 are passionate about the work and the organization they work for.\n"; - print " They feel valued and respected and know that what they do makes a real difference." ; - print "\n" ; - print "" ; - print "
    Level 4 - Passionate only about the job:\n" ; - print " Level 4 employees are passionate about their work " ; - print "and get great satisfaction from knowing they make a difference.\n"; - print " However they feel somewhat disengaged from the organization - " ; - print "they don't feel their contribution is valued." ; - print "\n" ; - print "" ; - print "
    Level 3 - Passionate only about the organization:\n" ; - print " Employees at this level are passionate about the organization " ; - print "and believe it delivers real value.\n " ; - print " But they find their work unrewarding - it's just a job." ; - print "\n" ; - print "" ; - print "
    Level 2 - Not Passionate, but still conscientious:\n" ; - print " Employees at level 2 are not passionate about the work " ; - print "they do, but are still conscientious about doing a good job. " ; - print "However they feel disconnected from the organization " ; - print "and what it stands for." ; - print "\n" ; - print "" ; - print "
    Level 1 - Disconnected from the job and the organization:\n" ; - print " Level 1 employees feel really disconnected from both the work they do " ; - print "and the organization. If they could find another job, " ; - print "would take it." ; - print "\n" ; - print "" ; - print "
    \n"; - print "

    \n"; - print HTMLFooter(); -} - -# The request is for a bar chart on the Passion index, -# on the Employee Passion Survey (id passion). -# This was an attempt to use a different style chart -# to get the data displayed on one page. -# It was abandoned. -sub PassionVertGroups { - my ($idlist,$groups,$timestamp) = @_; - my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" , - "Need for Meaning" , "Winning Team" ) ; - # The Goals are the general passion ignitors. - my @GoalSuffixes = ("Me" , "Org.") ; - # The suffix is "Me" for its importance to the Candidate. - # The suffix is "Org." for its delivery by the company. - my @GoalPrefixes = ("Man", "Org") ; - # The prefix is "Man" for the manager's delivery of the ignitor, - # or the delivery to the Candidate. - # The prefix is "Org" for the organization's delivery of the ignitor, - # or the delivery to the other employees. - - my $data ; - $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist); - # Compute the Summary gap number. - # It is the average of the gaps for each Goal. - my $url; - my $Gap = 0 ; - my $goal ; my $gen_goal ; my $pre_goal ; - foreach $pre_goal(@GoalPrefixes) { - foreach $goal (@Goals) { - my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ; - my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ; - my $piavail = $data->{$pigoal}->{'PointsAvail'} ; - my $piscore = $data->{$pigoal}->{'PointsEarned'} ; - my $piaver = $piavail ? ($piscore/$piavail) : 0 ; - my $pinum = (int(100*$piaver + 0.5))/10 ; - # warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ; - my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ; - my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ; - my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ; - my $wpnum = (int(100*$wpaver + 0.5))/10 ; - # warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ; - my $diff = $pinum - $wpnum; - # warn "diff $diff X" ; - $Gap += $diff ; - } - } - - my $style_with_page = "" ; - $style_with_page .= "\n" ; - $style_with_page .= "\n" ; - $style_with_page .= "\n" ; -# The following is an enheritable class. - $style_with_page .= "\n" ; - print HTMLHeaderPlain("Section 2 - The Passion Index", - "", $style_with_page ); - # print "\n" ; - print "
    " ; - print "Section 2 - The Passion Index

    \n"; - print "" ; - print "Employee Needs That Ignite Passion" ; - print "
    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - print "$xlatphrase[798] $xlatphrase[799]
    \n"; - } - $timestamp; - # printf "
    Your Employee Passion Gap Score is %.1f",$Gap ; - # print "
    \n"; - print "
    \n"; - print "" ; - print "The graphs below show employees' perceptions of the importance of these needs " ; - print "and the level of \"satisfaction\" being experienced.\n" ; - print ""; - $url = "/cgi-bin/linegraph.pl?values=B:C::1:6::2:4" . - "&labels=J:K:L&y_label=Scale&x_label=letter" . - "&xdim=700&ydim=200" . - "&xdim=200&ydim=100" ; - print "

    \n" ; - print "" ; - print "
    " ; - print "" ; - # print "" ; - print "\n"; -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Need to be Respected Me", "Man Need to be Respected Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Need to be Respected Me", "Org Need to be Respected Org.") ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Learn and Grow Me", "Man Learn and Grow Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Learn and Grow Me", "Org Learn and Grow Org.") ; - -# Close the table, set up a page break for printing, and restart the table. - print "
     GapIntl
    1. The Need To Be Respected 
    1a. My immediate manager or supervisor trusts me and treats me with respect. 
    1b. My organization's policies and practices regarding compensation, work/life balance, and valuing diversity demonstrate respect for all employees. 
    2. " ; - print "The Need to Learn and Grow 
    2a. I have the opportunity to increase my knowledge and develop new skills in my job. 
    2b. My organization invests in developing the potential of all employees. 
    \n"; - # Works for Firefox 8 on Linux, but not IE. - # print "
    \n" ; - # print "
    \n" ; - # Works for ???, but not IE. - # print "

    \n" ; - # Works for ???, but not IE. - # print "

    \n" ; - # Works for ???, but not IE. - # print "

    \n" ; - # print "

    \n" ; - print "

    \n" ; - print "
    " ; - print "
    " ; - print "
    " ; - print "
    " ; - print "
    " ; - print "

    " ; - # print "\n" ; - # print "\n" ; - print "\n" ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Need to be an Insider Me", "Man Need to be an Insider Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Need to be an Insider Me", "Org Need to be an Insider Org.") ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Need for Meaning Me", "Man Need for Meaning Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Need for Meaning Me", "Org Need for Meaning Org.") ; - -# Print one Category. - print "" ; - print "" ; - print "" ; - print "\n" ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Man Winning Team Me", "Man Winning Team Org.") ; - print "" ; - print "" ; - print "\n" ; - &TwoBarCharts($data, "Org Winning Team Me", "Org Winning Team Org.") ; - -# Closing values. - print ""; - printf "", $Gap; - # print "\n" ; # International Average - print "\n"; - # print "
    3. " ; - print "The Need to Be an Insider 
    3a. My immediate manager or supervisor values my contribution and cares about my well-being. 
    3b. My organization is open with employees about information and organizational performance to help us understand the decisions that are being made. 
    4. " ; - print "The Need for Meaning 
    4a. The mission or purpose of my organization makes me feel proud to work here. 
    4b. The work I do is meaningful because it helps my organization fulfill our mission. 
    5. " ; - print "The Need to Be Part of a Winning Team 
    5a. My team is making a significant contribution to our organization. 
    5b. My team is focused on continually improving our performance. 
    Total Employee Passion Gap%.1f13.8
    \n"; - print "\n"; - print HTMLFooter(); -} - diff --git a/survey-nginx/cgi-bin/IntegroStats.pl.bu20131217 b/survey-nginx/cgi-bin/IntegroStats.pl.bu20131217 deleted file mode 100755 index 20dd13e97..000000000 --- a/survey-nginx/cgi-bin/IntegroStats.pl.bu20131217 +++ /dev/null @@ -1,2180 +0,0 @@ -#!/usr/bin/perl -# -# $Id: IntegroStats.pl,v 1.2 2005/10/31 17:03:34 ddoughty Exp $ -# -# Source File: IntegroStats.pl - -# Get config -# use strict; -use FileHandle; -use Time::Local; -use Data::Dumper; -require 'sitecfg.pl'; -require 'testlib.pl'; -require 'tstatlib.pl'; -require 'ui.pl'; - -#use strict; -use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST - %SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS); -use vars qw($testcomplete $cgiroot $pathsep $dataroot ); - -&app_initialize; -&LanguageSupportInit(); -&get_session($FORM{'tid'}); -#&get_client_profile($SESSION{'clid'}); -my @sortbys = qw(Name LoginID Date); -my ($bExport,$idlist); -#print STDERR Dumper(\%FORM,\%CLIENT,\%SESSION); -#if (exists $FORM{'grouping'} and $FORM{'grouping'} eq 'subset') { - #$idlist = &getIdlist($CLIENT{'clid'},$FORM{'idlist'}); -#} - -if ($FORM{'export'}) { - print "Content-Type: application/doc\n\n"; - $bExport=1; -} elsif ($FORM{'csv'}) { - print "Content-Type: text/x-csv\n\n"; -} else { - print "Content-Type: text/html\n\n"; - $bExport=0; -} -#print STDERR Dumper(\%FORM,$idlist); -if (&get_session($FORM{'tid'})) { - if ($FORM{'testsummary'} eq 'composite') { - &show_test_composite($idlist); - } elsif ($FORM{'testsummary'} eq 'bycnd') { - &show_test_resultsbycnd($idlist); - } else { - &extract_test_data(); - } -} -if ($bExport) { - exit(0); -} - -sub extract_test_data() { - &LanguageSupportInit(); - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - my @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - my @colhdrs=(); - push @colhdrs,""; - if ($FORM{'cndnme'}) { - push @colhdrs,"left:Last Name"; - push @colhdrs,"left:First Name"; - push @colhdrs,"left:MI"; - } - push @colhdrs,"left:User ID"; - if ($FORM{'cndeml'}) { - push @colhdrs,"left:Email Address"; - } - if ($FORM{'cnd1'}) { - push @colhdrs,"left:$CLIENT{'clcnd1'}"; - } - if ($FORM{'cnd2'}) { - push @colhdrs,"left:$CLIENT{'clcnd2'}"; - } - if ($FORM{'cnd3'}) { - push @colhdrs,"left:$CLIENT{'clcnd3'}"; - } - if ($FORM{'cnd4'}) { - push @colhdrs,"left:$CLIENT{'clcnd4'}"; - } - if ($FORM{'cndscr'}) { - push @colhdrs,"center:Correct"; - push @colhdrs,"center:Incorrect"; - push @colhdrs,"right:Score"; - } - my @dataflds=(); - my @unsorted=(); - my $row=""; - my @qsumry=(); - my $user=""; - my $joint="\&"; - my $colhdr; - my $colalgn; - my $fidx; - for ($fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - my $excuser="inc$user"; - if ($FORM{$excuser}) { - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - &get_candidate_profile($CLIENT{'clid'},$user); - if ($FORM{'cndnme'}) { - $row=join($joint,$row,"$CANDIDATE{'nml'}"); - $row=join($joint,$row,"$CANDIDATE{'nmf'}"); - $row=join($joint,$row,"$CANDIDATE{'nmm'}"); - } - $row=join($joint,$row,"$user"); - if ($FORM{'cndeml'}) { - $row=join($joint,$row,"$CANDIDATE{'eml'}"); - } - if ($FORM{'cnd1'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd1'}"); - } - if ($FORM{'cnd2'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd2'}"); - } - if ($FORM{'cnd3'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd3'}"); - } - if ($FORM{'cnd4'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd4'}"); - } - if ($FORM{'cndscr'}) { - $row=join('&',$row,$qsumry[0],$qsumry[1],$qsumry[2]); - } - push @unsorted, $row; - $row=""; - } - my @sorted=sort @unsorted; - @unsorted=(); - my $rowcount=$#filelist+1; - &print_report_dataextract_header($rowcount,@colhdrs,@colalign); - my ($i); - for $i (0 .. $#sorted) { - @dataflds=split($joint, $sorted[$i]); - if ($bExport) { - for $i (1 .. $#dataflds) { - print "$dataflds[$i]"; - if ($i == $#dataflds) { - print "\n"; - } else { - print "\t"; - } - } - } else { - print "\n"; - for $i (1 .. $#dataflds) { - ($colalgn,$colhdr) = split(/:/,$colhdrs[$i]); - print "\t\t$dataflds[$i]\n"; - } - print "\n"; - } - } - &print_report_bycnd_footer(); - @sorted=(); -} - -sub print_report_dataextract_header { - my ($ncount,@cols)= @_; - my $colhdr; - my $colalgn; - my $i; - if ($bExport) { - print "$TEST{'desc'} ($TEST{'id'})\n"; - print "Raw Data Extraction\n"; - print "$ncount Completed Responses\n"; - for $i (1 .. $#cols) { - ($colalgn,$colhdr) = split(/:/,$cols[$i]); - print "$colhdr"; - if ($i == $#cols) { - print "\n"; - } else { - print "\t"; - } - } - } else { - print "\n"; - print "\n"; - print "\tTest Data Extraction\n"; - print "\t\n"; - print "\n"; - print "\n"; - print "
    \n"; - print "$TEST{'desc'} ($TEST{'id'})
    \n"; - print "Raw Data Extraction
    \n"; - print "$ncount Completed Responses\n"; - print "\n"; - print "\t\n"; - for $i (1 .. $#cols) { - ($colalgn,$colhdr) = split(/:/,$cols[$i]); - print "\t\t\n"; - } - print "\t<\TR>\n"; - } -} - -sub date_out_of_range { - my ($completedat,$datefm,$dateto) = @_; - my @unsorted=(); - push @unsorted, $completedat; - push @unsorted, $datefm; - push @unsorted, $dateto; - my @sorted = sort @unsorted; - my $bretyes = ($sorted[1] eq $unsorted[0]) ? 0 : 1; - @unsorted=(); - @sorted=(); - return $bretyes; -} - -$^W=1; -sub sort_test_results { - my ($sortby,@rows) = @_; - if ($sortby eq 'Name') { - #print STDERR "by Name\n"; - return sort {$a->{'columns'}->[0] cmp $b->{'columns'}->[0];} @rows; - } elsif ($sortby eq 'LoginID') { - #print STDERR "by LoginID\n"; - return sort {$a->{'columns'}->[1] cmp $b->{'columns'}->[1];} @rows; - } elsif ($sortby eq 'Date') { - #print STDERR "by Date\n"; - return sort {$a->{'end'} <=> $b->{'end'};} @rows; - } else { - #print STDERR "by Nothing\n"; - return @rows; - } -} - -sub show_test_resultsbycnd { - &LanguageSupportInit(); - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - my @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - my ($url) = ("$cgiroot/IntegroStats.pl?"); - if (not $FORM{'sortby'}) {$FORM{'sortby'}=$sortbys[0];} - if (not $FORM{'reverse'}) {$FORM{'reverse'}=0;} - foreach (keys %FORM) { - if (($_ ne 'sortby') and ($_ ne 'reverse') and ($FORM{$_} !~ /\s+/)) { - #print STDERR "$_=$FORM{$_}\n"; - $url .= "&$_=$FORM{$_}"; - } else { - #print STDERR "NOT $_=$FORM{$_}\n"; - } - } - my $csvurl = $url."&csv=1&sortby=$FORM{'sortby'}&reverse=".($FORM{'reverse'}?0:1); - my $reverseurl = $url."&sortby=$FORM{'sortby'}&reverse=".($FORM{'reverse'}?0:1); - my %sorturls; - foreach my $sorter (@sortbys) { - $sorturls{$sorter} = $url."&sortby=$sorter"; - } - my @sorted=(); - my @unsorted=(); - my $user; - my $test; - my $qidx; - my $trash; - my $subjskl; - my $subj; - my $sklvl; - my $subjlist=","; - my @qids=(); - my @qsumry=(); - my @corincs=(); - my $bysubjflag = ($FORM{'statsbysubj'} ne '') ? 1 : 0; - my @subjects=(); - my @subjcnts=(); - my @subjtot=(); - my @subjmean=(); - my @subjmedian=(); - my @meanscore=split('\,',"0,0,0,0,100,0,0"); - my @medianscore=(); - my $i=0; - my $j=0; - my $fidx; - my @rows=(); - my $row={}; - my @answ=(); - my $qid; - my $usrnm; - my $nresultcount=$#filelist+1; - my $mtime; - my $completedat; - my $displaydate; - if ($FORM{'mofm'} < 10) { $FORM{'mofm'}="0$FORM{'mofm'}";} - if ($FORM{'moto'} < 10) { $FORM{'moto'}="0$FORM{'moto'}";} - if ($FORM{'dyfm'} < 10) { $FORM{'dyfm'}="0$FORM{'dyfm'}";} - if ($FORM{'dyto'} < 10) { $FORM{'dyto'}="0$FORM{'dyto'}";} - my $datefm="$FORM{'yrfm'}\-$FORM{'mofm'}\-$FORM{'dyfm'}"; - my $dateto="$FORM{'yrto'}\-$FORM{'moto'}\-$FORM{'dyto'}"; - for ($fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - my $history = get_testhistory_from_log($CLIENT{'clid'},$user,$FORM{'tstid'}); - if (not defined $history) { - $history = get_cnd_test_from_history($testcomplete,$CLIENT{'clid'},$user,$FORM{'tstid'}); - } - if (not defined $history) { - # no log file entry for this test - #print STDERR "$testcomplete.$pathsep.$filelist[$fidx]\n"; - my $mtime = (stat($testcomplete.$pathsep.$filelist[$fidx]))[9]; - $history->{'end'} = $mtime; - $history->{'start'} = $history->{'end'}; - #print STDERR Dumper($history); - } - #$trash=join($pathsep,$testcomplete,$filelist[$fidx]); - #open (TMPFILE, "<$trash"); - #$mtime = (stat(TMPFILE))[9]; - #close TMPFILE; - $completedat = &format_date_time("yyyy-mm-dd", "1", "-10000", $history->{'end'}); - $displaydate = &format_date_time("dd-mmm-yyyy", "1", "-10000", $history->{'end'}); - #print STDERR "$completedat $displaydate $datefm $dateto\n"; - if (&date_out_of_range($completedat,$datefm,$dateto)) { - $nresultcount--; - next; - } - my $excuser="inc$user"; - if ($FORM{$excuser}) { - $nresultcount--; - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qids = split(/\&/, $SUBTEST_QUESTIONS{2}); - @answ=split(/\&/,$SUBTEST_ANSWERS{2}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - @corincs = split(/\//, $qsumry[$#qsumry]); - for $i (0 .. $#subjects) { - $subjcnts[$i][0]=0; - $subjcnts[$i][1]=0; - $subjcnts[$i][2]=0; - $subjcnts[$i][3]=0; - } - &get_candidate_profile($CLIENT{'clid'},$user); - $usrnm="$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}"; - $row={'columns' => [$usrnm,$user,$displaydate]}; - $row->{'start'} = $history->{'start'}; - $row->{'end'} = $history->{'end'}; - #print STDERR "Survey = $TEST_SESSION{'srvy'}\n"; - if ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - for $qid (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$qid]); - ($trash,$subjskl) = split(/::/, $answ[$qid]); - ($subj,$sklvl,$trash)=split(/\.|\:/,$subjskl); - unless ($subjlist =~ /\,$subj\,/i) { - $subjlist = join('',$subjlist,"$subj\,"); - push @subjects,"$subj"; - $i=$#subjects; - $subjcnts[$i][0]=0; # questions in subject area - $subjcnts[$i][1]=0; # correct answers - $subjcnts[$i][2]=0; # incorrect answers - $subjcnts[$i][3]=0; # pct correct - $subjtot[$i][0]=0; - $subjtot[$i][1]=0; - $subjtot[$i][2]=0; - $subjtot[$i][3]=0; - $subjmean[$i][0]=0; # population count - $subjmean[$i][1]=0; # population value summation - $subjmean[$i][2]=0; # population mean - $subjmean[$i][3]=0; # population standard deviation - $subjmean[$i][4]=100; # population range-low - $subjmean[$i][5]=0; # population range-high - } - for $i (0 .. $#subjects) { - if ($subj eq $subjects[$i]) { - $subjcnts[$i][0]++; - $subjtot[$i][0]++; - if (substr($corincs[$qid],0,1) eq '1') { - $subjcnts[$i][1]++; - $subjtot[$i][1]++; - } else { - $subjcnts[$i][2]++; - $subjtot[$i][2]++; - } - $subjcnts[$i][3]=int((($subjcnts[$i][1]/$subjcnts[$i][0])*100)); - $subjtot[$i][3]=int((($subjtot[$i][1]/$subjtot[$i][0])*100)); - last; - } - } - } - if ($bysubjflag) { - for $i (0 .. $#subjects) { - push @{$row->{'columns'}},$subjcnts[$i][0],$subjcnts[$i][1],$subjcnts[$i][2],$subjcnts[$i][3]; - $subjmean[$i][0]++; - $subjmean[$i][1]+=$subjcnts[$i][3]; - $subjmean[$i][2]=int(($subjmean[$i][1]/$subjmean[$i][0])); - #$subjmean[$i][4]=(($subjcnts[$i][3] < $subjmean[$i][4]) || ($subjmean[$i][4] == 0)) ? $subjcnts[$i][3] : $subjmean[$i][4]; - $subjmean[$i][4]=($subjcnts[$i][3] < $subjmean[$i][4]) ? $subjcnts[$i][3] : $subjmean[$i][4]; - $subjmean[$i][5]=($subjcnts[$i][3] > $subjmean[$i][5]) ? $subjcnts[$i][3] : $subjmean[$i][5]; - $subjmedian[$i][$fidx]=$subjcnts[$i][3]; - $subjcnts[$i][0]=0; - $subjcnts[$i][1]=0; - $subjcnts[$i][2]=0; - $subjcnts[$i][3]=0; - } - } - $meanscore[0]++; # data count - $meanscore[1]+=$qsumry[2]; # sum of values - $meanscore[2]=int(($meanscore[1]/$meanscore[0])); # unbiased population mean - $meanscore[4]=($qsumry[2] < $meanscore[4]) ? $qsumry[2] : $meanscore[4]; - $meanscore[5]=($qsumry[2] > $meanscore[5]) ? $qsumry[2] : $meanscore[5]; - $medianscore[$fidx]=$qsumry[2]; - } - push @{$row->{'columns'}},$qsumry[0],$qsumry[1],$qsumry[2]; - push @rows, $row; - } - @sorted=sort {$a <=> $b} @medianscore; - $j=$#sorted/2; - $i=$sorted[$j]; - if (($#sorted % 2) == 0) { - @medianscore=(); - $medianscore[0]=$i; - } else { - $j++; - $i+=$sorted[$j]; - @medianscore=(); - $medianscore[0]=int(($i/2)); - } - my @scores=(); - for $i (0 .. $#subjects) { - for $j (0 .. $#filelist) { - $scores[$j]=$subjmedian[$i][$j]; - } - @sorted=sort {$a <=> $b} @scores; - @scores=(); - $j=$#sorted/2; - $qid=$sorted[$j]; - if (($#sorted % 2) == 0) { - $subjmedian[$i][0]=$qid; - } else { - $j++; - $qid+=$sorted[$j]; - $subjmedian[$i][0]=int(($qid/2)); - } - } - # The sorting block - if ($FORM{'reverse'}) { - @sorted = reverse &sort_test_results($FORM{'sortby'},@rows); - } else { - @sorted = &sort_test_results($FORM{'sortby'},@rows); - } - # end of the sorting block - @rows=(); - if ($FORM{'csv'}) { - &print_report_bycnd_csv(@sorted); - return; - } - my $colspan=&print_report_bycnd_header($nresultcount,$bysubjflag,\%sorturls,$FORM{'sortby'}, - $csvurl,$reverseurl,@subjects); - @unsorted=(); - @subjcnts=(); - my $symbol=""; - my @cols=(); - my @rowhdrs=('Questions','Correct','Incorrect','Pct Correct'); - my $rowspan=($bysubjflag) ? ($#rowhdrs+1) : 1; - foreach my $row (@sorted) { - @cols=@{$row->{'columns'}}; - my ($start,$end,$duration,$datestamp,$total); - if ($bExport) { - print "$cols[0]\t$cols[1]\t$cols[2]\t"; - if ($bysubjflag) { print "\n";} - } else { - #($start,$end,$duration) = get_teststartend($CLIENT{'clid'},$cols[1],$FORM{'tstid'}); - $start = sprintf("%02d:%02d:%02d",reverse((localtime($row->{'start'}))[0..2])); - $end = sprintf("%02d:%02d:%02d",reverse((localtime($row->{'end'}))[0..2])); - $duration = &fmtDuration($row->{'end'} - $row->{'start'}); - if ($end == "Unknown" ) { - $datestamp = ""; - } else { - my $gmend = sprintf("%02d:%02d:%02d",reverse((gmtime($row->{'end'}))[0..2])); - $datestamp = "$cols[2] $gmend GMT"; - $datestamp =~ s/ /_/g; - } - $total = $cols[3] + $cols[4]; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - if ($bysubjflag) { - for $j (0 .. $#rowhdrs) { - $symbol=($j==3) ? "\%" : ""; - if ($j > 0) { - if ($bExport == 0) { - print "\t\n"; - } - } - if ($bExport) { - print "\t\t$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - for $fidx (0 .. $#subjects) { - $qid=($fidx*4)+$j+3; - if ($bExport) { - print "$cols[$qid]\t"; - } else { - print "\t\t\n"; - } - if ($j==3) { - $subjmean[$fidx][3]+=(($subjmean[$fidx][2]-$cols[$qid])*($subjmean[$fidx][2]-$cols[$qid])); - } - } - if ($j == 0) { - $fidx=$#cols-2; - if ($bExport) { - print "$cols[$fidx++]\t"; - print "$cols[$fidx++]\t"; - print "$cols[$fidx]\t"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - } else { - $j=$#cols-2; - if ($bExport) { - print "$cols[$j++]\t"; - print "$cols[$j++]\t"; - print "$cols[$j]\n"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - if ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } else { - print "\t\t\n"; - } - print "\t\n"; - } - } - if ($bysubjflag) { - if ($bExport==0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } - $meanscore[3]+=(($meanscore[2]-$cols[$#cols])*($meanscore[2]-$cols[$#cols])); - @cols=(); - } - $meanscore[3]=int((sqrt($meanscore[3]/($#sorted+1)))); - if ($bysubjflag) { - @rowhdrs=('Questions','Correct','Incorrect','Pct Correct','Unbiased Mean','Std. Dev.','Range-Low','Range-High','Median'); - $rowspan=$#rowhdrs+1; - for $j (0 .. $#rowhdrs) { - if ($bExport == 0) { - print "\t\n"; - } - if ($j == 0) { - if ($bExport) { - print "\n\tComposite\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t\t"; - } - } - if ($bExport) { - print "$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - if ($j < 4) { - $symbol=($j==3) ? "\%" : ""; - for $fidx (0 .. $#subjects) { - if ($bExport) { - print "$subjtot[$fidx][$j]\t"; - } else { - print "\t\t\n"; - } - } - if ($j == 0) { - if ($bExport) { - print "\t\t"; - } else { - print "\t\t\n"; - } - } elsif ($j == 3) { - if ($bExport) { - print "\tOverall\t"; - } else { - print "\t\t\n"; - } - } - } else { - $symbol="\%"; - $i=$j-2; - for $fidx (0 .. $#subjects) { - if ($i == 6) { - if ($bExport) { - print "$subjmedian[$fidx][0]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($i==3) { - $subjmean[$fidx][3]=int((sqrt(($subjmean[$fidx][3]/$subjmean[$fidx][0])))); - if ($bExport) { - print "$subjmean[$fidx][$i]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "$subjmean[$fidx][$i]\t"; - } else { - print "\t\t\n"; - } - } - } - } - $i=$j-2; - if ($i==3) { - if ($bExport) { - print "\t$meanscore[$i]\t"; - } else { - print "\t\t\n"; - } - } elsif ($i==6) { - if ($bExport) { - print "\t$medianscore[0]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t$meanscore[$i]\t"; - } else { - print "\t\t\n"; - } - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } elsif ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - @rowhdrs=('Unbiased Mean','Std. Dev.','Range-Low','Range-High','Median'); - $rowspan=$#rowhdrs+1; - $symbol="\%"; - #print STDERR Dumper(\@meanscore); - for $j (0 .. $#rowhdrs) { - $i=$j+2; - if ($bExport == 0) { - print "\t\n"; - } - if ($j==0) { - if ($bExport) { - print "\tComposite\n"; - } else { - print "\t\t\n"; - } - } - if ($bExport) { - print "\t$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - if ($j==1) { - if ($bExport) { - print "\t\t$meanscore[$i]"; - } else { - print "\t\t\n"; - } - } elsif ($j==4) { - if ($bExport) { - print "\t\t$medianscore[0]"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t\t$meanscore[$i]"; - } else { - print "\t\t\n"; - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } else { - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } - &print_report_bycnd_footer(); - @subjtot=(); - @subjects=(); - @sorted=(); -} -$^W=0; - -sub print_report_bycnd_header { - my ($ncount,$bysubj,$sorturls,$sortby,$csvurl,$reverseurl,@subjects) = @_; - my $i; - my $titlesfx=""; - my $nsubjects = $#subjects; - my $colspan=$nsubjects+2; - my $colspan2=$nsubjects+2; - if ($bysubj) { - $colspan2+=6; - $titlesfx=" (Subject Area)"; - } else { - $colspan2=9; - } - my $sortspan = int($colspan2/8); # wac changed 4 to 8 to make columns closer - if ($bExport) { - print "$TEST{'desc'} ($TEST{'id'})\n"; - print "Question$titlesfx Response Statistics\n"; - print "$ncount Completed Responses\n"; - print "Candidate\tDate\t"; - if ($bysubj) { - print "BD\t"; - for $i (0 .. $nsubjects) { - print "$subjects[$i]\t"; - } - }; - print "TC\tTI\tTS\n"; - } else { - print "\n"; - print "\n"; - print "\tQuestion Response Statistics\n"; - print "\t\n"; - print "\n"; - print "\n"; - print "
    \n"; - print "$TEST{'desc'} ($TEST{'id'})
    \n"; - print "Question$titlesfx Response Statistics
    \n"; - print "$ncount Completed Responses\n"; - print "
    $colhdr
    $cols[0]$cols[1]$cols[2]
    $rowhdrs[$j]$cols[$qid]$symbol$cols[$fidx++]$cols[$fidx++]$cols[$fidx]\%
    $start$end$duration$cols[$j++]$cols[$j++]$cols[$j]\%Not Scored by Definition

    Composite$rowhdrs[$j]$subjtot[$fidx][$j]$symbol\ \;
    Overall$subjmedian[$fidx][0]$symbol\&\#177$subjmean[$fidx][$i]$symbol$subjmean[$fidx][$i]$symbol\&\#177$meanscore[$i]$symbol$medianscore[0]$symbol$meanscore[$i]$symbol

    Composite$rowhdrs[$j]\&\#177$meanscore[$i]$symbol$medianscore[0]$symbol$meanscore[$i]$symbol


    \n"; - - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - if ($bysubj) { - print "\t\t\n"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - if ($bysubj) { - print "\t\t\n"; - for $i (0 .. $nsubjects) { - print "\t\t\n"; - } - }; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - } - return $colspan2; -} - -sub print_report_bycnd_footer { - if ($bExport) { return;} - print "
    \n"; - foreach (@sortbys) { - if ($_ ne $sortby) { - print "\t\t\t{$_}\">Sort by $_
    \n"; - } else { - print "\t\t\tSorted by $_
    \n"; - } - } - print "\t\t\t
    "; - print "CSV Report\n\t\t\t
     
    "; - print "Change to ".($FORM{'reverse'}?'ascending':'descending')."\n\t\t

    CandidateLoginIDDateSubject AreasStartEndDurationOverall
    \ \;$subjects[$i]CorrectIncorrectScore

    \n"; - print "\n"; - print "\n"; -} - -sub print_report_bycnd_csv { - print "userid,testname,date,score\n"; - my %testlookup; - my $lookupfile = join($pathsep,$dataroot,"namelookup.$CLIENT{'clid'}"); - #print STDERR "Opening $lookupfile\n"; - if (-e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - while ($_ = <$fh>) { - chomp; - my @line = split(/\s+/,$_,2); - $testlookup{$line[0]} = $line[1]; - } - } - } - foreach (@_) { - my @row = @{$_->{'columns'}}; - my ($userid,$testid,$date,$score) = ($row[1],$TEST{'id'},$row[2],$row[$#row]); - if ($testlookup{$testid}) {$testid = $testlookup{$testid};} - print join(',',$userid,$testid,$date,$score)."\n"; - } -} - -sub show_test_composite { - my ($idlist) = @_; - &LanguageSupportInit(); - $mymsg = ""; - my $nresponses=0; - #&get_client_profile($SESSION{'clid'}); - &get_test_profile("integroleadership", $FORM{'tstid'}); - @questions = &get_question_list($TEST{'id'},"integroleadership"); - $qhdr = shift @questions; - @sorted = sort @questions; - @questions = @sorted; - unshift @questions, $qhdr; - @sorted = (); - my @client_data = get_client_list(); - shift @client_data; - foreach (@client_data) { - ($clientID, $trash) = split('&', $_); - push(@filelist, &get_test_result_files($testcomplete, "$clientID", "$TEST{'id'}")); - } - #@client_data = (); - for (1 .. $#questions) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$_]); - if ( $qtp eq 'nrt' ) { - $qca = 'N/A'; - } - $qtx =~ s/\;/
    /g; - #$qtx = $qtx; - ($test,$qid) = split(/\./, $id); - $qstatsid[$qid] = $id; - $qstatsqc[$qid] = 0; # occurrences of question - $qstatsqp[$qid] = 0; # percent occurrences of question - $qstatsqt[$qid] = $qtx; # question text - if ($qil eq 'Y') { - $qstatsqf[$qid] = "obs"; # question type - } else { - $qstatsqf[$qid] = $qtp; # question type - $qallans = ""; - if ($qtp eq 'tf') { - $qallans = "$qca\;$qia\;$xlatphrase[670]"; #670=No Response - } elsif ($qtp eq 'mcs' || $qtp eq 'mca') { - if ($qca eq '') { - $qallans = "$qia\;$xlatphrase[670]"; - } else { - $qallans = "$qca\;$qia\;$xlatphrase[670]"; - } - } elsif ($qtp eq 'mtx' || $qtp eq 'mtr') { - # DED When qca is saved correctly in tdef, - # put this back and delte rest: - # $qallans = "$qca"; - ($qiar, $qiac) = split("RC", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - $qallans = ""; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - $qallans .= "xxx\;"; - } - } - } elsif ($qtp eq 'mcm') { - if ($qca eq '') { - $qallans = "$qia"; - } else { - $qallans = "$qca\;$qia"; - } - } elsif ($qtp eq 'esa') { - if ($qca eq '') { - $qallans = ""; - } else { - $qallans = "$qca"; - } - } elsif ($qtp eq 'nrt') { - if ($qca eq '') { - $qallans = "Other\;$xlatphrase[670]"; - } else { - $qallans = "$qca\;Other\;$xlatphrase[670]"; - } - } elsif ($qtp eq 'mch') { - @qcans = split(/\;/, $qca); - @qians = split(/\;/, $qia); - for (my $i = 0; $i <= $#qcans; $i++ ) { - $qallans = join('', $qallans, "$qcans[$i]===$qians[$i]
    "); - } - } elsif ($qtp eq 'ord') { - $qallans = "$qca"; - } - $qallans =~ s/\;\;/\;/g; - $qstatsqr[$qid] = $qallans; # response options - $fqstatsqr[$qid] = $qallans; ### DED for FBQ - $qstatsqw[$qid] = (); - if (($qtp eq 'mch') || ($qtp eq 'ord')) { - if ($qtp eq 'mch') { - @qstato = split(/
    /, $qallans); - } else { - @qstato = split(/\;/, $qallans); - } - $ncount = $#qstato + 1; - $ncount = int(($ncount * ($ncount + 1)) + 3); - for (my $i = 0; $i <= $ncount; $i++ ) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } elsif ($qtp eq 'mcm' || $qtp eq 'esa' || $qtp eq 'mtx' || $qtp eq 'mtr') { - @qstato = split(/\;/, $qallans); - if ($qtp eq 'mtr') - { - # Have to allow for [1..5] in - # each answer, so make it big! - $ncount = (($#qstato + 1) * 5) + 3; - } - else - { - $ncount = $#qstato + 3; - } - for (my $i = 0; $i <= $ncount; $i++ ) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } else { - @qstato = split(/\;/, $qallans); - foreach $qstat (@qstato) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } - } - @qstato = (); - } - $ncount = $#filelist + 1; - @qucmts=(); - $nresponses=$#filelist+1; - for (my $fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $tmpclientID = $filelist[$fidx]; - $tmpclientID =~ s/^([\w]+).//; - $clientID = $1; - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$clientID.//; - #print STDERR "----> ClientID: $clientID User: $user\n"; - if (defined $idlist and not $idlist->{$user}) { - $nresponses--; - next; - } - my $excuser="inc$user"; - if ($FORM{$excuser}) { - $nresponses--; - next; - } - &get_test_sequence_for_reports( $clientID, $user, $TEST{'id'}); - @qids = split(/\&/, $SUBTEST_QUESTIONS{2}); - @qrsp = split(/\&/, $SUBTEST_RESPONSES{2}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - @corincs = split(/\//, $qsumry[5]); - @qsumry = (); - @qsumry = split(/\&/, $SUBTEST_ANSWERS{2}); - @qansseq = (); - $fqid=""; - $fqididx=""; - for (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$_]); - ($qansord,$trash) = split(/::/, $qsumry[$_]); - $qansord =~ s/\=([0-1])//g; - $qansseq[$_] = $qansord; - - ($qresp,$qucmt) = split(/::/, $qrsp[$_]); - $qresp=~ tr/+/ /; - $qresp=~ tr/'//d; - $qrsp[$_]=$qresp; - - ##### v ADT - 7/03/2002 ################################################ - # Added code to print NRT answers in the form of the comments - ######################################################################## - push @qresponses, "$qidx\&$user\&$qresp"; - ##### ^ ADT - 7/03/2002 ################################################ - - if ($qucmt ne '') { - $qucmt =~ tr/+/ /; - $qucmt =~ tr/'//d; - push @qucmts, "$qidx\&$user\&$qucmt"; - } - ### DED 10/28/2002 Support for filter-by-question (FBQ) - if ($FORM{'question'} eq $qids[$_]) { - $fqididx=$_; - ($trash,$fqid)=split(/\./,$qids[$_]); - } - } - ### DED 10/28/2002 Support for filter-by-question (fbq) - #print "

    FormQues= $FORM{'question'} Ans= $FORM{'answer'} Qansseq= $qansseq[$fqididx]

    \n"; - if ($fqid ne "" && $FORM{'answer'} ne "") { - $fmatch=0; - if ($qstatsqf[$fqid] eq 'mcs' || $qstatsqf[$fqid] eq 'mca') { - @fqansseq=split(/\?/,$qansseq[$fqididx]); - shift @fqansseq; - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - foreach $fans (@fans) { - @ffresp=(); - $fresp=""; - for (0 .. $#fqansseq) { - $fqseqans[$fqansseq[$_]]=$_; - $ffresp[$_]="xxx"; - } - if ($fans ne "No+Response") { - $ffresp[$fqseqans[$fans]]=$fqseqans[$fans]; - } - if ($ffresp[0] eq "") { - $fresp=""; - } else { - foreach (@ffresp) { - $fresp=join('?',$fresp,$_); - } - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "") { - $fmatch=1; - } - @ffresp=(); - if ($fmatch == 1) { break; } - } - @fqansseq=(); - @fans=(); - } elsif ($qstatsqf[$fqid] eq 'mcm') { - @fqansseq=split(/\?/,$qansseq[$fqididx]); - shift @fqansseq; - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - @ffresp=(); - $fresp=""; - for (0 .. $#fqansseq) { - $fqseqans[$fqansseq[$_]]=$_; - $ffresp[$_]="xxx"; - } - if ($fans[0] ne "No+Response") { - foreach (@fans) { - $ffresp[$fqseqans[$_]]=$fqseqans[$_]; - } - } - if ($ffresp[0] eq "") { - $fresp=""; - } else { - foreach (@ffresp) { - $fresp=join('?',$fresp,$_); - } - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "") { - $fmatch=1; - } - @fqansseq=(); - @fans=(); - @ffresp=(); - } elsif ($qstatsqf[$fqid] eq 'tf') { - if ($FORM{'answer'} eq "\&0" ) { - $fresp=$qansseq[$fqididx]; - } elsif ($FORM{'answer'} eq "\&1" ) { - SWITCH: for ($qansseq[$fqididx]) { - $fresp = /TRUE/ && "FALSE" - || /FALSE/ && "TRUE" - || /YES/ && "NO" - || /NO/ && "YES" - || "bad"; - } - } elsif ($FORM{'answer'} eq "\&No+Response") { - $fresp=""; - } else { - $fresp="bad"; - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "bad") { - $fmatch=1; - } - } elsif ($qstatsqf[$fqid] eq 'esa') { - ($fqstatsqr,$trash)=split(/;Other/,$fqstatsqr[$fqid]); - @fqr=split(/\;/,$fqstatsqr); - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - if ($fans[0] eq "No+Response") { - $fqr=""; - if ($fqr eq $qrsp[$fqididx]) { - $fmatch=1; - } - } else { - foreach (@fans) { - $fqr=lc($fqr[$_]); - $fqrsp=lc($qrsp[$fqididx]); - if ($fqr eq $fqrsp && $fqr ne "") { - $fmatch=1; - last; - } - } - } - @fqr=(); - @fans=(); - } - #print "

    FQid= $fqid Qtp= $qstatsqf[$fqid] Qstatsid= $qstatsid[$fqid] Fresp= $fresp Qrsp=$qrsp[$fqididx]

    \n"; - if ($fmatch == 0) { - ### Don't count this one - #print "...Skipping..."; - $nresponses--; - next; - } - $fresp=""; - } - ### DED End fbq support - @qsumry=(); - for (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$_]); - if ($qstatsqf[$qidx] ne 'obs') { - $qstatsqc[$qidx]++; - $qstatsqp[$qidx] = format_percent(($qstatsqc[$qidx] / $ncount), - { fmt => "%.0f" } ); - @qstatc = split(/\;/, $qstatsqrc[$qidx]); - @qstatp = split(/\;/, $qstatsqrp[$qidx]); - if ($qstatsqf[$qidx] eq 'tf') { - @qstato = split(/\;/, $qstatsqr[$qidx]); - if ($qrsp[$_] eq $qstato[0]) { - $qstatc[0]++; - } elsif ($qrsp[$_] eq $qstato[1]) { - $qstatc[1]++; - } else { - $qstatc[2]++; - } - }elsif ($qstatsqf[$qidx] eq 'esa'){ - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/\+/ /g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 1) { - @qansord = split(/\;/, $qansseq[$_]); - for $q (0 .. $#qansord) { - if ($qansord[$q] eq $qresp) { - $qstatc[$q]++; - last; - } - } - } else { # incorrect - $found=0; - @qstatw=split(/\;/,$qstatsqw[$qidx]); - shift(@qstatw); - for $q (0 .. $#qstatw) { - if ($qstatw[$q] eq $qresp) { - $qstatsqwc[$q]++; - $found=1; - last; - } - } - if ($found != 1) { - $qstatsqwc[$#qstatw+1]=1; - $qstatsqw[$qidx]=join(';',$qstatsqw[$qidx],$qresp); - } - @qstatq=(); - } - } else { - $qstatc[$#qstatc]++; - } - @qansord = (); - }elsif ($qstatsqf[$qidx] eq 'nrt'){ - if ($qrsp[$_] ne '') { - $qstatc[1]++; - $qrsp[$_] =~ s/\;/\:/g; - $qrsp[$_] =~ s/\r//g; - $qrsp[$_] =~ s/\n/\\n/g; - - $qstatsqr[$qidx] = join('
    ',$qstatsqr[$qidx],$qrsp[$_]); - } else { - $qstatc[2]++; - } - } elsif ($qstatsqf[$qidx] eq 'mcs' || $qstatsqf[$qidx] eq 'mca') { - ### DED Filter out "?" and "xxx" in qrsp so will match - $qrsp[$_] =~ s/\?//g; - $qrsp[$_] =~ s/xxx//g; - @qansord = split(/\?/, $qansseq[$_]); - shift @qansord; - $found = 0; - ### DED 10/09/02 Changed to allow for - ### randomized answers - #for (my $i = 0; $i <= $#qansord; $i++ ) { - #if (("$qansord[$i]" eq "$qrsp[$_]") && ($qrsp[$_] ne '')) { - if ($qrsp[$_] ne '') { - $qstatc[$qansord[$qrsp[$_]]]++; - $found = 1; - } - #} - unless ($found) { - # increment "No Response" - $qstatc[$#qstatc]++; - } - @qansord = (); - } elsif ($qstatsqf[$qidx] eq 'mtx') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qidx]); - ($qiar, $qiac) = split("RC", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - - # skipping answer sequence part (no rand answ) - $holding3 = $_; - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - $i=0; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - if ($qresps[$i] ne "xxx") { - $qstatc[$i]++; - } - $i++; - } - } - } - } else { - # increment No Response counter - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mtr') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qidx]); - ($qiar, $qiac) = split("RC", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - - # skipping answer sequence part (no rand answ) - $holding3 = $_; - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - $iqresps=0; - $iqstatc=0; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - if ($qresps[$iqresps] ne "xxx") - { - # $qresps[$iqresps] will be [1..5], so adjust index accordingly - $irank = $iqstatc + $qresps[$iqresps] - 1; - $qstatc[$irank]++; - } - $iqresps++; - $iqstatc += 5; - } - } - } - } else { - # increment No Response counter - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mcm') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - @qansord = split(/\?/, $qansseq[$_]); - shift @qansord; - $holding3 = $_; - #$found = 0; - ### DED 10/18/02 Changed to allow for - ### randomized answers & new format - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - foreach $qresp (@qresps) { - if ($qresp ne "xxx") { - $qstatc[$qansord[$qresp]]++; - } - } - } - } else { - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mch') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - ### DED 10/18/02 Changed for - ### random answers and new format - - # - # Count occurrence of each match - - # $qansseq[$qidx] [Wrong! DED] - # $qansseq[$_] - # &a.3.2.0.6.5.8.4.7.1::MATCH.0:1:1:0 - # $qrsp[$_] - # &dgihbfcea [Old format] - # &?d?g?i?h?b?f?c?e?a [New] - - #$qansseq[$qidx] =~ s/\&//g; - $qansseq[$_] =~ s/\&//g; - $qrsp[$_] =~ s/\&//g; - $qrsp[$_] =~ s/ //g; - #@corord = split(/\./, $qansseq[$qidx]); - @corord = split(/\./, $qansseq[$_]); - #@selord = split(//,$qrsp[$_]); - @selord = split(/\?/,$qrsp[$_]); - shift @selord; - $corhold = $_; - if ($corinc == 0) { - for (0 .. $#selord) { - if ($selord[$_] ne 'xxx') { - ($x = &get_label_index($corord[0],$selord[$_]))++; - $y = $corord[$x]; - - #$ncountidx = int($_ * $#corord + $y); - $ncountidx = int($y * $#corord + $_); - } else { - $ncountidx = int(($#corord * $#corord ) + $_); - } - $qstatc[$ncountidx]++; - } - } - $_ = $corhold; - @selord = (); - @corord = (); - } else { - $qstatc[$#qstatc]++; - } - } elsif ($qstatsqf[$qidx] eq 'ord') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - ### DED 10/18/02 Changed for - ### random answers and new format - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - # - # Count occurrence of each incorrect order - # &o.2.3.4.1.0::ORDERED.0:1:1:0 - # &34521 [Old format] - # &?3?4?5?2?1 [New] - # - #$qansseq[$qidx] =~ s/\&//g; - $qansseq[$_] =~ s/\&//g; - $qrsp[$_] =~ s/\&//g; - #@corord = split(/\./, $qansseq[$qidx]); - @corord = split(/\./, $qansseq[$_]); - #@selord = split(//,$qrsp[$_]); - @selord = split(/\?/,$qrsp[$_]); - shift @selord; - $corhold = $_; - if ($corinc == 0) { - for (1 .. $#corord) { - $ncountidx = int(($corord[$_]) * $#corord); - $x = int($_ - 1); - if ($selord[$x] ne 'xxx') { - $ncountidx = $ncountidx + int($selord[$x]) - 1; - } else { - $ncountidx = int(($#corord * $#corord) + $_ - 1); - } - $qstatc[$ncountidx]++; - } - } - $_ = $corhold; - @selord = (); - @corord = (); - } else { - $qstatc[$#qstatc]++; - } - } - ### DED 8/20/2002 If checked, don't count - ### "No Response" in statistics - if ($FORM{'exnoresp'}) { - if ($qstatsqc[$qidx] > $qstatc[$#qstatc]) { - $denom = $qstatsqc[$qidx] - $qstatc[$#qstatc]; - } else { - $denom = 1; - } - for (my $i = 0; $i <= $#qstatc-1; $i++ ) { - $qstatp[$i] = format_percent($qstatc[$i] / $denom); - } - } else { - for (my $i = 0; $i <= $#qstatc; $i++ ) { - $qstatp[$i] = format_percent($qstatc[$i] / $qstatsqc[$qidx]); - } - } - - $qstatsqrc[$qidx] = ""; - foreach $qstat (@qstatc) { - $qstatsqrc[$qidx] = join('', $qstatsqrc[$qidx], "$qstat\;"); - } - $qstatsqrp[$qidx] = ""; - ### DED 8/22/2002 Exclude "No Response" - ### from statistics - if ($FORM{'exnoresp'}) { - $count = $#qstatc-1; - } else { - $count = $#qstatp - } - for (0 .. $count) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstatp[$_]\;"); - } - } - if (($qstatsqf[$qidx] eq 'mcm') || ($qstatsqf[$qidx] eq 'mch') || ($qstatsqf[$qidx] eq 'ord') || ($qstatsqf[$qidx] eq 'mtx') || ($qstatsqf[$qidx] eq 'mtr')) { - $npctidxend = $#qstatc - 3; - $nincidx = $#qstatc - 1; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $npctidxend; $i++ ) { - if ($ntotinc == 0) { - $qstatp[$i] = 0; - } else { - $qstatp[$i] = format_percent($qstatc[$i] / $ntotinc); - } - } - $qstatsqrp[$qidx] = ""; - foreach $qstat (@qstatp) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstat\;"); - } - } elsif ($qstatsqf[$qidx] eq 'esa') { - $npctidxend = $#qstatc - 3; - $ncoridx = $#qstatc - 2; - $nincidx = $#qstatc - 1; - $ntotcor = $qstatc[$ncoridx]; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $npctidxend; $i++ ) { - if ($ntotcor == 0) { - $qstatp[$i] = 0; - } else { - $qstatp[$i] = format_percent($qstatc[$i] / $ntotcor); - } - } - $qstatsqrp[$qidx] = ""; - foreach $qstat (@qstatp) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstat\;"); - } - $nincidx = $#qstatc - 1; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $#qstatsqwc; $i++ ) { - if ($ntotinc == 0) { - $qstatsqwp[$i] = 0; - } else { - $qstatsqwp[$i] = format_percent($qstatsqwc[$i] / $ntotinc); - } - } - } - @qstato = (); - @qstatc = (); - @qstatp = (); - } -} - -if ($#qucmts != -1) { - @qsumry=sort @qucmts; - @qucmts=@qsumry; - @qsumry=(); -} -print " - - - - -

    -$TEST{'desc'} ($TEST{'id'})
    -Question Response Statistics
    "; -if (defined $idlist) { - print "Groups: ".join(", ",split(/,/,$FORM{'idlist'}))."
    \n"; -} - -print "$nresponses Completed Responses - - - - - - - - - - - - - - -"; -$sobsolete = ""; -if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $incresponse = ""; -} else { - $incresponse = "INCORRECT"; -} -for (1 ..$#questions) { - ($test,$qid) = split(/\./, $qstatsid[$_]); - if ($qstatsqf[$qid] eq 'obs') { - if ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') { - $sobs = " - - - - - - -"; - $sobsolete = join('', $sobsolete, $sobs); - } - } else { - if (($qstatsqf[$qid] eq 'mcm') || ($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord') || ($qstatsqf[$qid] eq 'esa') || ($qstatsqf[$qid] eq 'mtx') || ($qstatsqf[$qid] eq 'mtr')) { - if ($qstatsqf[$qid] eq 'mch') { - @qstato = split(/
    /, $qstatsqr[$qid]); - } else { - @qstato = split(/\;/, $qstatsqr[$qid]); - } - if ($qstatsqf[$qid] eq 'esa') { - @qstatw = split(/\;/, $qstatsqw[$qid]); - shift @qstatw; - } - $rowspan1 = ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') ? 5 : 4; - $rowspan2 = ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') ? 5 : 4; - } else { - @qstato = split(/\;/, $qstatsqr[$qid]); - if ( $qstatsqf[$qid] eq 'nrt' ){ - $qstato[1] =~ s/\/\//
    /g; - $qstato[1] =~ s/\//
    /g; - $qstato[1] =~ s/:/
    /g; - $qstato[1] =~ s/\+/ /g; - } - $rowspan1 = 2; - $rowspan2 = 2; - } - if ($FORM{'showcmts'} eq 'withq') { - $rowspan1++; - $rowspan2++; - } - print " - - - - - - "; - - @qstatc = split(/\;/, $qstatsqrc[$qid]); - @qstatp = split(/\;/, $qstatsqrp[$qid]); - if (($qstatsqf[$qid] eq 'mcm') || ($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord') || $qstatsqf[$qid] eq 'esa' || $qstatsqf[$qid] eq 'mtx' || $qstatsqf[$qid] eq 'mtr') { - $ncountidx = $#qstatc - 2; - $qstatccor = $qstatc[$ncountidx]; - $qstatpcor = $qstatp[$ncountidx]; - $qstatcinc = $qstatc[$ncountidx+1]; - $qstatpinc = $qstatp[$ncountidx+1]; - $qstatcnor = $qstatc[$ncountidx+2]; - $qstatpnor = $qstatp[$ncountidx+2]; - if ($TEST{'seq'} ne svy && $TEST{'seq'} ne dmg) { - print " - - - - - "; - print " - - - - - "; - } else { - print " - - - - - "; - } - print " - - "; - if ($FORM{'exnoresp'}) { - print "\n"; - } else { - print "\n"; - } - print " - -"; - } - if (($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord')) { - if ($qstatsqf[$qid] eq 'mch') { - $sphrase = "(matched to \>\;\>\;\>\;)"; - @matchwords = (); - @matchtos = (); - foreach $qstat (@qstato) { - ($matchword, $matchto) = split(/\=\=\=/, $qstat); - push @matchwords, $matchword; - push @matchtos, $matchto; - } - push @matchtos, "Left Blank"; - } else { - $sphrase = "(ordered as number \>\;\>\;\>\;)"; - @matchwords = (); - @matchtos = @qstato; - $matchidx = 1; - foreach $qstat (@qstato) { - push @matchwords, "$matchidx"; - $matchidx++; - } - push @matchtos, "Not Used"; - } - $colspan = int((($#matchwords + 1) * 2) + 1); - print " - - "; - } elsif ($qstatsqf[$qid] eq 'mtx' || $qstatsqf[$qid] eq 'mtr') { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qid]); - ($qiar, $qiac) = split("RC", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - $holdmcm = $_; - if ($qstatsqf[$qid] eq 'mtr') - { - $colspan = ($#qiac + 1) * 3 + 1; - $colspan2 = 3; - } - else - { - $colspan = ($#qiac + 1) * 2 + 1; - $colspan2 = 2; - } - print " - - - "; - } elsif ($qstatsqf[$qid] eq 'mcm') { - print " - - - "; - } elsif ($qstatsqf[$qid] eq 'esa') { - print " - - - "; - } elsif ($qstatsqf[$qid] eq 'nrt' ) { - - ##### v ADT - 7/03/2002 ################################################ - # If you want to remove the NRT statistics, delete between these comments - ######################################################################## - print " - - - - - "; - ##### ^ ADT - 7/03/2002 - End Delete ################################### - - ##### v ADT - 7/03/2002 ################################################ - # Added code to print NRT answers in the form of the comments - ######################################################################## - #print "\n\t\n\t\t\n\t\n"; - ##### ^ ADT - 7/03/2002 ################################################ - - } else { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $bs = ""; - $be = ""; - } else { - $bs = ""; - $be = ""; - } - print " - - - - - \n"; - } - if (($FORM{'showcmts'} eq 'withq') && ($#qucmts != -1)) { - ##### v ADT - 7/03/2002 ################################################ - # Modified code to add the comments to the same table cell as the - # answers if the question is a Narrative question - ######################################################################## - if( $qstatsqf[$qid] ne 'nrt' ) { - print "\t\n\t\t - \n"; - } - print " - - - \n"; - @qstato = (); - @qstatc = (); - @qstatp = (); - } -} -if (($FORM{'showcmts'} eq 'atend') && ($#qucmts != -1)) { - print "\n"; - print "\n"; - print "\n\n"; -} -@qucmts=(); -if ($FORM{'showobs'}) { - print "$sobsolete"; -} -print " -

    IDOccPctQuestion Text
    CntPctOptions

    $qstatsid[$_]INACTIVE$qstatsqt[$qid]

    $qstatsid[$_]$qstatsqc[$qid]$qstatsqp[$qid]\%$qstatsqt[$qid]
    $qstatccor$qstatpcor\%$xlatphrase[137]
    $qstatcinc$qstatpinc\%INCORRECT
    $qstatcinc$qstatpinc\%RESPONSES
    $qstatcnor $qstatpnor\%$xlatphrase[670]
    - - - - - - "; - foreach $matchword (@matchwords) { - print " - "; - } - print " - - "; - foreach $matchword (@matchwords) { - print " - - "; - } - print " - "; - $matchidx = 0; - foreach $matchto (@matchtos) { - print " - "; - if ($matchto eq $matchtos[$#matchtos]) { - print " - "; - } else { - print " - "; - } - foreach $matchword (@matchwords) { - print " - - "; - $matchidx++; - } - print " - "; - } - print " -
    BREAKDOWN OF $incresponse RESPONSES
    $sphrase$matchword
    CntPct
    $matchto$matchto$qstatc[$matchidx]$qstatp[$matchidx]\%
    -
    - - - - - - "; - foreach $qiacol (@qiac) - { - print ""; - } - print "\n - - "; - foreach $qiacol (@qiac) - { - if ($qstatsqf[$qid] eq 'mtr') - { - print ""; - } - print " - "; - } - print "\n\n"; - $i=0; - foreach $qiarow (@qiar) - { - print " - "; - foreach $qiacol (@qiac) - { - if ($qstatsqf[$qid] eq 'mtr') - { - print ""; - print ""; - print ""; - $i += 5; - } - else - { - print ""; - print ""; - $i++; - } - } - print "\n\n"; - } - print "\n
    BREAKDOWN OF $incresponse RESPONSES
     $qiacol
     RankCntPct
    $qiarow"; - for $irank (1 .. 5) - { - print "$irank
    "; - } - print "
    "; - for $irank (1 .. 5) - { - print "$qstatc[$i+$irank-1]
    "; - } - print "
    "; - for $irank (1 .. 5) - { - print "$qstatp[$i+$irank-1]\%
    "; - } - print "
    $qstatc[$i]$qstatp[$i]\%
    -
    - - - - - - - - - - - - - - -
    BREAKDOWN OF $incresponse RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstato) { - print "$qstat
    "; - } - print "
    -
    "; - $holdmcm = $_; - $endidx = $#qstatc - 3; - for (0 .. $endidx) { - print "$qstatc[$_]
    "; - } - print "
    -
    "; - for (0 .. $endidx) { - print "$qstatp[$_]\%
    "; - } - $_ = $holdmcm; - print "
    -
    -
    - - - - - - - - - - - - - - -
    BREAKDOWN OF $xlatphrase[137] RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstato) { - print "$qstat
    "; - } - print "
    -
    "; - $holdmcm = $_; - $endidx = $#qstatc - 3; - for (0 .. $endidx) { - print "$qstatc[$_]
    "; - } - print "
    -
    "; - for (0 .. $endidx) { - print "$qstatp[$_]\%
    "; - } - $_ = $holdmcm; - print "
    -
    -

    "; - print " - - - - - - - - - - - - - - -
    BREAKDOWN OF $incresponse RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstatw) { - print "$qstat
    "; - } - print "
    -
    "; - $holdmcm = $_; - foreach (@qstatsqwc) { - print "$_
    "; - } - print "
    -
    "; - foreach (@qstatsqwp) { - print "$_\%
    "; - } - $_ = $holdmcm; - print "
    -
    -

    "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - print"$qstatc[2]
    $qstatc[1]"; - } else { - print"$qstatc[0]
    $qstatc[2]
    $qstatc[1]"; - } - print "
    -
    "; - if ($FORM{'exnoresp'}) { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - print" 
    $qstatp[1]\%"; - } else { - print"$qstatp[0]\%
     
    $qstatp[1]\%"; - } - } else { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - print"$qstatp[2]\%
    $qstatp[1]\%"; - } else { - print"$qstatp[0]\%
    $qstatp[2]\%
    $qstatp[1]\%"; - } - } - print "
    -
    "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - print"$qstato[2]
    $qstato[1]"; - } else { - print"$qstato[0]
    $qstato[2]
    $qstato[1]"; - } - print "
    -
    "; - #print "\n\t\t\t\n\t\t\t\t\n"; - #print "\t\t\t\t\t\n"; - #print "\t\t\t\t\t\n"; - #print "\t\t\t\t\n"; - #print "\t\t\t
    Answers:
    "; - #for $i (0 .. $#qresponses) { - #@columns=split(/\&/, $qresponses[$i]); - #if ($columns[0] eq $qid) { - #print "$columns[1]\:
    \n"; - #while (length($columns[2]) > 50) { - #$j=index($columns[2]," ",45); - #if ($j==-1) { - #$qresponse=substr($columns[2],0,50); - #$columns[2]=substr($columns[2],50); - #} else { - #$qresponse=substr($columns[2],0,$j); - #$j++; - #$columns[2]=substr($columns[2],$j); - #} - #print "$qresponse
    \n"; - #} - #print "$columns[2]
    \n"; - #} - #} - # - #print "
    \n\t\t
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstatc) { - print "$boldtag$qstat$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - print "
    -
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstatp) { - print "$boldtag$qstat\%$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - print "
    -
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstato) { - print "$boldtag$qstat$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - print "
    -
    \n\t\t\t"; - } - print " - - - -
    \nComments:
    \n"; - ##### ^ ADT - 7/03/2002 ################################################ - for $i (0 .. $#qucmts) { - @columns=split(/\&/, $qucmts[$i]); - if ($columns[0] eq $qid) { - print "$columns[1]\:
    \n"; - while (length($columns[2]) > 50) { - $j=index($columns[2]," ",45); - if ($j==-1) { - $qucmt=substr($columns[2],0,50); - $columns[2]=substr($columns[2],50); - } else { - $qucmt=substr($columns[2],0,$j); - $j++; - $columns[2]=substr($columns[2],$j); - } - print "$qucmt
    \n"; - } - print "$columns[2]
    \n"; - } - } - print "
    -


    Comments
    \n"; - print "\n"; - for (1 ..$#questions) { - ($test,$qid) = split(/\./, $qstatsid[$_]); - if ($qstatsqf[$qid] ne 'obs') { - for $i (0 .. $#qucmts) { - @columns=split(/\&/, $qucmts[$i]); - if ($columns[0] eq $qid) { - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - } - } - print "\n"; - } - } - print "\n\n
    IDUserComments
    $qstatsid[$_]$columns[1]\n"; - while (length($columns[2]) > 70) { - $j=index($columns[2]," ",65); - if ($j==-1) { - $qucmt=substr($columns[2],0,70); - $columns[2]=substr($columns[2],70); - } else { - $qucmt=substr($columns[2],0,$j); - $j++; - $columns[2]=substr($columns[2],$j); - } - print "$qucmt
    \n"; - } - print "$columns[2]
    \n"; - print "

    \n
    - - -"; -} - -# -# -# diff --git a/survey-nginx/cgi-bin/IntegroTS.pl.bu20100325 b/survey-nginx/cgi-bin/IntegroTS.pl.bu20100325 deleted file mode 100755 index ce99b7008..000000000 --- a/survey-nginx/cgi-bin/IntegroTS.pl.bu20100325 +++ /dev/null @@ -1,2278 +0,0 @@ -#!/usr/bin/perl -# -# $Id: IntegroTS.pl,v 1.5 2006/04/12 19:18:47 ddoughty Exp $ -# -# Source File: teststats.pl - -# Get config -# use strict; -use FileHandle; -use Time::Local; -use Data::Dumper; -use URI::Escape; -require 'sitecfg.pl'; -require 'testlib.pl'; -require 'tstatlib.pl'; -require 'ui.pl'; - -#use strict; -use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST - %SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS); -use vars qw($testcomplete $cgiroot $pathsep $dataroot ); - -&app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -&get_session($FORM{'tid'}); -&get_client_profile($SESSION{'clid'}); -my @sortbys = qw(Name LoginID Date); -my ($bExport,$idlist); -#print STDERR Dumper(\%FORM,\%CLIENT,\%SESSION); -if (exists $FORM{'grouping'} and $FORM{'grouping'} eq 'subset') { - $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 "
    ".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 (defined $timestamp) { - $timestamp = "$timestamp

    \n"; -} else { - $timestamp = "
    \n"; -} - -if ($FORM{'export'}) { - print "Content-Type: application/doc\n\n"; - $bExport=1; -} elsif ($FORM{'csv'}) { - print "Content-Type: text/x-csv\n\n"; -} else { - print "Content-Type: text/html\n\n"; - $bExport=0; -} -#print STDERR Dumper(\%FORM,$idlist); -if (&get_session($FORM{'tid'})) { - if ($FORM{'testsummary'} eq 'composite') { - &show_test_composite($idlist); - } elsif ($FORM{'testsummary'} eq 'bycnd') { - &show_test_resultsbycnd($idlist); - } else { - &extract_test_data(); - } -} -if ($bExport) { - exit(0); -} - -sub extract_test_data() { - &LanguageSupportInit(); - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - my @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - my @colhdrs=(); - push @colhdrs,""; - if ($FORM{'cndnme'}) { - push @colhdrs,"left:Last Name"; - push @colhdrs,"left:First Name"; - push @colhdrs,"left:MI"; - } - push @colhdrs,"left:User ID"; - if ($FORM{'cndeml'}) { - push @colhdrs,"left:Email Address"; - } - if ($FORM{'cnd1'}) { - push @colhdrs,"left:$CLIENT{'clcnd1'}"; - } - if ($FORM{'cnd2'}) { - push @colhdrs,"left:$CLIENT{'clcnd2'}"; - } - if ($FORM{'cnd3'}) { - push @colhdrs,"left:$CLIENT{'clcnd3'}"; - } - if ($FORM{'cnd4'}) { - push @colhdrs,"left:$CLIENT{'clcnd4'}"; - } - if ($FORM{'cndscr'}) { - push @colhdrs,"center:Correct"; - push @colhdrs,"center:Incorrect"; - push @colhdrs,"right:Score"; - } - my @dataflds=(); - my @unsorted=(); - my $row=""; - my @qsumry=(); - my $user=""; - my $joint="\&"; - my $colhdr; - my $colalgn; - my $fidx; - for ($fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - my $excuser="inc$user"; - if ($FORM{$excuser}) { - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - &get_candidate_profile($CLIENT{'clid'},$user); - if ($FORM{'cndnme'}) { - $row=join($joint,$row,"$CANDIDATE{'nml'}"); - $row=join($joint,$row,"$CANDIDATE{'nmf'}"); - $row=join($joint,$row,"$CANDIDATE{'nmm'}"); - } - $row=join($joint,$row,"$user"); - if ($FORM{'cndeml'}) { - $row=join($joint,$row,"$CANDIDATE{'eml'}"); - } - if ($FORM{'cnd1'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd1'}"); - } - if ($FORM{'cnd2'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd2'}"); - } - if ($FORM{'cnd3'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd3'}"); - } - if ($FORM{'cnd4'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd4'}"); - } - if ($FORM{'cndscr'}) { - $row=join('&',$row,$qsumry[0],$qsumry[1],$qsumry[2]); - } - push @unsorted, $row; - $row=""; - } - my @sorted=sort @unsorted; - @unsorted=(); - my $rowcount=$#filelist+1; - &print_report_dataextract_header($rowcount,@colhdrs,@colalign); - my ($i); - for $i (0 .. $#sorted) { - @dataflds=split($joint, $sorted[$i]); - if ($bExport) { - for $i (1 .. $#dataflds) { - print "$dataflds[$i]"; - if ($i == $#dataflds) { - print "\n"; - } else { - print "\t"; - } - } - } else { - print "\n"; - for $i (1 .. $#dataflds) { - ($colalgn,$colhdr) = split(/:/,$colhdrs[$i]); - print "\t\t$dataflds[$i]\n"; - } - print "\n"; - } - } - &print_report_bycnd_footer(); - @sorted=(); -} - -sub print_report_dataextract_header { - my ($ncount,@cols)= @_; - my $colhdr; - my $colalgn; - my $i; - if ($bExport) { - print "$TEST{'desc'}\n"; - print "Raw Data Extraction\n"; - print "$ncount Completed Responses\n"; - for $i (1 .. $#cols) { - ($colalgn,$colhdr) = split(/:/,$cols[$i]); - print "$colhdr"; - if ($i == $#cols) { - print "\n"; - } else { - print "\t"; - } - } - } else { - print "\n"; - print "\n"; - print "\tTest Data Extraction\n"; - print "\t\n"; - print "\n"; - print "\n"; - print "
    \n"; - print "$TEST{'desc'}
    \n"; - print "Raw Data Extraction
    \n"; - print "$ncount Completed Responses\n"; - #print "\n"; - print "
    \n"; - print "\t\n"; - for $i (1 .. $#cols) { - ($colalgn,$colhdr) = split(/:/,$cols[$i]); - print "\t\t\n"; - } - print "\t<\TR>\n"; - } -} - -sub date_out_of_range { - my ($completedat,$datefm,$dateto) = @_; - my @unsorted=(); - push @unsorted, $completedat; - push @unsorted, $datefm; - push @unsorted, $dateto; - my @sorted = sort @unsorted; - my $bretyes = ($sorted[1] eq $unsorted[0]) ? 0 : 1; - @unsorted=(); - @sorted=(); - return $bretyes; -} - -$^W=1; -sub sort_test_results { - my ($sortby,@rows) = @_; - if ($sortby eq 'Name') { - #print STDERR "by Name\n"; - return sort {$a->{'columns'}->[0] cmp $b->{'columns'}->[0];} @rows; - } elsif ($sortby eq 'LoginID') { - #print STDERR "by LoginID\n"; - return sort {$a->{'columns'}->[1] cmp $b->{'columns'}->[1];} @rows; - } elsif ($sortby eq 'Date') { - #print STDERR "by Date\n"; - return sort {$a->{'end'} <=> $b->{'end'};} @rows; - } else { - #print STDERR "by Nothing\n"; - return @rows; - } -} - -sub show_test_resultsbycnd { - &LanguageSupportInit(); - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - my @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - my ($url) = ("$cgiroot/teststats.pl?"); - if (not $FORM{'sortby'}) {$FORM{'sortby'}=$sortbys[0];} - if (not $FORM{'reverse'}) {$FORM{'reverse'}=0;} - foreach (keys %FORM) { - if (($_ ne 'sortby') and ($_ ne 'reverse') and ($FORM{$_} !~ /\s+/)) { - #print STDERR "$_=$FORM{$_}\n"; - $url .= "&$_=$FORM{$_}"; - } else { - #print STDERR "NOT $_=$FORM{$_}\n"; - } - } - my $csvurl = $url."&csv=1&sortby=$FORM{'sortby'}&reverse=".($FORM{'reverse'}?0:1); - my $reverseurl = $url."&sortby=$FORM{'sortby'}&reverse=".($FORM{'reverse'}?0:1); - my %sorturls; - foreach my $sorter (@sortbys) { - $sorturls{$sorter} = $url."&sortby=$sorter"; - } - my @sorted=(); - my @unsorted=(); - my $user; - my $test; - my $qidx; - my $trash; - my $subjskl; - my $subj; - my $sklvl; - my $subjlist=","; - my @qids=(); - my @qsumry=(); - my @corincs=(); - my $bysubjflag = ($FORM{'statsbysubj'} ne '') ? 1 : 0; - my @subjects=(); - my @subjcnts=(); - my @subjtot=(); - my @subjmean=(); - my @subjmedian=(); - my @meanscore=split('\,',"0,0,0,0,100,0,0"); - my @medianscore=(); - my $i=0; - my $j=0; - my $fidx; - my @rows=(); - my $row={}; - my @answ=(); - my $qid; - my $usrnm; - my $nresultcount=$#filelist+1; - my $mtime; - my $completedat; - my $displaydate; - if ($FORM{'mofm'} < 10) { $FORM{'mofm'}="0$FORM{'mofm'}";} - if ($FORM{'moto'} < 10) { $FORM{'moto'}="0$FORM{'moto'}";} - if ($FORM{'dyfm'} < 10) { $FORM{'dyfm'}="0$FORM{'dyfm'}";} - if ($FORM{'dyto'} < 10) { $FORM{'dyto'}="0$FORM{'dyto'}";} - my $datefm="$FORM{'yrfm'}\-$FORM{'mofm'}\-$FORM{'dyfm'}"; - my $dateto="$FORM{'yrto'}\-$FORM{'moto'}\-$FORM{'dyto'}"; - for ($fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - my $history = get_testhistory_from_log($CLIENT{'clid'},$user,$FORM{'tstid'}); - if (not defined $history) { - #print STDERR "$user from history.\n"; - $history = get_cnd_test_from_history($testcomplete,$CLIENT{'clid'},$user,$FORM{'tstid'}); - } else { - #print STDERR "$user from log.\n"; - } - if (not defined $history) { - # no log file entry for this test - #print STDERR "$user inferred from $testcomplete.$pathsep.$filelist[$fidx]\n"; - my $mtime = (stat($testcomplete.$pathsep.$filelist[$fidx]))[9]; - $history->{'end'} = $mtime; - $history->{'start'} = $history->{'end'}; - #print STDERR Dumper($history); - } - #$trash=join($pathsep,$testcomplete,$filelist[$fidx]); - #open (TMPFILE, "<$trash"); - #$mtime = (stat(TMPFILE))[9]; - #close TMPFILE; - $completedat = &format_date_time("yyyy-mm-dd", "1", "-10000", $history->{'end'}); - $displaydate = &format_date_time("dd-mmm-yyyy", "1", "-10000", $history->{'end'}); - #print STDERR "$completedat $displaydate $datefm $dateto\n"; - if (&date_out_of_range($completedat,$datefm,$dateto)) { - $nresultcount--; - next; - } - my $excuser="inc$user"; - if ($FORM{$excuser}) { - $nresultcount--; - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qids = split(/\&/, $SUBTEST_QUESTIONS{2}); - @answ=split(/\&/,$SUBTEST_ANSWERS{2}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - @corincs = split(/\//, $qsumry[$#qsumry]); - for $i (0 .. $#subjects) { - $subjcnts[$i][0]=0; - $subjcnts[$i][1]=0; - $subjcnts[$i][2]=0; - $subjcnts[$i][3]=0; - } - &get_candidate_profile($CLIENT{'clid'},$user); - $usrnm="$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}"; - $row={'columns' => [$usrnm,$user,$displaydate]}; - $row->{'start'} = $history->{'start'}; - $row->{'end'} = $history->{'end'}; - #print STDERR "Survey = $TEST_SESSION{'srvy'}\n"; - if ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - for $qid (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$qid]); - ($trash,$subjskl) = split(/::/, $answ[$qid]); - ($subj,$sklvl,$trash)=split(/\.|\:/,$subjskl); - unless ($subjlist =~ /\,$subj\,/i) { - $subjlist = join('',$subjlist,"$subj\,"); - push @subjects,"$subj"; - $i=$#subjects; - $subjcnts[$i][0]=0; # questions in subject area - $subjcnts[$i][1]=0; # correct answers - $subjcnts[$i][2]=0; # incorrect answers - $subjcnts[$i][3]=0; # pct correct - $subjtot[$i][0]=0; - $subjtot[$i][1]=0; - $subjtot[$i][2]=0; - $subjtot[$i][3]=0; - $subjmean[$i][0]=0; # population count - $subjmean[$i][1]=0; # population value summation - $subjmean[$i][2]=0; # population mean - $subjmean[$i][3]=0; # population standard deviation - $subjmean[$i][4]=100; # population range-low - $subjmean[$i][5]=0; # population range-high - } - for $i (0 .. $#subjects) { - if ($subj eq $subjects[$i]) { - $subjcnts[$i][0]++; - $subjtot[$i][0]++; - if (substr($corincs[$qid],0,1) eq '1') { - $subjcnts[$i][1]++; - $subjtot[$i][1]++; - } else { - $subjcnts[$i][2]++; - $subjtot[$i][2]++; - } - $subjcnts[$i][3]=int((($subjcnts[$i][1]/$subjcnts[$i][0])*100)); - $subjtot[$i][3]=int((($subjtot[$i][1]/$subjtot[$i][0])*100)); - last; - } - } - } - if ($bysubjflag) { - for $i (0 .. $#subjects) { - push @{$row->{'columns'}},$subjcnts[$i][0],$subjcnts[$i][1],$subjcnts[$i][2],$subjcnts[$i][3]; - $subjmean[$i][0]++; - $subjmean[$i][1]+=$subjcnts[$i][3]; - $subjmean[$i][2]=int(($subjmean[$i][1]/$subjmean[$i][0])); - #$subjmean[$i][4]=(($subjcnts[$i][3] < $subjmean[$i][4]) || ($subjmean[$i][4] == 0)) ? $subjcnts[$i][3] : $subjmean[$i][4]; - $subjmean[$i][4]=($subjcnts[$i][3] < $subjmean[$i][4]) ? $subjcnts[$i][3] : $subjmean[$i][4]; - $subjmean[$i][5]=($subjcnts[$i][3] > $subjmean[$i][5]) ? $subjcnts[$i][3] : $subjmean[$i][5]; - $subjmedian[$i][$fidx]=$subjcnts[$i][3]; - $subjcnts[$i][0]=0; - $subjcnts[$i][1]=0; - $subjcnts[$i][2]=0; - $subjcnts[$i][3]=0; - } - } - $meanscore[0]++; # data count - $meanscore[1]+=$qsumry[2]; # sum of values - $meanscore[2]=int(($meanscore[1]/$meanscore[0])); # unbiased population mean - $meanscore[4]=($qsumry[2] < $meanscore[4]) ? $qsumry[2] : $meanscore[4]; - $meanscore[5]=($qsumry[2] > $meanscore[5]) ? $qsumry[2] : $meanscore[5]; - $medianscore[$fidx]=$qsumry[2]; - } - push @{$row->{'columns'}},$qsumry[0],$qsumry[1],$qsumry[2]; - push @rows, $row; - } - @sorted=sort {$a <=> $b} @medianscore; - $j=$#sorted/2; - $i=$sorted[$j]; - if (($#sorted % 2) == 0) { - @medianscore=(); - $medianscore[0]=$i; - } else { - $j++; - $i+=$sorted[$j]; - @medianscore=(); - $medianscore[0]=int(($i/2)); - } - my @scores=(); - for $i (0 .. $#subjects) { - for $j (0 .. $#filelist) { - $scores[$j]=$subjmedian[$i][$j]; - } - @sorted=sort {$a <=> $b} @scores; - @scores=(); - $j=$#sorted/2; - $qid=$sorted[$j]; - if (($#sorted % 2) == 0) { - $subjmedian[$i][0]=$qid; - } else { - $j++; - $qid+=$sorted[$j]; - $subjmedian[$i][0]=int(($qid/2)); - } - } - # The sorting block - if ($FORM{'reverse'}) { - @sorted = reverse &sort_test_results($FORM{'sortby'},@rows); - } else { - @sorted = &sort_test_results($FORM{'sortby'},@rows); - } - # end of the sorting block - @rows=(); - if ($FORM{'csv'}) { - &print_report_bycnd_csv(@sorted); - return; - } - my $colspan=&print_report_bycnd_header($nresultcount,$bysubjflag,\%sorturls,$FORM{'sortby'}, - $csvurl,$reverseurl,@subjects); - @unsorted=(); - @subjcnts=(); - my $symbol=""; - my @cols=(); - my @rowhdrs=('Questions','Correct','Incorrect','Pct Correct'); - my $rowspan=($bysubjflag) ? ($#rowhdrs+1) : 1; - foreach my $row (@sorted) { - @cols=@{$row->{'columns'}}; - my ($start,$end,$duration,$datestamp,$total); - if ($bExport) { - print "$cols[0]\t$cols[1]\t$cols[2]\t"; - if ($bysubjflag) { print "\n";} - } else { - #($start,$end,$duration) = get_teststartend($CLIENT{'clid'},$cols[1],$FORM{'tstid'}); - $start = sprintf("%02d:%02d:%02d",reverse((localtime($row->{'start'}))[0..2])); - $end = sprintf("%02d:%02d:%02d",reverse((localtime($row->{'end'}))[0..2])); - $duration = &fmtDuration($row->{'end'} - $row->{'start'}); - if ($end == "Unknown" ) { - $datestamp = ""; - } else { - my $gmend = sprintf("%02d:%02d:%02d",reverse((gmtime($row->{'end'}))[0..2])); - $datestamp = "$cols[2] $gmend GMT"; - $datestamp =~ s/ /_/g; - } - $total = $cols[-3] + $cols[-2]; - - my $params = "tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=". - uri_escape($cols[1]). - "&tstid=$FORM{'tstid'}&correct=$cols[-3]&incorrect=$cols[-2]&total=$total&percent=$cols[-1]"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - if ($bysubjflag) { - for $j (0 .. $#rowhdrs) { - $symbol=($j==3) ? "\%" : ""; - if ($j > 0) { - if ($bExport == 0) { - print "\t\n"; - } - } - if ($bExport) { - print "\t\t$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - for $fidx (0 .. $#subjects) { - $qid=($fidx*4)+$j+3; - if ($bExport) { - print "$cols[$qid]\t"; - } else { - print "\t\t\n"; - } - if ($j==3) { - $subjmean[$fidx][3]+=(($subjmean[$fidx][2]-$cols[$qid])*($subjmean[$fidx][2]-$cols[$qid])); - } - } - if ($j == 0) { - $fidx=$#cols-2; - if ($bExport) { - print "$cols[$fidx++]\t"; - print "$cols[$fidx++]\t"; - print "$cols[$fidx]\t"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - } else { - $j=$#cols-2; - if ($bExport) { - print "$cols[$j++]\t"; - print "$cols[$j++]\t"; - print "$cols[$j]\n"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - if ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } else { - print "\t\t\n"; - } - print "\t\n"; - } - } - if ($bysubjflag) { - if ($bExport==0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } - $meanscore[3]+=(($meanscore[2]-$cols[$#cols])*($meanscore[2]-$cols[$#cols])); - @cols=(); - } - $meanscore[3]=int((sqrt($meanscore[3]/($#sorted+1)))); - if ($bysubjflag) { - @rowhdrs=('Questions','Correct','Incorrect','Pct Correct','Unbiased Mean','Std. Dev.','Range-Low','Range-High','Median'); - $rowspan=$#rowhdrs+1; - for $j (0 .. $#rowhdrs) { - if ($bExport == 0) { - print "\t\n"; - } - if ($j == 0) { - if ($bExport) { - print "\n\tComposite\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t\t"; - } - } - if ($bExport) { - print "$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - if ($j < 4) { - $symbol=($j==3) ? "\%" : ""; - for $fidx (0 .. $#subjects) { - if ($bExport) { - print "$subjtot[$fidx][$j]\t"; - } else { - print "\t\t\n"; - } - } - if ($j == 0) { - if ($bExport) { - print "\t\t"; - } else { - print "\t\t\n"; - } - } elsif ($j == 3) { - if ($bExport) { - print "\tOverall\t"; - } else { - print "\t\t\n"; - } - } - } else { - $symbol="\%"; - $i=$j-2; - for $fidx (0 .. $#subjects) { - if ($i == 6) { - if ($bExport) { - print "$subjmedian[$fidx][0]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($i==3) { - $subjmean[$fidx][3]=int((sqrt(($subjmean[$fidx][3]/$subjmean[$fidx][0])))); - if ($bExport) { - print "$subjmean[$fidx][$i]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "$subjmean[$fidx][$i]\t"; - } else { - print "\t\t\n"; - } - } - } - } - $i=$j-2; - if ($i==3) { - if ($bExport) { - print "\t$meanscore[$i]\t"; - } else { - print "\t\t\n"; - } - } elsif ($i==6) { - if ($bExport) { - print "\t$medianscore[0]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t$meanscore[$i]\t"; - } else { - print "\t\t\n"; - } - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } elsif ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - @rowhdrs=('Unbiased Mean','Std. Dev.','Range-Low','Range-High','Median'); - $rowspan=$#rowhdrs+1; - $symbol="\%"; - #print STDERR Dumper(\@meanscore); - for $j (0 .. $#rowhdrs) { - $i=$j+2; - if ($bExport == 0) { - print "\t\n"; - } - if ($j==0) { - if ($bExport) { - print "\tComposite\n"; - } else { - print "\t\t\n"; - } - } - if ($bExport) { - print "\t$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - if ($j==1) { - if ($bExport) { - print "\t\t$meanscore[$i]"; - } else { - print "\t\t\n"; - } - } elsif ($j==4) { - if ($bExport) { - print "\t\t$medianscore[0]"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t\t$meanscore[$i]"; - } else { - print "\t\t\n"; - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } else { - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } - &print_report_bycnd_footer(); - @subjtot=(); - @subjects=(); - @sorted=(); -} -$^W=0; - -sub print_report_bycnd_header { - my ($ncount,$bysubj,$sorturls,$sortby,$csvurl,$reverseurl,@subjects) = @_; - my $i; - my $titlesfx=""; - my $nsubjects = $#subjects; - my $colspan=$nsubjects+2; - my $colspan2=$nsubjects+2; - if ($bysubj) { - $colspan2+=6; - $titlesfx=" (Subject Area)"; - } else { - $colspan2=9; - } - my $sortspan = int($colspan2/8); # wac changed 4 to 8 to make columns closer - if ($bExport) { - print "$TEST{'desc'}\n"; - print "Question$titlesfx Response Statistics\n"; - print "$ncount Completed Responses\n"; - print "Candidate\tDate\t"; - if ($bysubj) { - print "BD\t"; - for $i (0 .. $nsubjects) { - print "$subjects[$i]\t"; - } - }; - print "TC\tTI\tTS\n"; - } else { - print "\n"; - print "\n"; - print "\tQuestion Response Statistics\n"; - print "\t\n"; - print "\n"; - print "\n"; - print "
    \n"; - print "$TEST{'desc'}
    \n"; - print "Question$titlesfx Response Statistics
    \n"; - print "$ncount Completed Responses\n"; - #print "
    $colhdr
    $cols[0]$cols[1]$cols[2]
    $rowhdrs[$j]$cols[$qid]$symbol$cols[$fidx++]$cols[$fidx++]$cols[$fidx]\%
    $start$end$duration$cols[$j++]$cols[$j++]$cols[$j]\%Not Scored by Definition

    Composite$rowhdrs[$j]$subjtot[$fidx][$j]$symbol\ \;
    Overall$subjmedian[$fidx][0]$symbol\&\#177$subjmean[$fidx][$i]$symbol$subjmean[$fidx][$i]$symbol\&\#177$meanscore[$i]$symbol$medianscore[0]$symbol$meanscore[$i]$symbol

    Composite$rowhdrs[$j]\&\#177$meanscore[$i]$symbol$medianscore[0]$symbol$meanscore[$i]$symbol


    \n"; - print "
    \n"; - - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - if ($bysubj) { - print "\t\t\n"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - if ($bysubj) { - print "\t\t\n"; - for $i (0 .. $nsubjects) { - print "\t\t\n"; - } - }; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - } - return $colspan2; -} - -sub print_report_bycnd_footer { - if ($bExport) { return;} - print "
    \n"; - foreach (@sortbys) { - if ($_ ne $sortby) { - print "\t\t\t{$_}\">Sort by $_
    \n"; - } else { - print "\t\t\tSorted by $_
    \n"; - } - } - print "\t\t\t
    "; - print "CSV Report\n\t\t\t
     
    "; - print "Change to ".($FORM{'reverse'}?'ascending':'descending')."\n\t\t

    CandidateLoginIDDateSubject AreasStartEndDurationOverall
    \ \;$subjects[$i]CorrectIncorrectScore

    \n"; - print "\n"; - print "\n"; -} - -sub print_report_bycnd_csv { - print "userid,testname,date,score\n"; - my %testlookup; - my $lookupfile = join($pathsep,$dataroot,"namelookup.$CLIENT{'clid'}"); - #print STDERR "Opening $lookupfile\n"; - if (-e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - while ($_ = <$fh>) { - chomp; - my @line = split(/\s+/,$_,2); - $testlookup{$line[0]} = $line[1]; - } - } - } - foreach (@_) { - my @row = @{$_->{'columns'}}; - my ($userid,$testid,$date,$score) = ($row[1],$TEST{'id'},$row[2],$row[$#row]); - if ($testlookup{$testid}) {$testid = $testlookup{$testid};} - print join(',',$userid,$testid,$date,$score)."\n"; - } -} - -sub show_test_composite { - my ($idlist) = @_; - &LanguageSupportInit(); - $mymsg = ""; - my $nresponses=0; - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - @questions = &get_question_list($TEST{'id'},$CLIENT{'clid'}); - $qhdr = shift @questions; - @sorted = sort @questions; - @questions = @sorted; - unshift @questions, $qhdr; - @sorted = (); - for (1 .. $#questions) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$_]); - if ( $qtp eq 'nrt' ) { - $qca = 'N/A'; - } - $qtx =~ s/\;/
    /g; - ($test,$qid) = split(/\./, $id); - $qstatsid[$qid] = $id; - $qstatsqc[$qid] = 0; # occurrences of question - $qstatsqp[$qid] = 0; # percent occurrences of question - $qstatsqt[$qid] = $qtx; # question text - if ($qil eq 'Y') { - $qstatsqf[$qid] = "obs"; # question type - } else { - $qstatsqf[$qid] = $qtp; # question type - $qallans = ""; - if ($qtp eq 'tf') { - $qallans = "$qca\;$qia\;$xlatphrase[670]"; #670=No Response - } elsif ($qtp eq 'mcs' || $qtp eq 'mca' || $qtp eq 'lik') { - if ($qca eq '') { - $qallans = "$qia\;$xlatphrase[670]"; - } else { - $qallans = "$qca\;$qia\;$xlatphrase[670]"; - } - } elsif ($qtp eq 'mtx' || $qtp eq 'mtr') { - # DED When qca is saved correctly in tdef, - # put this back and delte rest: - # $qallans = "$qca"; - ### DED 2/25/05 Assumes RC labels, not lblall - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - $qallans = ""; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - $qallans .= "xxx\;"; - } - } - } elsif ($qtp eq 'mcm') { - if ($qca eq '') { - $qallans = "$qia"; - } else { - $qallans = "$qca\;$qia"; - } - } elsif ($qtp eq 'esa') { - if ($qca eq '') { - $qallans = ""; - } else { - $qallans = "$qca"; - } - } elsif ($qtp eq 'nrt') { - if ($qca eq 'N/A') { - $qallans = "Other\;$xlatphrase[670]\;"; - } else { - $qallans = "$qca\;Other\;$xlatphrase[670]\;"; - } - } elsif ($qtp eq 'mch') { - @qcans = split(/\;/, $qca); - @qians = split(/\;/, $qia); - for (my $i = 0; $i <= $#qcans; $i++ ) { - $qallans = join('', $qallans, "$qcans[$i]===$qians[$i]
    "); - } - } elsif ($qtp eq 'ord') { - $qallans = "$qca"; - } - $qallans =~ s/\;\;/\;/g; - $qstatsqr[$qid] = $qallans; # response options - $fqstatsqr[$qid] = $qallans; ### DED for FBQ - $qstatsqw[$qid] = (); - if (($qtp eq 'mch') || ($qtp eq 'ord')) { - if ($qtp eq 'mch') { - @qstato = split(/
    /, $qallans); - } else { - @qstato = split(/\;/, $qallans); - } - $ncount = $#qstato + 1; - $ncount = int(($ncount * ($ncount + 1)) + 3); - for (my $i = 0; $i <= $ncount; $i++ ) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } elsif ($qtp eq 'mcm' || $qtp eq 'esa' || $qtp eq 'mtx' || $qtp eq 'mtr') { - ### ASSUMES rank=1..10 - need to allow for other ranks - @qstato = split(/\;/, $qallans); - if ($qtp eq 'mtr') - { - # Have to allow for [1..10] in - # each answer, so make it big! - $ncount = (($#qstato + 1) * 10) + 3; - } - else - { - $ncount = $#qstato + 3; - } - for (my $i = 0; $i <= $ncount; $i++ ) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } else { - @qstato = split(/\;/, $qallans); - foreach $qstat (@qstato) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } - } - @qstato = (); - } - $ncount = $#filelist + 1; - @qucmts=(); - $nresponses=$#filelist+1; - for (my $fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - if (defined $idlist and not $idlist->{$user}) { - $nresponses--; - next; - } - my $excuser="inc$user"; - if ($FORM{$excuser}) { - $nresponses--; - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qids = split(/\&/, $SUBTEST_QUESTIONS{2}); - @qrsp = split(/\&/, $SUBTEST_RESPONSES{2}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - @corincs = split(/\//, $qsumry[5]); - @qsumry = (); - @qsumry = split(/\&/, $SUBTEST_ANSWERS{2}); - @qansseq = (); - $fqid=""; - $fqididx=""; - for (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$_]); - ($qansord,$trash) = split(/::/, $qsumry[$_]); - $qansord =~ s/\=([0-1])//g; - $qansseq[$_] = $qansord; - - ($qresp,$qucmt) = split(/::/, $qrsp[$_]); - $qresp=~ tr/+/ /; - $qresp=~ tr/'//d; - $qrsp[$_]=$qresp; - - ##### v ADT - 7/03/2002 ################################### - # Added code to print NRT answers in the form of the comments - #push @qresponses, "$qidx\&$user\&$qresp"; - - if ($qucmt ne '') { - $qucmt =~ tr/+/ /; - $qucmt =~ tr/'//d; - push @qucmts, "$qidx\&$user\&$qucmt"; - } - ### DED 10/28/2002 Support for filter-by-question (FBQ) - if ($FORM{'question'} eq $qids[$_]) { - $fqididx=$_; - ($trash,$fqid)=split(/\./,$qids[$_]); - } - } - ### DED 10/28/2002 Support for filter-by-question (fbq) - #print "

    FormQues= $FORM{'question'} Ans= $FORM{'answer'} Qansseq= $qansseq[$fqididx]

    \n"; - if ($fqid ne "" && $FORM{'answer'} ne "") { - $fmatch=0; - if ($qstatsqf[$fqid] eq 'mcs' || $qstatsqf[$fqid] eq 'mca' || $qstatsqf[$fqid] eq 'lik') { - @fqansseq=split(/\?/,$qansseq[$fqididx]); - shift @fqansseq; - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - foreach $fans (@fans) { - @ffresp=(); - $fresp=""; - for (0 .. $#fqansseq) { - $fqseqans[$fqansseq[$_]]=$_; - $ffresp[$_]="xxx"; - } - if ($fans ne "No+Response") { - $ffresp[$fqseqans[$fans]]=$fqseqans[$fans]; - } - if ($ffresp[0] eq "") { - $fresp=""; - } else { - foreach (@ffresp) { - $fresp=join('?',$fresp,$_); - } - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "") { - $fmatch=1; - } - @ffresp=(); - if ($fmatch == 1) { break; } - } - @fqansseq=(); - @fans=(); - } elsif ($qstatsqf[$fqid] eq 'mcm') { - @fqansseq=split(/\?/,$qansseq[$fqididx]); - shift @fqansseq; - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - @ffresp=(); - $fresp=""; - for (0 .. $#fqansseq) { - $fqseqans[$fqansseq[$_]]=$_; - $ffresp[$_]="xxx"; - } - if ($fans[0] ne "No+Response") { - foreach (@fans) { - $ffresp[$fqseqans[$_]]=$fqseqans[$_]; - } - } - if ($ffresp[0] eq "") { - $fresp=""; - } else { - foreach (@ffresp) { - $fresp=join('?',$fresp,$_); - } - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "") { - $fmatch=1; - } - @fqansseq=(); - @fans=(); - @ffresp=(); - } elsif ($qstatsqf[$fqid] eq 'tf') { - if ($FORM{'answer'} eq "\&0" ) { - $fresp=$qansseq[$fqididx]; - } elsif ($FORM{'answer'} eq "\&1" ) { - SWITCH: for ($qansseq[$fqididx]) { - $fresp = /TRUE/ && "FALSE" - || /FALSE/ && "TRUE" - || /YES/ && "NO" - || /NO/ && "YES" - || "bad"; - } - } elsif ($FORM{'answer'} eq "\&No+Response") { - $fresp=""; - } else { - $fresp="bad"; - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "bad") { - $fmatch=1; - } - } elsif ($qstatsqf[$fqid] eq 'esa') { - ($fqstatsqr,$trash)=split(/;Other/,$fqstatsqr[$fqid]); - @fqr=split(/\;/,$fqstatsqr); - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - if ($fans[0] eq "No+Response") { - $fqr=""; - if ($fqr eq $qrsp[$fqididx]) { - $fmatch=1; - } - } else { - foreach (@fans) { - $fqr=lc($fqr[$_]); - $fqrsp=lc($qrsp[$fqididx]); - if ($fqr eq $fqrsp && $fqr ne "") { - $fmatch=1; - last; - } - } - } - @fqr=(); - @fans=(); - } - #print "

    FQid= $fqid Qtp= $qstatsqf[$fqid] Qstatsid= $qstatsid[$fqid] Fresp= $fresp Qrsp=$qrsp[$fqididx]

    \n"; - if ($fmatch == 0) { - ### Don't count this one - #print "...Skipping..."; - $nresponses--; - @fqucmts = @qucmts; - @qucmts = (); - foreach (@fqucmts) { - if (!($_ =~ /\&$user\&/)) { - push @qucmts, "$_"; - } - } - next; - } - $fresp=""; - } - ### DED End fbq support - @qsumry=(); - for (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$_]); - if ($qstatsqf[$qidx] ne 'obs') { - $qstatsqc[$qidx]++; - $qstatsqp[$qidx] = format_percent(($qstatsqc[$qidx] / $ncount), - { fmt => "%.0f" } ); - @qstatc = split(/\;/, $qstatsqrc[$qidx]); - @qstatp = split(/\;/, $qstatsqrp[$qidx]); - if ($qstatsqf[$qidx] eq 'tf') { - @qstato = split(/\;/, $qstatsqr[$qidx]); - if ($qrsp[$_] eq $qstato[0]) { - $qstatc[0]++; - } elsif ($qrsp[$_] eq $qstato[1]) { - $qstatc[1]++; - } else { - $qstatc[2]++; - } - }elsif ($qstatsqf[$qidx] eq 'esa'){ - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/\+/ /g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 1) { - @qansord = split(/\;/, $qansseq[$_]); - for $q (0 .. $#qansord) { - if ($qansord[$q] eq $qresp) { - $qstatc[$q]++; - last; - } - } - } else { # incorrect - $found=0; - @qstatw=split(/\;/,$qstatsqw[$qidx]); - shift(@qstatw); - for $q (0 .. $#qstatw) { - if ($qstatw[$q] eq $qresp) { - $qstatsqwc[$q]++; - $found=1; - last; - } - } - if ($found != 1) { - $qstatsqwc[$#qstatw+1]=1; - $qstatsqw[$qidx]=join(';',$qstatsqw[$qidx],$qresp); - } - @qstatq=(); - } - } else { - $qstatc[$#qstatc]++; - } - @qansord = (); - }elsif ($qstatsqf[$qidx] eq 'nrt'){ - if ($qrsp[$_] ne '') { - $qstatc[1]++; - $qrsp[$_] =~ s/\;/\:/g; - $qrsp[$_] =~ s/\r//g; - $qrsp[$_] =~ s/\n/\\n/g; - - $qstatsqr[$qidx] = join('
    ',$qstatsqr[$qidx],$qrsp[$_]); - } else { - $qstatc[2]++; - } - } elsif ($qstatsqf[$qidx] eq 'mcs' || $qstatsqf[$qidx] eq 'mca' || $qstatsqf[$qidx] eq 'lik') { - ### DED Filter out "?" and "xxx" in qrsp so will match - $qrsp[$_] =~ s/\?//g; - $qrsp[$_] =~ s/xxx//g; - @qansord = split(/\?/, $qansseq[$_]); - shift @qansord; - $found = 0; - ### DED 10/09/02 Changed to allow for - ### randomized answers - #for (my $i = 0; $i <= $#qansord; $i++ ) { - #if (("$qansord[$i]" eq "$qrsp[$_]") && ($qrsp[$_] ne '')) { - if ($qrsp[$_] ne '') { - $qstatc[$qansord[$qrsp[$_]]]++; - $found = 1; - } - #} - unless ($found) { - # increment "No Response" - $qstatc[$#qstatc]++; - } - @qansord = (); - } elsif ($qstatsqf[$qidx] eq 'mtx') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qidx]); - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - - # skipping answer sequence part (no rand answ) - $holding3 = $_; - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - $i=0; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - if ($qresps[$i] ne "xxx") { - $qstatc[$i]++; - } - $i++; - } - } - } - } else { - # increment No Response counter - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mtr') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qidx]); - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - - # skipping answer sequence part (no rand answ) - $holding3 = $_; - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - $iqresps=0; - $iqstatc=0; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - if ($qresps[$iqresps] ne "xxx") - { - # $qresps[$iqresps] will be [1..10], so adjust index accordingly - $irank = $iqstatc + $qresps[$iqresps] - 1; - $qstatc[$irank]++; - } - $iqresps++; - $iqstatc += 10; - } - } - } - } else { - # increment No Response counter - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mcm') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - @qansord = split(/\?/, $qansseq[$_]); - shift @qansord; - $holding3 = $_; - #$found = 0; - ### DED 10/18/02 Changed to allow for - ### randomized answers & new format - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - foreach $qresp (@qresps) { - if ($qresp ne "xxx") { - $qstatc[$qansord[$qresp]]++; - } - } - } - } else { - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mch') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - ### DED 10/18/02 Changed for - ### random answers and new format - - # - # Count occurrence of each match - - # $qansseq[$qidx] [Wrong! DED] - # $qansseq[$_] - # &a.3.2.0.6.5.8.4.7.1::MATCH.0:1:1:0 - # $qrsp[$_] - # &dgihbfcea [Old format] - # &?d?g?i?h?b?f?c?e?a [New] - - #$qansseq[$qidx] =~ s/\&//g; - $qansseq[$_] =~ s/\&//g; - $qrsp[$_] =~ s/\&//g; - $qrsp[$_] =~ s/ //g; - #@corord = split(/\./, $qansseq[$qidx]); - @corord = split(/\./, $qansseq[$_]); - #@selord = split(//,$qrsp[$_]); - @selord = split(/\?/,$qrsp[$_]); - shift @selord; - $corhold = $_; - if ($corinc == 0) { - for (0 .. $#selord) { - if ($selord[$_] ne 'xxx') { - ($x = &get_label_index($corord[0],$selord[$_]))++; - $y = $corord[$x]; - - #$ncountidx = int($_ * $#corord + $y); - $ncountidx = int($y * $#corord + $_); - } else { - $ncountidx = int(($#corord * $#corord ) + $_); - } - $qstatc[$ncountidx]++; - } - } - $_ = $corhold; - @selord = (); - @corord = (); - } else { - $qstatc[$#qstatc]++; - } - } elsif ($qstatsqf[$qidx] eq 'ord') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - ### DED 10/18/02 Changed for - ### random answers and new format - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - # - # Count occurrence of each incorrect order - # &o.2.3.4.1.0::ORDERED.0:1:1:0 - # &34521 [Old format] - # &?3?4?5?2?1 [New] - # - #$qansseq[$qidx] =~ s/\&//g; - $qansseq[$_] =~ s/\&//g; - $qrsp[$_] =~ s/\&//g; - #@corord = split(/\./, $qansseq[$qidx]); - @corord = split(/\./, $qansseq[$_]); - #@selord = split(//,$qrsp[$_]); - @selord = split(/\?/,$qrsp[$_]); - shift @selord; - $corhold = $_; - if ($corinc == 0) { - for (1 .. $#corord) { - $ncountidx = int(($corord[$_]) * $#corord); - $x = int($_ - 1); - if ($selord[$x] ne 'xxx') { - $ncountidx = $ncountidx + int($selord[$x]) - 1; - } else { - $ncountidx = int(($#corord * $#corord) + $_ - 1); - } - $qstatc[$ncountidx]++; - } - } - $_ = $corhold; - @selord = (); - @corord = (); - } else { - $qstatc[$#qstatc]++; - } - } - ### DED 8/20/2002 If checked, don't count - ### "No Response" in statistics - if ($FORM{'exnoresp'}) { - if ($qstatsqc[$qidx] > $qstatc[$#qstatc]) { - $denom = $qstatsqc[$qidx] - $qstatc[$#qstatc]; - } else { - $denom = 1; - } - for (my $i = 0; $i <= $#qstatc-1; $i++ ) { - $qstatp[$i] = format_percent($qstatc[$i] / $denom); - } - } else { - for (my $i = 0; $i <= $#qstatc; $i++ ) { - $qstatp[$i] = format_percent($qstatc[$i] / $qstatsqc[$qidx]); - } - } - - $qstatsqrc[$qidx] = ""; - foreach $qstat (@qstatc) { - $qstatsqrc[$qidx] = join('', $qstatsqrc[$qidx], "$qstat\;"); - } - $qstatsqrp[$qidx] = ""; - ### DED 8/22/2002 Exclude "No Response" - ### from statistics - if ($FORM{'exnoresp'}) { - $count = $#qstatc-1; - } else { - $count = $#qstatp - } - for (0 .. $count) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstatp[$_]\;"); - } - } - if (($qstatsqf[$qidx] eq 'mcm') || ($qstatsqf[$qidx] eq 'mch') || ($qstatsqf[$qidx] eq 'ord') || ($qstatsqf[$qidx] eq 'mtx') || ($qstatsqf[$qidx] eq 'mtr')) { - $npctidxend = $#qstatc - 3; - $nincidx = $#qstatc - 1; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $npctidxend; $i++ ) { - if ($ntotinc == 0) { - $qstatp[$i] = 0; - } else { - $qstatp[$i] = format_percent($qstatc[$i] / $ntotinc); - } - } - $qstatsqrp[$qidx] = ""; - foreach $qstat (@qstatp) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstat\;"); - } - } elsif ($qstatsqf[$qidx] eq 'esa') { - $npctidxend = $#qstatc - 3; - $ncoridx = $#qstatc - 2; - $nincidx = $#qstatc - 1; - $ntotcor = $qstatc[$ncoridx]; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $npctidxend; $i++ ) { - if ($ntotcor == 0) { - $qstatp[$i] = 0; - } else { - $qstatp[$i] = format_percent($qstatc[$i] / $ntotcor); - } - } - $qstatsqrp[$qidx] = ""; - foreach $qstat (@qstatp) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstat\;"); - } - $nincidx = $#qstatc - 1; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $#qstatsqwc; $i++ ) { - if ($ntotinc == 0) { - $qstatsqwp[$i] = 0; - } else { - $qstatsqwp[$i] = format_percent($qstatsqwc[$i] / $ntotinc); - } - } - } - @qstato = (); - @qstatc = (); - @qstatp = (); - } -} - -if ($#qucmts != -1) { - @qsumry=sort @qucmts; - @qucmts=@qsumry; - @qsumry=(); -} - - print HTMLHeaderPlain("Question Response Statistics"); - print "

    $TEST{'desc'}
    Question Response Statistics


    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - #print "Organization-wide Report
    \n"; - print "
    \n"; - } - print $timestamp; - print "
    \n"; - print "
    \n"; - -print "$nresponses Completed Responses - - -"; -$sobsolete = ""; -if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $incresponse = ""; -} else { - $incresponse = "INCORRECT"; -} -for (1 ..$#questions) { - ($test,$qid) = split(/\./, $qstatsid[$_]); - if (!($FORM{'exunans'} && $qstatsqc[$qid] < $FORM{'minunans'})) { - if ($qstatsqf[$qid] eq 'obs') { - if ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') { - $sobs = " - - - - - - - "; - $sobsolete = join('', $sobsolete, $sobs); - } - } else { - if (($qstatsqf[$qid] eq 'mcm') || ($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord') || ($qstatsqf[$qid] eq 'esa') || ($qstatsqf[$qid] eq 'mtx') || ($qstatsqf[$qid] eq 'mtr')) { - if ($qstatsqf[$qid] eq 'mch') { - @qstato = split(/
    /, $qstatsqr[$qid]); - } else { - @qstato = split(/\;/, $qstatsqr[$qid]); - } - if ($qstatsqf[$qid] eq 'esa') { - @qstatw = split(/\;/, $qstatsqw[$qid]); - shift @qstatw; - } - $rowspan1 = ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') ? 5 : 4; - $rowspan2 = ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') ? 5 : 4; - } else { - @qstato = split(/\;/, $qstatsqr[$qid]); - if ( $qstatsqf[$qid] eq 'nrt' ){ - $qstato[1] =~ s/\/\//
    /g; - $qstato[1] =~ s/\//
    /g; - $qstato[1] =~ s/:/
    /g; - $qstato[1] =~ s/\+/ /g; - } - $rowspan1 = 2; - $rowspan2 = 2; - } - if ($FORM{'showcmts'} eq 'withq') { - $rowspan1++; - $rowspan2++; - } - $outary[$_] .= " - - - - - - "; - - @qstatc = split(/\;/, $qstatsqrc[$qid]); - @qstatp = split(/\;/, $qstatsqrp[$qid]); - if (($qstatsqf[$qid] eq 'mcm') || ($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord') || $qstatsqf[$qid] eq 'esa' || $qstatsqf[$qid] eq 'mtx' || $qstatsqf[$qid] eq 'mtr') { - $ncountidx = $#qstatc - 2; - $qstatccor = $qstatc[$ncountidx]; - $qstatpcor = $qstatp[$ncountidx]; - $qstatcinc = $qstatc[$ncountidx+1]; - $qstatpinc = $qstatp[$ncountidx+1]; - $qstatcnor = $qstatc[$ncountidx+2]; - $qstatpnor = $qstatp[$ncountidx+2]; - if ($TEST{'seq'} ne svy && $TEST{'seq'} ne dmg) { - $outary[$_] .= " - - - - - "; - $outary[$_] .= " - - - - - "; - } else { - $outary[$_] .= " - - - - - "; - } - $outary[$_] .= " - - "; - if ($FORM{'exnoresp'}) { - $outary[$_] .= "\n"; - } else { - $outary[$_] .= "\n"; - } - $outary[$_] .= " - - "; - } - if (($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord')) { - if ($qstatsqf[$qid] eq 'mch') { - $sphrase = "(matched to \>\;\>\;\>\;)"; - @matchwords = (); - @matchtos = (); - foreach $qstat (@qstato) { - ($matchword, $matchto) = split(/\=\=\=/, $qstat); - push @matchwords, $matchword; - push @matchtos, $matchto; - } - push @matchtos, "Left Blank"; - } else { - $sphrase = "(ordered as number \>\;\>\;\>\;)"; - @matchwords = (); - @matchtos = @qstato; - $matchidx = 1; - foreach $qstat (@qstato) { - push @matchwords, "$matchidx"; - $matchidx++; - } - push @matchtos, "Not Used"; - } - $colspan = int((($#matchwords + 1) * 2) + 1); - $outary[$_] .= " - - "; - } elsif ($qstatsqf[$qid] eq 'mtx' || $qstatsqf[$qid] eq 'mtr') { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qid]); - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - $holdmcm = $_; - if ($qstatsqf[$qid] eq 'mtr') - { - $colspan = ($#qiac + 1) * 3 + 1; - $colspan2 = 3; - } - else - { - $colspan = ($#qiac + 1) * 2 + 1; - $colspan2 = 2; - } - $outary[$_] .= " - - - "; - } elsif ($qstatsqf[$qid] eq 'mcm') { - $outary[$_] .= " - - - "; - } elsif ($qstatsqf[$qid] eq 'esa') { - $outary[$_] .= " - - - "; - } elsif ($qstatsqf[$qid] eq 'nrt' ) { - - ##### v ADT - 7/03/2002 ################################################ - # If you want to remove the NRT statistics, delete between these comments - ######################################################################## - $outary[$_] .= " - - - - - - "; - $outary[$_] .= " - - "; - $outary[$_] .= " - - "; - ##### ^ ADT - 7/03/2002 - End Delete ################################### - - ##### v ADT - 7/03/2002 ################################################ - # Added code to print NRT answers in the form of the comments - ######################################################################## - #print "\n\t\n\t\t\n\t\n"; - ##### ^ ADT - 7/03/2002 ################################################ - - } else { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $bs = ""; - $be = ""; - } else { - $bs = ""; - $be = ""; - } - $outary[$_] .= " - - - - - \n"; - } - if (($FORM{'showcmts'} eq 'withq') && ($#qucmts != -1)) { - ##### v ADT - 7/03/2002 ################################################ - # Modified code to add the comments to the same table cell as the - # answers if the question is a Narrative question - ######################################################################## - #if( $qstatsqf[$qid] ne 'nrt' ) { - print "\t\n\t\t - \n"; - } - $outary[$_] .= " - - - \n"; - @qstato = (); - @qstatc = (); - @qstatp = (); - } - } -} -if (($FORM{'showcmts'} eq 'atend') && ($#qucmts != -1)) { - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n\n"; -} -@qucmts=(); -# Read in .rgo file which defines question presentation order -if ($FORM{'tstid'} =~ /SAS/) { - $lookupfile = join($pathsep,$dataroot,"IntegroSAS.rgo"); -} else { - $lookupfile = join($pathsep,$dataroot,"IntegroTAQ.rgo"); -} -if (-e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - $out = ""; - my @lines = <$fh>; - $fh->close(); - shift @lines; - foreach (@lines) { - chomp; - my @line = split(/\&/,$_); - my $section = shift @line; - if ($section ne "") { - $out .= "\n"; - $out .= "\n"; - } - foreach my $sub (@line) { - my ($subheader, $quess) = split(/:/,$sub); - if ($subheader ne "") { - $out .= "\n"; - } - @ques = split(/\,/,$quess); - foreach my $quesid (@ques) { - $out .= $outary[$quesid]; - } - } - } - print $out; - } -} else { - for (1 ..$#questions) { - print $outary[$_]; - } -} -if ($FORM{'showobs'}) { - print "$sobsolete"; -} -print "

    $qstatsid[$_]INACTIVE$qstatsqt[$qid]

    $qstatsid[$_]$qstatsqc[$qid]$qstatsqp[$qid]\%$qstatsqt[$qid]
    $qstatccor$qstatpcor\%$xlatphrase[137]
    $qstatcinc$qstatpinc\%INCORRECT
    $qstatcinc$qstatpinc\%RESPONSES
    $qstatcnor $qstatpnor\%$xlatphrase[670]
    - - - - - - "; - foreach $matchword (@matchwords) { - $outary[$_] .= " - "; - } - $outary[$_] .= " - - "; - foreach $matchword (@matchwords) { - $outary[$_] .= " - - "; - } - $outary[$_] .= " - "; - $matchidx = 0; - foreach $matchto (@matchtos) { - $outary[$_] .= " - "; - if ($matchto eq $matchtos[$#matchtos]) { - $outary[$_] .= " - "; - } else { - $outary[$_] .= " - "; - } - foreach $matchword (@matchwords) { - $outary[$_] .= " - - "; - $matchidx++; - } - $outary[$_] .= " - "; - } - $outary[$_] .= " -
    BREAKDOWN OF $incresponse RESPONSES
    $sphrase$matchword
    CntPct
    $matchto$matchto$qstatc[$matchidx]$qstatp[$matchidx]\%
    -
    - - - - - - "; - foreach $qiacol (@qiac) - { - $outary[$_] .= ""; - } - $outary[$_] .= "\n - - "; - foreach $qiacol (@qiac) - { - if ($qstatsqf[$qid] eq 'mtr') - { - $outary[$_] .= ""; - } - $outary[$_] .= " - "; - } - $outary[$_] .= "\n\n"; - $i=0; - foreach $qiarow (@qiar) - { - $outary[$_] .= " - "; - foreach $qiacol (@qiac) - { - if ($qstatsqf[$qid] eq 'mtr') - { - $outary[$_] .= ""; - $outary[$_] .= ""; - $outary[$_] .= ""; - $i += 10; - } - else - { - $outary[$_] .= ""; - $outary[$_] .= ""; - $i++; - } - } - $outary[$_] .= "\n\n"; - } - $outary[$_] .= "\n
    BREAKDOWN OF $incresponse RESPONSES
     $qiacol
     RankCntPct
    $qiarow"; - for $irank (1 .. 10) - { - $outary[$_] .= "$irank
    "; - } - $outary[$_] .= "
    "; - for $irank (1 .. 10) - { - $outary[$_] .= "$qstatc[$i+$irank-1]
    "; - } - $outary[$_] .= "
    "; - for $irank (1 .. 10) - { - $outary[$_] .= "$qstatp[$i+$irank-1]\%
    "; - } - $outary[$_] .= "
    $qstatc[$i]$qstatp[$i]\%
    -
    - - - - - - - - - - - - - - -
    BREAKDOWN OF $incresponse RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstato) { - $outary[$_] .= "$qstat
    "; - } - $outary[$_] .= "
    -
    "; - $holdmcm = $_; - $endidx = $#qstatc - 3; - for (0 .. $endidx) { - $outary[$_] .= "$qstatc[$_]
    "; - } - $outary[$_] .= "
    -
    "; - for (0 .. $endidx) { - $outary[$_] .= "$qstatp[$_]\%
    "; - } - $_ = $holdmcm; - $outary[$_] .= "
    -
    -
    - - - - - - - - - - - - - - -
    BREAKDOWN OF $xlatphrase[137] RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstato) { - $outary[$_] .= "$qstat
    "; - } - $outary[$_] .= "
    -
    "; - $holdmcm = $_; - $endidx = $#qstatc - 3; - for (0 .. $endidx) { - $outary[$_] .= "$qstatc[$_]
    "; - } - $outary[$_] .= "
    -
    "; - for (0 .. $endidx) { - $outary[$_] .= "$qstatp[$_]\%
    "; - } - $_ = $holdmcm; - $outary[$_] .= "
    -
    -

    "; - $outary[$_] .= " - - - - - - - - - - - - - - -
    BREAKDOWN OF $incresponse RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstatw) { - $outary[$_] .= "$qstat
    "; - } - $outary[$_] .= "
    -
    "; - $holdmcm = $_; - foreach (@qstatsqwc) { - $outary[$_] .= "$_
    "; - } - $outary[$_] .= "
    -
    "; - foreach (@qstatsqwp) { - $outary[$_] .= "$_\%
    "; - } - $_ = $holdmcm; - $outary[$_] .= "
    -
    -

    "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="$qstatc[2]
    $qstatc[1]"; - } else { - $outary[$_] .="$qstatc[0]
    $qstatc[2]
    $qstatc[1]"; - } - $outary[$_] .= "
    -
    "; - if ($FORM{'exnoresp'}) { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .=" 
    $qstatp[1]\%"; - } else { - $outary[$_] .="$qstatp[0]\%
     
    $qstatp[1]\%"; - } - } else { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="$qstatp[2]\%
    $qstatp[1]\%"; - } else { - $outary[$_] .="$qstatp[0]\%
    $qstatp[2]\%
    $qstatp[1]\%"; - } - } - $outary[$_] .= "
    -
    "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="$qstato[1]
    $qstato[0]"; - } else { - $outary[$_] .="$qstato[0]
    $qstato[2]
    $qstato[1]"; - } - $outary[$_] .= "
    "; - $outary[$_] .= "
    -
     
     "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="
    $qstato[2]"; - } else { - $outary[$_] .="
    $qstato[3]"; - } - $outary[$_] .= "
    -
    "; - #print "\n\t\t\t\n\t\t\t\t\n"; - #print "\t\t\t\t\t\n"; - #print "\t\t\t\t\t\n"; - #print "\t\t\t\t\n"; - #print "\t\t\t
    Answers:
    "; - #for $i (0 .. $#qresponses) { - #@columns=split(/\&/, $qresponses[$i]); - #if ($columns[0] eq $qid) { - #print "$columns[1]\:
    \n"; - #while (length($columns[2]) > 50) { - #$j=index($columns[2]," ",45); - #if ($j==-1) { - #$qresponse=substr($columns[2],0,50); - #$columns[2]=substr($columns[2],50); - #} else { - #$qresponse=substr($columns[2],0,$j); - #$j++; - #$columns[2]=substr($columns[2],$j); - #} - #print "$qresponse
    \n"; - #} - #print "$columns[2]
    \n"; - #} - #} - # - #print "
    \n\t\t
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstatc) { - $outary[$_] .= "$boldtag$qstat$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - $outary[$_] .= "
    -
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstatp) { - $outary[$_] .= "$boldtag$qstat\%$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - $outary[$_] .= "
    -
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstato) { - $outary[$_] .= "$boldtag$qstat$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - $outary[$_] .= "
    -
    \n\t\t\t"; - #} - $outary[$_] .= " - - - -
    \nComments:
    \n"; - ##### ^ ADT - 7/03/2002 ################################################ - for $i (0 .. $#qucmts) { - @columns=split(/\&/, $qucmts[$i]); - if ($columns[0] eq $qid) { - $outary[$_] .= "$columns[1]\:
    \n"; - while (length($columns[2]) > 50) { - $j=index($columns[2]," ",45); - if ($j==-1) { - $qucmt=substr($columns[2],0,50); - $columns[2]=substr($columns[2],50); - } else { - $qucmt=substr($columns[2],0,$j); - $j++; - $columns[2]=substr($columns[2],$j); - } - $outary[$_] .= "$qucmt
    \n"; - } - $outary[$_] .= "$columns[2]
    \n"; - } - } - $outary[$_] .= "
    -


    Comments
    \n"; - $outary[$_] .= "\n"; - for (1 ..$#questions) { - ($test,$qid) = split(/\./, $qstatsid[$_]); - if ($qstatsqf[$qid] ne 'obs') { - for $i (0 .. $#qucmts) { - @columns=split(/\&/, $qucmts[$i]); - if ($columns[0] eq $qid) { - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - } - } - $outary[$_] .= "\n"; - } - } - $outary[$_] .= "\n\n
    IDUserComments
    $qstatsid[$_]$columns[1]\n"; - while (length($columns[2]) > 70) { - $j=index($columns[2]," ",65); - if ($j==-1) { - $qucmt=substr($columns[2],0,70); - $columns[2]=substr($columns[2],70); - } else { - $qucmt=substr($columns[2],0,$j); - $j++; - $columns[2]=substr($columns[2],$j); - } - $outary[$_] .= "$qucmt
    \n"; - } - $outary[$_] .= "$columns[2]
    \n"; - $outary[$_] .= "

    \n
    $section

    $subheader:
    \n"; -print "
    \n"; -print HTMLFooter(); -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\n". - "\n"; -} - -sub HTMLFooter { - my $year = `date +%Y`; - return "
    Copyright (c) 2004-$year, Integro Leadership Institute
    \n\n"; -} - -# -# -# diff --git a/survey-nginx/cgi-bin/IntegroTS.pl.bu20131217 b/survey-nginx/cgi-bin/IntegroTS.pl.bu20131217 deleted file mode 100755 index 50611a748..000000000 --- a/survey-nginx/cgi-bin/IntegroTS.pl.bu20131217 +++ /dev/null @@ -1,2281 +0,0 @@ -#!/usr/bin/perl -# -# $Id: IntegroTS.pl,v 1.5 2006/04/12 19:18:47 ddoughty Exp $ -# -# Source File: teststats.pl - -# Get config -# use strict; -use FileHandle; -use Time::Local; -use Data::Dumper; -use URI::Escape; -require 'sitecfg.pl'; -require 'testlib.pl'; -require 'tstatlib.pl'; -require 'ui.pl'; - -#use strict; -use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST - %SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS); -use vars qw($testcomplete $cgiroot $pathsep $dataroot ); - -&app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -&get_session($FORM{'tid'}); -&get_client_profile($SESSION{'clid'}); -my @sortbys = qw(Name LoginID Date); -my ($bExport,$idlist); -#print STDERR Dumper(\%FORM,\%CLIENT,\%SESSION); -if (exists $FORM{'grouping'} and $FORM{'grouping'} eq 'subset') { - $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 "
    ".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 (defined $timestamp) { - $timestamp = "$timestamp

    \n"; -} else { - $timestamp = "
    \n"; -} - -if ($FORM{'export'}) { - print "Content-Type: application/doc\n\n"; - $bExport=1; -} elsif ($FORM{'csv'}) { - print "Content-Type: text/x-csv\n\n"; -} else { - print "Content-Type: text/html\n\n"; - $bExport=0; -} -#print STDERR Dumper(\%FORM,$idlist); -if (&get_session($FORM{'tid'})) { - if ($FORM{'testsummary'} eq 'composite') { - &show_test_composite($idlist); - } elsif ($FORM{'testsummary'} eq 'bycnd') { - &show_test_resultsbycnd($idlist); - } else { - &extract_test_data(); - } -} -if ($bExport) { - exit(0); -} - -sub extract_test_data() { - &LanguageSupportInit(); - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - my @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - my @colhdrs=(); - push @colhdrs,""; - if ($FORM{'cndnme'}) { - push @colhdrs,"left:Last Name"; - push @colhdrs,"left:First Name"; - push @colhdrs,"left:MI"; - } - push @colhdrs,"left:User ID"; - if ($FORM{'cndeml'}) { - push @colhdrs,"left:Email Address"; - } - if ($FORM{'cnd1'}) { - push @colhdrs,"left:$CLIENT{'clcnd1'}"; - } - if ($FORM{'cnd2'}) { - push @colhdrs,"left:$CLIENT{'clcnd2'}"; - } - if ($FORM{'cnd3'}) { - push @colhdrs,"left:$CLIENT{'clcnd3'}"; - } - if ($FORM{'cnd4'}) { - push @colhdrs,"left:$CLIENT{'clcnd4'}"; - } - if ($FORM{'cndscr'}) { - push @colhdrs,"center:Correct"; - push @colhdrs,"center:Incorrect"; - push @colhdrs,"right:Score"; - } - my @dataflds=(); - my @unsorted=(); - my $row=""; - my @qsumry=(); - my $user=""; - my $joint="\&"; - my $colhdr; - my $colalgn; - my $fidx; - for ($fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - my $excuser="inc$user"; - if ($FORM{$excuser}) { - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - &get_candidate_profile($CLIENT{'clid'},$user); - if ($FORM{'cndnme'}) { - $row=join($joint,$row,"$CANDIDATE{'nml'}"); - $row=join($joint,$row,"$CANDIDATE{'nmf'}"); - $row=join($joint,$row,"$CANDIDATE{'nmm'}"); - } - $row=join($joint,$row,"$user"); - if ($FORM{'cndeml'}) { - $row=join($joint,$row,"$CANDIDATE{'eml'}"); - } - if ($FORM{'cnd1'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd1'}"); - } - if ($FORM{'cnd2'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd2'}"); - } - if ($FORM{'cnd3'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd3'}"); - } - if ($FORM{'cnd4'}) { - $row=join($joint,$row,"$CANDIDATE{'cnd4'}"); - } - if ($FORM{'cndscr'}) { - $row=join('&',$row,$qsumry[0],$qsumry[1],$qsumry[2]); - } - push @unsorted, $row; - $row=""; - } - my @sorted=sort @unsorted; - @unsorted=(); - my $rowcount=$#filelist+1; - &print_report_dataextract_header($rowcount,@colhdrs,@colalign); - my ($i); - for $i (0 .. $#sorted) { - @dataflds=split($joint, $sorted[$i]); - if ($bExport) { - for $i (1 .. $#dataflds) { - print "$dataflds[$i]"; - if ($i == $#dataflds) { - print "\n"; - } else { - print "\t"; - } - } - } else { - print "\n"; - for $i (1 .. $#dataflds) { - ($colalgn,$colhdr) = split(/:/,$colhdrs[$i]); - print "\t\t$dataflds[$i]\n"; - } - print "\n"; - } - } - &print_report_bycnd_footer(); - @sorted=(); -} - -sub print_report_dataextract_header { - my ($ncount,@cols)= @_; - my $colhdr; - my $colalgn; - my $i; - if ($bExport) { - print "$TEST{'desc'}\n"; - print "Raw Data Extraction\n"; - print "$ncount Completed Responses\n"; - for $i (1 .. $#cols) { - ($colalgn,$colhdr) = split(/:/,$cols[$i]); - print "$colhdr"; - if ($i == $#cols) { - print "\n"; - } else { - print "\t"; - } - } - } else { - print "\n"; - print "\n"; - print "\tTest Data Extraction\n"; - print "\t\n"; - print "\n"; - print "\n"; - print "
    \n"; - print "$TEST{'desc'}
    \n"; - print "Raw Data Extraction
    \n"; - print "$ncount Completed Responses\n"; - #print "\n"; - print "
    \n"; - print "\t\n"; - for $i (1 .. $#cols) { - ($colalgn,$colhdr) = split(/:/,$cols[$i]); - print "\t\t\n"; - } - print "\t<\TR>\n"; - } -} - -sub date_out_of_range { - my ($completedat,$datefm,$dateto) = @_; - my @unsorted=(); - push @unsorted, $completedat; - push @unsorted, $datefm; - push @unsorted, $dateto; - my @sorted = sort @unsorted; - my $bretyes = ($sorted[1] eq $unsorted[0]) ? 0 : 1; - @unsorted=(); - @sorted=(); - return $bretyes; -} - -$^W=1; -sub sort_test_results { - my ($sortby,@rows) = @_; - if ($sortby eq 'Name') { - #print STDERR "by Name\n"; - return sort {$a->{'columns'}->[0] cmp $b->{'columns'}->[0];} @rows; - } elsif ($sortby eq 'LoginID') { - #print STDERR "by LoginID\n"; - return sort {$a->{'columns'}->[1] cmp $b->{'columns'}->[1];} @rows; - } elsif ($sortby eq 'Date') { - #print STDERR "by Date\n"; - return sort {$a->{'end'} <=> $b->{'end'};} @rows; - } else { - #print STDERR "by Nothing\n"; - return @rows; - } -} - -sub show_test_resultsbycnd { - &LanguageSupportInit(); - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - my @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - my ($url) = ("$cgiroot/teststats.pl?"); - if (not $FORM{'sortby'}) {$FORM{'sortby'}=$sortbys[0];} - if (not $FORM{'reverse'}) {$FORM{'reverse'}=0;} - foreach (keys %FORM) { - if (($_ ne 'sortby') and ($_ ne 'reverse') and ($FORM{$_} !~ /\s+/)) { - #print STDERR "$_=$FORM{$_}\n"; - $url .= "&$_=$FORM{$_}"; - } else { - #print STDERR "NOT $_=$FORM{$_}\n"; - } - } - my $csvurl = $url."&csv=1&sortby=$FORM{'sortby'}&reverse=".($FORM{'reverse'}?0:1); - my $reverseurl = $url."&sortby=$FORM{'sortby'}&reverse=".($FORM{'reverse'}?0:1); - my %sorturls; - foreach my $sorter (@sortbys) { - $sorturls{$sorter} = $url."&sortby=$sorter"; - } - my @sorted=(); - my @unsorted=(); - my $user; - my $test; - my $qidx; - my $trash; - my $subjskl; - my $subj; - my $sklvl; - my $subjlist=","; - my @qids=(); - my @qsumry=(); - my @corincs=(); - my $bysubjflag = ($FORM{'statsbysubj'} ne '') ? 1 : 0; - my @subjects=(); - my @subjcnts=(); - my @subjtot=(); - my @subjmean=(); - my @subjmedian=(); - my @meanscore=split('\,',"0,0,0,0,100,0,0"); - my @medianscore=(); - my $i=0; - my $j=0; - my $fidx; - my @rows=(); - my $row={}; - my @answ=(); - my $qid; - my $usrnm; - my $nresultcount=$#filelist+1; - my $mtime; - my $completedat; - my $displaydate; - if ($FORM{'mofm'} < 10) { $FORM{'mofm'}="0$FORM{'mofm'}";} - if ($FORM{'moto'} < 10) { $FORM{'moto'}="0$FORM{'moto'}";} - if ($FORM{'dyfm'} < 10) { $FORM{'dyfm'}="0$FORM{'dyfm'}";} - if ($FORM{'dyto'} < 10) { $FORM{'dyto'}="0$FORM{'dyto'}";} - my $datefm="$FORM{'yrfm'}\-$FORM{'mofm'}\-$FORM{'dyfm'}"; - my $dateto="$FORM{'yrto'}\-$FORM{'moto'}\-$FORM{'dyto'}"; - for ($fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - my $history = get_testhistory_from_log($CLIENT{'clid'},$user,$FORM{'tstid'}); - if (not defined $history) { - #print STDERR "$user from history.\n"; - $history = get_cnd_test_from_history($testcomplete,$CLIENT{'clid'},$user,$FORM{'tstid'}); - } else { - #print STDERR "$user from log.\n"; - } - if (not defined $history) { - # no log file entry for this test - #print STDERR "$user inferred from $testcomplete.$pathsep.$filelist[$fidx]\n"; - my $mtime = (stat($testcomplete.$pathsep.$filelist[$fidx]))[9]; - $history->{'end'} = $mtime; - $history->{'start'} = $history->{'end'}; - #print STDERR Dumper($history); - } - #$trash=join($pathsep,$testcomplete,$filelist[$fidx]); - #open (TMPFILE, "<$trash"); - #$mtime = (stat(TMPFILE))[9]; - #close TMPFILE; - $completedat = &format_date_time("yyyy-mm-dd", "1", "-10000", $history->{'end'}); - $displaydate = &format_date_time("dd-mmm-yyyy", "1", "-10000", $history->{'end'}); - #print STDERR "$completedat $displaydate $datefm $dateto\n"; - if (&date_out_of_range($completedat,$datefm,$dateto)) { - $nresultcount--; - next; - } - my $excuser="inc$user"; - if ($FORM{$excuser}) { - $nresultcount--; - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qids = split(/\&/, $SUBTEST_QUESTIONS{2}); - @answ=split(/\&/,$SUBTEST_ANSWERS{2}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - @corincs = split(/\//, $qsumry[$#qsumry]); - for $i (0 .. $#subjects) { - $subjcnts[$i][0]=0; - $subjcnts[$i][1]=0; - $subjcnts[$i][2]=0; - $subjcnts[$i][3]=0; - } - &get_candidate_profile($CLIENT{'clid'},$user); - $usrnm="$CANDIDATE{'nml'}, $CANDIDATE{'nmf'} $CANDIDATE{'nmm'}"; - $row={'columns' => [$usrnm,$user,$displaydate]}; - $row->{'start'} = $history->{'start'}; - $row->{'end'} = $history->{'end'}; - #print STDERR "Survey = $TEST_SESSION{'srvy'}\n"; - if ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - for $qid (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$qid]); - ($trash,$subjskl) = split(/::/, $answ[$qid]); - ($subj,$sklvl,$trash)=split(/\.|\:/,$subjskl); - unless ($subjlist =~ /\,$subj\,/i) { - $subjlist = join('',$subjlist,"$subj\,"); - push @subjects,"$subj"; - $i=$#subjects; - $subjcnts[$i][0]=0; # questions in subject area - $subjcnts[$i][1]=0; # correct answers - $subjcnts[$i][2]=0; # incorrect answers - $subjcnts[$i][3]=0; # pct correct - $subjtot[$i][0]=0; - $subjtot[$i][1]=0; - $subjtot[$i][2]=0; - $subjtot[$i][3]=0; - $subjmean[$i][0]=0; # population count - $subjmean[$i][1]=0; # population value summation - $subjmean[$i][2]=0; # population mean - $subjmean[$i][3]=0; # population standard deviation - $subjmean[$i][4]=100; # population range-low - $subjmean[$i][5]=0; # population range-high - } - for $i (0 .. $#subjects) { - if ($subj eq $subjects[$i]) { - $subjcnts[$i][0]++; - $subjtot[$i][0]++; - if (substr($corincs[$qid],0,1) eq '1') { - $subjcnts[$i][1]++; - $subjtot[$i][1]++; - } else { - $subjcnts[$i][2]++; - $subjtot[$i][2]++; - } - $subjcnts[$i][3]=int((($subjcnts[$i][1]/$subjcnts[$i][0])*100)); - $subjtot[$i][3]=int((($subjtot[$i][1]/$subjtot[$i][0])*100)); - last; - } - } - } - if ($bysubjflag) { - for $i (0 .. $#subjects) { - push @{$row->{'columns'}},$subjcnts[$i][0],$subjcnts[$i][1],$subjcnts[$i][2],$subjcnts[$i][3]; - $subjmean[$i][0]++; - $subjmean[$i][1]+=$subjcnts[$i][3]; - $subjmean[$i][2]=int(($subjmean[$i][1]/$subjmean[$i][0])); - #$subjmean[$i][4]=(($subjcnts[$i][3] < $subjmean[$i][4]) || ($subjmean[$i][4] == 0)) ? $subjcnts[$i][3] : $subjmean[$i][4]; - $subjmean[$i][4]=($subjcnts[$i][3] < $subjmean[$i][4]) ? $subjcnts[$i][3] : $subjmean[$i][4]; - $subjmean[$i][5]=($subjcnts[$i][3] > $subjmean[$i][5]) ? $subjcnts[$i][3] : $subjmean[$i][5]; - $subjmedian[$i][$fidx]=$subjcnts[$i][3]; - $subjcnts[$i][0]=0; - $subjcnts[$i][1]=0; - $subjcnts[$i][2]=0; - $subjcnts[$i][3]=0; - } - } - $meanscore[0]++; # data count - $meanscore[1]+=$qsumry[2]; # sum of values - $meanscore[2]=int(($meanscore[1]/$meanscore[0])); # unbiased population mean - $meanscore[4]=($qsumry[2] < $meanscore[4]) ? $qsumry[2] : $meanscore[4]; - $meanscore[5]=($qsumry[2] > $meanscore[5]) ? $qsumry[2] : $meanscore[5]; - $medianscore[$fidx]=$qsumry[2]; - } - push @{$row->{'columns'}},$qsumry[0],$qsumry[1],$qsumry[2]; - push @rows, $row; - } - @sorted=sort {$a <=> $b} @medianscore; - $j=$#sorted/2; - $i=$sorted[$j]; - if (($#sorted % 2) == 0) { - @medianscore=(); - $medianscore[0]=$i; - } else { - $j++; - $i+=$sorted[$j]; - @medianscore=(); - $medianscore[0]=int(($i/2)); - } - my @scores=(); - for $i (0 .. $#subjects) { - for $j (0 .. $#filelist) { - $scores[$j]=$subjmedian[$i][$j]; - } - @sorted=sort {$a <=> $b} @scores; - @scores=(); - $j=$#sorted/2; - $qid=$sorted[$j]; - if (($#sorted % 2) == 0) { - $subjmedian[$i][0]=$qid; - } else { - $j++; - $qid+=$sorted[$j]; - $subjmedian[$i][0]=int(($qid/2)); - } - } - # The sorting block - if ($FORM{'reverse'}) { - @sorted = reverse &sort_test_results($FORM{'sortby'},@rows); - } else { - @sorted = &sort_test_results($FORM{'sortby'},@rows); - } - # end of the sorting block - @rows=(); - if ($FORM{'csv'}) { - &print_report_bycnd_csv(@sorted); - return; - } - my $colspan=&print_report_bycnd_header($nresultcount,$bysubjflag,\%sorturls,$FORM{'sortby'}, - $csvurl,$reverseurl,@subjects); - @unsorted=(); - @subjcnts=(); - my $symbol=""; - my @cols=(); - my @rowhdrs=('Questions','Correct','Incorrect','Pct Correct'); - my $rowspan=($bysubjflag) ? ($#rowhdrs+1) : 1; - foreach my $row (@sorted) { - @cols=@{$row->{'columns'}}; - my ($start,$end,$duration,$datestamp,$total); - if ($bExport) { - print "$cols[0]\t$cols[1]\t$cols[2]\t"; - if ($bysubjflag) { print "\n";} - } else { - #($start,$end,$duration) = get_teststartend($CLIENT{'clid'},$cols[1],$FORM{'tstid'}); - $start = sprintf("%02d:%02d:%02d",reverse((localtime($row->{'start'}))[0..2])); - $end = sprintf("%02d:%02d:%02d",reverse((localtime($row->{'end'}))[0..2])); - $duration = &fmtDuration($row->{'end'} - $row->{'start'}); - if ($end == "Unknown" ) { - $datestamp = ""; - } else { - my $gmend = sprintf("%02d:%02d:%02d",reverse((gmtime($row->{'end'}))[0..2])); - $datestamp = "$cols[2] $gmend GMT"; - $datestamp =~ s/ /_/g; - } - $total = $cols[-3] + $cols[-2]; - - my $params = "tid=$SESSION{'tid'}&clid=$CLIENT{'clid'}&cndid=". - uri_escape($cols[1]). - "&tstid=$FORM{'tstid'}&correct=$cols[-3]&incorrect=$cols[-2]&total=$total&percent=$cols[-1]"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - if ($bysubjflag) { - for $j (0 .. $#rowhdrs) { - $symbol=($j==3) ? "\%" : ""; - if ($j > 0) { - if ($bExport == 0) { - print "\t\n"; - } - } - if ($bExport) { - print "\t\t$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - for $fidx (0 .. $#subjects) { - $qid=($fidx*4)+$j+3; - if ($bExport) { - print "$cols[$qid]\t"; - } else { - print "\t\t\n"; - } - if ($j==3) { - $subjmean[$fidx][3]+=(($subjmean[$fidx][2]-$cols[$qid])*($subjmean[$fidx][2]-$cols[$qid])); - } - } - if ($j == 0) { - $fidx=$#cols-2; - if ($bExport) { - print "$cols[$fidx++]\t"; - print "$cols[$fidx++]\t"; - print "$cols[$fidx]\t"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - } else { - $j=$#cols-2; - if ($bExport) { - print "$cols[$j++]\t"; - print "$cols[$j++]\t"; - print "$cols[$j]\n"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - if ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } else { - print "\t\t\n"; - } - print "\t\n"; - } - } - if ($bysubjflag) { - if ($bExport==0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } - $meanscore[3]+=(($meanscore[2]-$cols[$#cols])*($meanscore[2]-$cols[$#cols])); - @cols=(); - } - $meanscore[3]=int((sqrt($meanscore[3]/($#sorted+1)))); - if ($bysubjflag) { - @rowhdrs=('Questions','Correct','Incorrect','Pct Correct','Unbiased Mean','Std. Dev.','Range-Low','Range-High','Median'); - $rowspan=$#rowhdrs+1; - for $j (0 .. $#rowhdrs) { - if ($bExport == 0) { - print "\t\n"; - } - if ($j == 0) { - if ($bExport) { - print "\n\tComposite\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t\t"; - } - } - if ($bExport) { - print "$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - if ($j < 4) { - $symbol=($j==3) ? "\%" : ""; - for $fidx (0 .. $#subjects) { - if ($bExport) { - print "$subjtot[$fidx][$j]\t"; - } else { - print "\t\t\n"; - } - } - if ($j == 0) { - if ($bExport) { - print "\t\t"; - } else { - print "\t\t\n"; - } - } elsif ($j == 3) { - if ($bExport) { - print "\tOverall\t"; - } else { - print "\t\t\n"; - } - } - } else { - $symbol="\%"; - $i=$j-2; - for $fidx (0 .. $#subjects) { - if ($i == 6) { - if ($bExport) { - print "$subjmedian[$fidx][0]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($i==3) { - $subjmean[$fidx][3]=int((sqrt(($subjmean[$fidx][3]/$subjmean[$fidx][0])))); - if ($bExport) { - print "$subjmean[$fidx][$i]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "$subjmean[$fidx][$i]\t"; - } else { - print "\t\t\n"; - } - } - } - } - $i=$j-2; - if ($i==3) { - if ($bExport) { - print "\t$meanscore[$i]\t"; - } else { - print "\t\t\n"; - } - } elsif ($i==6) { - if ($bExport) { - print "\t$medianscore[0]\t"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t$meanscore[$i]\t"; - } else { - print "\t\t\n"; - } - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } elsif ($SUBTEST_SUMMARY{2} ne 'Not Scored by Definition') { - @rowhdrs=('Unbiased Mean','Std. Dev.','Range-Low','Range-High','Median'); - $rowspan=$#rowhdrs+1; - $symbol="\%"; - #print STDERR Dumper(\@meanscore); - for $j (0 .. $#rowhdrs) { - $i=$j+2; - if ($bExport == 0) { - print "\t\n"; - } - if ($j==0) { - if ($bExport) { - print "\tComposite\n"; - } else { - print "\t\t\n"; - } - } - if ($bExport) { - print "\t$rowhdrs[$j]\t"; - } else { - print "\t\t\n"; - } - if ($j==1) { - if ($bExport) { - print "\t\t$meanscore[$i]"; - } else { - print "\t\t\n"; - } - } elsif ($j==4) { - if ($bExport) { - print "\t\t$medianscore[0]"; - } else { - print "\t\t\n"; - } - } else { - if ($bExport) { - print "\t\t$meanscore[$i]"; - } else { - print "\t\t\n"; - } - } - if ($bExport) { - print "\n"; - } else { - print "\t\n"; - } - } - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } else { - if ($bExport == 0) { - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - } - } - &print_report_bycnd_footer(); - @subjtot=(); - @subjects=(); - @sorted=(); -} -$^W=0; - -sub print_report_bycnd_header { - my ($ncount,$bysubj,$sorturls,$sortby,$csvurl,$reverseurl,@subjects) = @_; - my $i; - my $titlesfx=""; - my $nsubjects = $#subjects; - my $colspan=$nsubjects+2; - my $colspan2=$nsubjects+2; - if ($bysubj) { - $colspan2+=6; - $titlesfx=" (Subject Area)"; - } else { - $colspan2=9; - } - my $sortspan = int($colspan2/8); # wac changed 4 to 8 to make columns closer - if ($bExport) { - print "$TEST{'desc'}\n"; - print "Question$titlesfx Response Statistics\n"; - print "$ncount Completed Responses\n"; - print "Candidate\tDate\t"; - if ($bysubj) { - print "BD\t"; - for $i (0 .. $nsubjects) { - print "$subjects[$i]\t"; - } - }; - print "TC\tTI\tTS\n"; - } else { - print "\n"; - print "\n"; - print "\tQuestion Response Statistics\n"; - print "\t\n"; - print "\n"; - print "\n"; - print "
    \n"; - print "$TEST{'desc'}
    \n"; - print "Question$titlesfx Response Statistics
    \n"; - print "$ncount Completed Responses\n"; - #print "
    $colhdr
    $cols[0]$cols[1]$cols[2]
    $rowhdrs[$j]$cols[$qid]$symbol$cols[$fidx++]$cols[$fidx++]$cols[$fidx]\%
    $start$end$duration$cols[$j++]$cols[$j++]$cols[$j]\%Not Scored by Definition

    Composite$rowhdrs[$j]$subjtot[$fidx][$j]$symbol\ \;
    Overall$subjmedian[$fidx][0]$symbol\&\#177$subjmean[$fidx][$i]$symbol$subjmean[$fidx][$i]$symbol\&\#177$meanscore[$i]$symbol$medianscore[0]$symbol$meanscore[$i]$symbol

    Composite$rowhdrs[$j]\&\#177$meanscore[$i]$symbol$medianscore[0]$symbol$meanscore[$i]$symbol


    \n"; - print "
    \n"; - - print "\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - if ($bysubj) { - print "\t\t\n"; - } else { - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - } - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - if ($bysubj) { - print "\t\t\n"; - for $i (0 .. $nsubjects) { - print "\t\t\n"; - } - }; - print "\t\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\t\n"; - } - return $colspan2; -} - -sub print_report_bycnd_footer { - if ($bExport) { return;} - print "
    \n"; - foreach (@sortbys) { - if ($_ ne $sortby) { - print "\t\t\t{$_}\">Sort by $_
    \n"; - } else { - print "\t\t\tSorted by $_
    \n"; - } - } - print "\t\t\t
    "; - print "CSV Report\n\t\t\t
     
    "; - print "Change to ".($FORM{'reverse'}?'ascending':'descending')."\n\t\t

    CandidateLoginIDDateSubject AreasStartEndDurationOverall
    \ \;$subjects[$i]CorrectIncorrectScore

    \n"; - print "\n"; - print "\n"; -} - -sub print_report_bycnd_csv { - print "userid,testname,date,score\n"; - my %testlookup; - my $lookupfile = join($pathsep,$dataroot,"namelookup.$CLIENT{'clid'}"); - #print STDERR "Opening $lookupfile\n"; - if (-e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - while ($_ = <$fh>) { - chomp; - my @line = split(/\s+/,$_,2); - $testlookup{$line[0]} = $line[1]; - } - } - } - foreach (@_) { - my @row = @{$_->{'columns'}}; - my ($userid,$testid,$date,$score) = ($row[1],$TEST{'id'},$row[2],$row[$#row]); - if ($testlookup{$testid}) {$testid = $testlookup{$testid};} - print join(',',$userid,$testid,$date,$score)."\n"; - } -} - -sub show_test_composite { - my ($idlist) = @_; - &LanguageSupportInit(); - $mymsg = ""; - my $nresponses=0; - &get_client_profile($SESSION{'clid'}); - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); - @filelist = &get_test_result_files($testcomplete, "$CLIENT{'clid'}","$TEST{'id'}"); - @questions = &get_question_list($TEST{'id'},$CLIENT{'clid'}); - $qhdr = shift @questions; - @sorted = sort @questions; - @questions = @sorted; - unshift @questions, $qhdr; - @sorted = (); - # Initialize an array to hold collected answers for each question. - for (1 .. $#questions) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$_]); - if ( $qtp eq 'nrt' ) { - $qca = 'N/A'; - } - $qtx =~ s/\;/
    /g; - ($test,$qid) = split(/\./, $id); - $qstatsid[$qid] = $id; - $qstatsqc[$qid] = 0; # occurrences of question - $qstatsqp[$qid] = 0; # percent occurrences of question - $qstatsqt[$qid] = $qtx; # question text - if ($qil eq 'Y') { - $qstatsqf[$qid] = "obs"; # question type - } else { - $qstatsqf[$qid] = $qtp; # question type - $qallans = ""; - if ($qtp eq 'tf') { - $qallans = "$qca\;$qia\;$xlatphrase[670]"; #670=No Response - } elsif ($qtp eq 'mcs' || $qtp eq 'mca' || $qtp eq 'lik') { - if ($qca eq '') { - $qallans = "$qia\;$xlatphrase[670]"; - } else { - $qallans = "$qca\;$qia\;$xlatphrase[670]"; - } - } elsif ($qtp eq 'mtx' || $qtp eq 'mtr') { - # DED When qca is saved correctly in tdef, - # put this back and delte rest: - # $qallans = "$qca"; - ### DED 2/25/05 Assumes RC labels, not lblall - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - $qallans = ""; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - $qallans .= "xxx\;"; - } - } - } elsif ($qtp eq 'mcm') { - if ($qca eq '') { - $qallans = "$qia"; - } else { - $qallans = "$qca\;$qia"; - } - } elsif ($qtp eq 'esa') { - if ($qca eq '') { - $qallans = ""; - } else { - $qallans = "$qca"; - } - } elsif ($qtp eq 'nrt') { - if ($qca eq 'N/A') { - $qallans = "Other\;$xlatphrase[670]\;"; - } else { - $qallans = "$qca\;Other\;$xlatphrase[670]\;"; - } - } elsif ($qtp eq 'mch') { - @qcans = split(/\;/, $qca); - @qians = split(/\;/, $qia); - for (my $i = 0; $i <= $#qcans; $i++ ) { - $qallans = join('', $qallans, "$qcans[$i]===$qians[$i]
    "); - } - } elsif ($qtp eq 'ord') { - $qallans = "$qca"; - } - $qallans =~ s/\;\;/\;/g; - $qstatsqr[$qid] = $qallans; # response options - $fqstatsqr[$qid] = $qallans; ### DED for FBQ - $qstatsqw[$qid] = (); - if (($qtp eq 'mch') || ($qtp eq 'ord')) { - if ($qtp eq 'mch') { - @qstato = split(/
    /, $qallans); - } else { - @qstato = split(/\;/, $qallans); - } - $ncount = $#qstato + 1; - $ncount = int(($ncount * ($ncount + 1)) + 3); - for (my $i = 0; $i <= $ncount; $i++ ) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } elsif ($qtp eq 'mcm' || $qtp eq 'esa' || $qtp eq 'mtx' || $qtp eq 'mtr') { - ### ASSUMES rank=1..10 - need to allow for other ranks - @qstato = split(/\;/, $qallans); - if ($qtp eq 'mtr') - { - # Have to allow for [1..10] in - # each answer, so make it big! - $ncount = (($#qstato + 1) * 10) + 3; - } - else - { - $ncount = $#qstato + 3; - } - for (my $i = 0; $i <= $ncount; $i++ ) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } else { - @qstato = split(/\;/, $qallans); - foreach $qstat (@qstato) { - $qstatsqrc[$qid] = join('', $qstatsqrc[$qid], "0\;"); # response option count - $qstatsqrp[$qid] = join('', $qstatsqrp[$qid], "0\;"); # response option percentage - } - } - } - @qstato = (); - } - # Collect the answers from each test. - $ncount = $#filelist + 1; - @qucmts=(); - $nresponses=$#filelist+1; - for (my $fidx = 0; $fidx <= $#filelist; $fidx++ ) { - $user = $filelist[$fidx]; - $user =~ s/.$TEST{'id'}$//; - $user =~ s/^$CLIENT{'clid'}.//; - if (defined $idlist and not $idlist->{$user}) { - $nresponses--; - next; - } - my $excuser="inc$user"; - if ($FORM{$excuser}) { - $nresponses--; - next; - } - &get_test_sequence_for_reports( $CLIENT{'clid'}, $user, $TEST{'id'}); - @qids = split(/\&/, $SUBTEST_QUESTIONS{2}); - @qrsp = split(/\&/, $SUBTEST_RESPONSES{2}); - @qsumry = split(/\&/, $SUBTEST_SUMMARY{2}); - @corincs = split(/\//, $qsumry[5]); - @qsumry = (); - @qsumry = split(/\&/, $SUBTEST_ANSWERS{2}); - @qansseq = (); - $fqid=""; - $fqididx=""; - for (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$_]); - ($qansord,$trash) = split(/::/, $qsumry[$_]); - $qansord =~ s/\=([0-1])//g; - $qansseq[$_] = $qansord; - - ($qresp,$qucmt) = split(/::/, $qrsp[$_]); - $qresp=~ tr/+/ /; - $qresp=~ tr/'//d; - $qrsp[$_]=$qresp; - - ##### v ADT - 7/03/2002 ################################### - # Added code to print NRT answers in the form of the comments - #push @qresponses, "$qidx\&$user\&$qresp"; - - if ($qucmt ne '') { - $qucmt =~ tr/+/ /; - $qucmt =~ tr/'//d; - push @qucmts, "$qidx\&$user\&$qucmt"; - } - ### DED 10/28/2002 Support for filter-by-question (FBQ) - if ($FORM{'question'} eq $qids[$_]) { - $fqididx=$_; - ($trash,$fqid)=split(/\./,$qids[$_]); - } - } - ### DED 10/28/2002 Support for filter-by-question (fbq) - #print "

    FormQues= $FORM{'question'} Ans= $FORM{'answer'} Qansseq= $qansseq[$fqididx]

    \n"; - if ($fqid ne "" && $FORM{'answer'} ne "") { - $fmatch=0; - if ($qstatsqf[$fqid] eq 'mcs' || $qstatsqf[$fqid] eq 'mca' || $qstatsqf[$fqid] eq 'lik') { - @fqansseq=split(/\?/,$qansseq[$fqididx]); - shift @fqansseq; - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - foreach $fans (@fans) { - @ffresp=(); - $fresp=""; - for (0 .. $#fqansseq) { - $fqseqans[$fqansseq[$_]]=$_; - $ffresp[$_]="xxx"; - } - if ($fans ne "No+Response") { - $ffresp[$fqseqans[$fans]]=$fqseqans[$fans]; - } - if ($ffresp[0] eq "") { - $fresp=""; - } else { - foreach (@ffresp) { - $fresp=join('?',$fresp,$_); - } - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "") { - $fmatch=1; - } - @ffresp=(); - if ($fmatch == 1) { break; } - } - @fqansseq=(); - @fans=(); - } elsif ($qstatsqf[$fqid] eq 'mcm') { - @fqansseq=split(/\?/,$qansseq[$fqididx]); - shift @fqansseq; - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - @ffresp=(); - $fresp=""; - for (0 .. $#fqansseq) { - $fqseqans[$fqansseq[$_]]=$_; - $ffresp[$_]="xxx"; - } - if ($fans[0] ne "No+Response") { - foreach (@fans) { - $ffresp[$fqseqans[$_]]=$fqseqans[$_]; - } - } - if ($ffresp[0] eq "") { - $fresp=""; - } else { - foreach (@ffresp) { - $fresp=join('?',$fresp,$_); - } - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "") { - $fmatch=1; - } - @fqansseq=(); - @fans=(); - @ffresp=(); - } elsif ($qstatsqf[$fqid] eq 'tf') { - if ($FORM{'answer'} eq "\&0" ) { - $fresp=$qansseq[$fqididx]; - } elsif ($FORM{'answer'} eq "\&1" ) { - SWITCH: for ($qansseq[$fqididx]) { - $fresp = /TRUE/ && "FALSE" - || /FALSE/ && "TRUE" - || /YES/ && "NO" - || /NO/ && "YES" - || "bad"; - } - } elsif ($FORM{'answer'} eq "\&No+Response") { - $fresp=""; - } else { - $fresp="bad"; - } - if ($qrsp[$fqididx] eq $fresp && $fresp ne "bad") { - $fmatch=1; - } - } elsif ($qstatsqf[$fqid] eq 'esa') { - ($fqstatsqr,$trash)=split(/;Other/,$fqstatsqr[$fqid]); - @fqr=split(/\;/,$fqstatsqr); - @fans=split(/\&/,$FORM{'answer'}); - shift @fans; - if ($fans[0] eq "No+Response") { - $fqr=""; - if ($fqr eq $qrsp[$fqididx]) { - $fmatch=1; - } - } else { - foreach (@fans) { - $fqr=lc($fqr[$_]); - $fqrsp=lc($qrsp[$fqididx]); - if ($fqr eq $fqrsp && $fqr ne "") { - $fmatch=1; - last; - } - } - } - @fqr=(); - @fans=(); - } - #print "

    FQid= $fqid Qtp= $qstatsqf[$fqid] Qstatsid= $qstatsid[$fqid] Fresp= $fresp Qrsp=$qrsp[$fqididx]

    \n"; - if ($fmatch == 0) { - ### Don't count this one - #print "...Skipping..."; - $nresponses--; - @fqucmts = @qucmts; - @qucmts = (); - foreach (@fqucmts) { - if (!($_ =~ /\&$user\&/)) { - push @qucmts, "$_"; - } - } - next; - } - $fresp=""; - } - ### DED End fbq support - @qsumry=(); - for (1 .. $#qids) { - ($test,$qidx) = split(/\./, $qids[$_]); - if ($qstatsqf[$qidx] ne 'obs') { - $qstatsqc[$qidx]++; - $qstatsqp[$qidx] = format_percent(($qstatsqc[$qidx] / $ncount), - { fmt => "%.0f" } ); - @qstatc = split(/\;/, $qstatsqrc[$qidx]); - @qstatp = split(/\;/, $qstatsqrp[$qidx]); - if ($qstatsqf[$qidx] eq 'tf') { - @qstato = split(/\;/, $qstatsqr[$qidx]); - if ($qrsp[$_] eq $qstato[0]) { - $qstatc[0]++; - } elsif ($qrsp[$_] eq $qstato[1]) { - $qstatc[1]++; - } else { - $qstatc[2]++; - } - }elsif ($qstatsqf[$qidx] eq 'esa'){ - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/\+/ /g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 1) { - @qansord = split(/\;/, $qansseq[$_]); - for $q (0 .. $#qansord) { - if ($qansord[$q] eq $qresp) { - $qstatc[$q]++; - last; - } - } - } else { # incorrect - $found=0; - @qstatw=split(/\;/,$qstatsqw[$qidx]); - shift(@qstatw); - for $q (0 .. $#qstatw) { - if ($qstatw[$q] eq $qresp) { - $qstatsqwc[$q]++; - $found=1; - last; - } - } - if ($found != 1) { - $qstatsqwc[$#qstatw+1]=1; - $qstatsqw[$qidx]=join(';',$qstatsqw[$qidx],$qresp); - } - @qstatq=(); - } - } else { - $qstatc[$#qstatc]++; - } - @qansord = (); - } elsif ($qstatsqf[$qidx] eq 'nrt'){ - # HBI This is the code to put the narrative answers in the report. - if ($qrsp[$_] ne '') { - $qstatc[1]++; - $qrsp[$_] =~ s/\;/\:/g; - $qrsp[$_] =~ s/\r//g; - $qrsp[$_] =~ s/\n/\\n/g; - - $qstatsqr[$qidx] = join('

    ',$qstatsqr[$qidx],$qrsp[$_]); - } else { - $qstatc[2]++; - } - } elsif ($qstatsqf[$qidx] eq 'mcs' || $qstatsqf[$qidx] eq 'mca' || $qstatsqf[$qidx] eq 'lik') { - ### DED Filter out "?" and "xxx" in qrsp so will match - $qrsp[$_] =~ s/\?//g; - $qrsp[$_] =~ s/xxx//g; - @qansord = split(/\?/, $qansseq[$_]); - shift @qansord; - $found = 0; - ### DED 10/09/02 Changed to allow for - ### randomized answers - #for (my $i = 0; $i <= $#qansord; $i++ ) { - #if (("$qansord[$i]" eq "$qrsp[$_]") && ($qrsp[$_] ne '')) { - if ($qrsp[$_] ne '') { - $qstatc[$qansord[$qrsp[$_]]]++; - $found = 1; - } - #} - unless ($found) { - # increment "No Response" - $qstatc[$#qstatc]++; - } - @qansord = (); - } elsif ($qstatsqf[$qidx] eq 'mtx') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qidx]); - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - - # skipping answer sequence part (no rand answ) - $holding3 = $_; - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - $i=0; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - if ($qresps[$i] ne "xxx") { - $qstatc[$i]++; - } - $i++; - } - } - } - } else { - # increment No Response counter - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mtr') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qidx]); - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - - # skipping answer sequence part (no rand answ) - $holding3 = $_; - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - $iqresps=0; - $iqstatc=0; - foreach $qiarow (@qiar) - { - foreach $qiacol (@qiac) - { - if ($qresps[$iqresps] ne "xxx") - { - # $qresps[$iqresps] will be [1..10], so adjust index accordingly - $irank = $iqstatc + $qresps[$iqresps] - 1; - $qstatc[$irank]++; - } - $iqresps++; - $iqstatc += 10; - } - } - } - } else { - # increment No Response counter - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mcm') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - if ($corinc == 0) { - @qansord = split(/\?/, $qansseq[$_]); - shift @qansord; - $holding3 = $_; - #$found = 0; - ### DED 10/18/02 Changed to allow for - ### randomized answers & new format - @qresps = split(/\?/, $qrsp[$_]); - shift @qresps; - foreach $qresp (@qresps) { - if ($qresp ne "xxx") { - $qstatc[$qansord[$qresp]]++; - } - } - } - } else { - $qstatc[$#qstatc]++; - } - @qansord = (); - $_ = $holding3; - } elsif ($qstatsqf[$qidx] eq 'mch') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - ### DED 10/18/02 Changed for - ### random answers and new format - - # - # Count occurrence of each match - - # $qansseq[$qidx] [Wrong! DED] - # $qansseq[$_] - # &a.3.2.0.6.5.8.4.7.1::MATCH.0:1:1:0 - # $qrsp[$_] - # &dgihbfcea [Old format] - # &?d?g?i?h?b?f?c?e?a [New] - - #$qansseq[$qidx] =~ s/\&//g; - $qansseq[$_] =~ s/\&//g; - $qrsp[$_] =~ s/\&//g; - $qrsp[$_] =~ s/ //g; - #@corord = split(/\./, $qansseq[$qidx]); - @corord = split(/\./, $qansseq[$_]); - #@selord = split(//,$qrsp[$_]); - @selord = split(/\?/,$qrsp[$_]); - shift @selord; - $corhold = $_; - if ($corinc == 0) { - for (0 .. $#selord) { - if ($selord[$_] ne 'xxx') { - ($x = &get_label_index($corord[0],$selord[$_]))++; - $y = $corord[$x]; - - #$ncountidx = int($_ * $#corord + $y); - $ncountidx = int($y * $#corord + $_); - } else { - $ncountidx = int(($#corord * $#corord ) + $_); - } - $qstatc[$ncountidx]++; - } - } - $_ = $corhold; - @selord = (); - @corord = (); - } else { - $qstatc[$#qstatc]++; - } - } elsif ($qstatsqf[$qidx] eq 'ord') { - $ncountidx = $#qstatc - 2; - $qresp = $qrsp[$_]; - $qresp =~ s/xxx//g; - ### DED 10/18/02 Changed for - ### random answers and new format - $qresp =~ s/\?//g; - if ($qresp ne '') { - # - # if answered, Determine from the score summary - # if answered correctly - # - $corinc = substr($corincs[$_], 0, 1); - if ($corinc == 0) { - $ncountidx++; - } - $qstatc[$ncountidx]++; - - # - # Count occurrence of each incorrect order - # &o.2.3.4.1.0::ORDERED.0:1:1:0 - # &34521 [Old format] - # &?3?4?5?2?1 [New] - # - #$qansseq[$qidx] =~ s/\&//g; - $qansseq[$_] =~ s/\&//g; - $qrsp[$_] =~ s/\&//g; - #@corord = split(/\./, $qansseq[$qidx]); - @corord = split(/\./, $qansseq[$_]); - #@selord = split(//,$qrsp[$_]); - @selord = split(/\?/,$qrsp[$_]); - shift @selord; - $corhold = $_; - if ($corinc == 0) { - for (1 .. $#corord) { - $ncountidx = int(($corord[$_]) * $#corord); - $x = int($_ - 1); - if ($selord[$x] ne 'xxx') { - $ncountidx = $ncountidx + int($selord[$x]) - 1; - } else { - $ncountidx = int(($#corord * $#corord) + $_ - 1); - } - $qstatc[$ncountidx]++; - } - } - $_ = $corhold; - @selord = (); - @corord = (); - } else { - $qstatc[$#qstatc]++; - } - } - ### DED 8/20/2002 If checked, don't count - ### "No Response" in statistics - if ($FORM{'exnoresp'}) { - if ($qstatsqc[$qidx] > $qstatc[$#qstatc]) { - $denom = $qstatsqc[$qidx] - $qstatc[$#qstatc]; - } else { - $denom = 1; - } - for (my $i = 0; $i <= $#qstatc-1; $i++ ) { - $qstatp[$i] = format_percent($qstatc[$i] / $denom); - } - } else { - for (my $i = 0; $i <= $#qstatc; $i++ ) { - $qstatp[$i] = format_percent($qstatc[$i] / $qstatsqc[$qidx]); - } - } - - $qstatsqrc[$qidx] = ""; - foreach $qstat (@qstatc) { - $qstatsqrc[$qidx] = join('', $qstatsqrc[$qidx], "$qstat\;"); - } - $qstatsqrp[$qidx] = ""; - ### DED 8/22/2002 Exclude "No Response" - ### from statistics - if ($FORM{'exnoresp'}) { - $count = $#qstatc-1; - } else { - $count = $#qstatp - } - for (0 .. $count) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstatp[$_]\;"); - } - } - if (($qstatsqf[$qidx] eq 'mcm') || ($qstatsqf[$qidx] eq 'mch') || ($qstatsqf[$qidx] eq 'ord') || ($qstatsqf[$qidx] eq 'mtx') || ($qstatsqf[$qidx] eq 'mtr')) { - $npctidxend = $#qstatc - 3; - $nincidx = $#qstatc - 1; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $npctidxend; $i++ ) { - if ($ntotinc == 0) { - $qstatp[$i] = 0; - } else { - $qstatp[$i] = format_percent($qstatc[$i] / $ntotinc); - } - } - $qstatsqrp[$qidx] = ""; - foreach $qstat (@qstatp) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstat\;"); - } - } elsif ($qstatsqf[$qidx] eq 'esa') { - $npctidxend = $#qstatc - 3; - $ncoridx = $#qstatc - 2; - $nincidx = $#qstatc - 1; - $ntotcor = $qstatc[$ncoridx]; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $npctidxend; $i++ ) { - if ($ntotcor == 0) { - $qstatp[$i] = 0; - } else { - $qstatp[$i] = format_percent($qstatc[$i] / $ntotcor); - } - } - $qstatsqrp[$qidx] = ""; - foreach $qstat (@qstatp) { - $qstatsqrp[$qidx] = join('', $qstatsqrp[$qidx], "$qstat\;"); - } - $nincidx = $#qstatc - 1; - $ntotinc = $qstatc[$nincidx]; - for (my $i = 0; $i <= $#qstatsqwc; $i++ ) { - if ($ntotinc == 0) { - $qstatsqwp[$i] = 0; - } else { - $qstatsqwp[$i] = format_percent($qstatsqwc[$i] / $ntotinc); - } - } - } - @qstato = (); - @qstatc = (); - @qstatp = (); - } -} - -if ($#qucmts != -1) { - @qsumry=sort @qucmts; - @qucmts=@qsumry; - @qsumry=(); -} - - print HTMLHeaderPlain("Question Response Statistics"); - print "

    $TEST{'desc'}
    Question Response Statistics


    \n"; - print "$FORM{'orgname'}
    \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
    \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
    \n"; - } else { - #print "Organization-wide Report
    \n"; - print "
    \n"; - } - print $timestamp; - print "
    \n"; - print "
    \n"; - -print "$nresponses Completed Responses - - -"; -$sobsolete = ""; -if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $incresponse = ""; -} else { - $incresponse = "INCORRECT"; -} -for (1 ..$#questions) { - ($test,$qid) = split(/\./, $qstatsid[$_]); - if (!($FORM{'exunans'} && $qstatsqc[$qid] < $FORM{'minunans'})) { - if ($qstatsqf[$qid] eq 'obs') { - if ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') { - $sobs = " - - - - - - - "; - $sobsolete = join('', $sobsolete, $sobs); - } - } else { - if (($qstatsqf[$qid] eq 'mcm') || ($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord') || ($qstatsqf[$qid] eq 'esa') || ($qstatsqf[$qid] eq 'mtx') || ($qstatsqf[$qid] eq 'mtr')) { - if ($qstatsqf[$qid] eq 'mch') { - @qstato = split(/
    /, $qstatsqr[$qid]); - } else { - @qstato = split(/\;/, $qstatsqr[$qid]); - } - if ($qstatsqf[$qid] eq 'esa') { - @qstatw = split(/\;/, $qstatsqw[$qid]); - shift @qstatw; - } - $rowspan1 = ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') ? 5 : 4; - $rowspan2 = ($TEST{'seq'} ne 'svy' && $TEST{'seq'} ne 'dmg') ? 5 : 4; - } else { - @qstato = split(/\;/, $qstatsqr[$qid]); - if ( $qstatsqf[$qid] eq 'nrt' ){ - $qstato[1] =~ s/\/\//
    /g; - $qstato[1] =~ s/\//
    /g; - $qstato[1] =~ s/:/
    /g; - $qstato[1] =~ s/\+/ /g; - } - $rowspan1 = 2; - $rowspan2 = 2; - } - if ($FORM{'showcmts'} eq 'withq') { - $rowspan1++; - $rowspan2++; - } - $outary[$_] .= " - - - - - - "; - - @qstatc = split(/\;/, $qstatsqrc[$qid]); - @qstatp = split(/\;/, $qstatsqrp[$qid]); - if (($qstatsqf[$qid] eq 'mcm') || ($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord') || $qstatsqf[$qid] eq 'esa' || $qstatsqf[$qid] eq 'mtx' || $qstatsqf[$qid] eq 'mtr') { - $ncountidx = $#qstatc - 2; - $qstatccor = $qstatc[$ncountidx]; - $qstatpcor = $qstatp[$ncountidx]; - $qstatcinc = $qstatc[$ncountidx+1]; - $qstatpinc = $qstatp[$ncountidx+1]; - $qstatcnor = $qstatc[$ncountidx+2]; - $qstatpnor = $qstatp[$ncountidx+2]; - if ($TEST{'seq'} ne svy && $TEST{'seq'} ne dmg) { - $outary[$_] .= " - - - - - "; - $outary[$_] .= " - - - - - "; - } else { - $outary[$_] .= " - - - - - "; - } - $outary[$_] .= " - - "; - if ($FORM{'exnoresp'}) { - $outary[$_] .= "\n"; - } else { - $outary[$_] .= "\n"; - } - $outary[$_] .= " - - "; - } - if (($qstatsqf[$qid] eq 'mch') || ($qstatsqf[$qid] eq 'ord')) { - if ($qstatsqf[$qid] eq 'mch') { - $sphrase = "(matched to \>\;\>\;\>\;)"; - @matchwords = (); - @matchtos = (); - foreach $qstat (@qstato) { - ($matchword, $matchto) = split(/\=\=\=/, $qstat); - push @matchwords, $matchword; - push @matchtos, $matchto; - } - push @matchtos, "Left Blank"; - } else { - $sphrase = "(ordered as number \>\;\>\;\>\;)"; - @matchwords = (); - @matchtos = @qstato; - $matchidx = 1; - foreach $qstat (@qstato) { - push @matchwords, "$matchidx"; - $matchidx++; - } - push @matchtos, "Not Used"; - } - $colspan = int((($#matchwords + 1) * 2) + 1); - $outary[$_] .= " - - "; - } elsif ($qstatsqf[$qid] eq 'mtx' || $qstatsqf[$qid] eq 'mtr') { - ($id,$qtp,$qim,$qil,$qtx,$qca,$qia,$qrm) = split(/\&/, $questions[$qid]); - ($qiar, $numqiar, $numqiac, $qiac) = split("::", $qia); - @qiar = split("\;", $qiar); - @qiac = split("\;", $qiac); - $holdmcm = $_; - if ($qstatsqf[$qid] eq 'mtr') - { - $colspan = ($#qiac + 1) * 3 + 1; - $colspan2 = 3; - } - else - { - $colspan = ($#qiac + 1) * 2 + 1; - $colspan2 = 2; - } - $outary[$_] .= " - - - "; - } elsif ($qstatsqf[$qid] eq 'mcm') { - $outary[$_] .= " - - - "; - } elsif ($qstatsqf[$qid] eq 'esa') { - $outary[$_] .= " - - - "; - } elsif ($qstatsqf[$qid] eq 'nrt' ) { - - ##### v ADT - 7/03/2002 ################################################ - # If you want to remove the NRT statistics, delete between these comments - ######################################################################## - $outary[$_] .= " - - - - - - "; - $outary[$_] .= " - - "; - $outary[$_] .= " - - "; - ##### ^ ADT - 7/03/2002 - End Delete ################################### - - ##### v ADT - 7/03/2002 ################################################ - # Added code to print NRT answers in the form of the comments - ######################################################################## - #print "\n\t\n\t\t\n\t\n"; - ##### ^ ADT - 7/03/2002 ################################################ - - } else { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $bs = ""; - $be = ""; - } else { - $bs = ""; - $be = ""; - } - $outary[$_] .= " - - - - - \n"; - } - if (($FORM{'showcmts'} eq 'withq') && ($#qucmts != -1)) { - ##### v ADT - 7/03/2002 ################################################ - # Modified code to add the comments to the same table cell as the - # answers if the question is a Narrative question - ######################################################################## - #if( $qstatsqf[$qid] ne 'nrt' ) { - print "\t\n\t\t - \n"; - } - $outary[$_] .= " - - - \n"; - @qstato = (); - @qstatc = (); - @qstatp = (); - } - } -} -if (($FORM{'showcmts'} eq 'atend') && ($#qucmts != -1)) { - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n\n"; -} -@qucmts=(); -# Read in .rgo file which defines question presentation order -if ($FORM{'tstid'} =~ /SAS/) { - $lookupfile = join($pathsep,$dataroot,"IntegroSAS.rgo"); - } elsif ($FORM{'tstid'} =~ /^TAQ/) { - $lookupfile = join($pathsep,$dataroot,"IntegroTAQ.rgo"); -} -if (-e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - $out = ""; - my @lines = <$fh>; - $fh->close(); - shift @lines; - foreach (@lines) { - chomp; - my @line = split(/\&/,$_); - my $section = shift @line; - if ($section ne "") { - $out .= "\n"; - $out .= "\n"; - } - foreach my $sub (@line) { - my ($subheader, $quess) = split(/:/,$sub); - if ($subheader ne "") { - $out .= "\n"; - } - @ques = split(/\,/,$quess); - foreach my $quesid (@ques) { - $out .= $outary[$quesid]; - } - } - } - print $out; - } -} else { - for (1 ..$#questions) { - print $outary[$_]; - } -} -if ($FORM{'showobs'}) { - print "$sobsolete"; -} -print "

    $qstatsid[$_]INACTIVE$qstatsqt[$qid]

    $qstatsid[$_]$qstatsqc[$qid]$qstatsqp[$qid]\%$qstatsqt[$qid]
    $qstatccor$qstatpcor\%$xlatphrase[137]
    $qstatcinc$qstatpinc\%INCORRECT
    $qstatcinc$qstatpinc\%RESPONSES
    $qstatcnor $qstatpnor\%$xlatphrase[670]
    - - - - - - "; - foreach $matchword (@matchwords) { - $outary[$_] .= " - "; - } - $outary[$_] .= " - - "; - foreach $matchword (@matchwords) { - $outary[$_] .= " - - "; - } - $outary[$_] .= " - "; - $matchidx = 0; - foreach $matchto (@matchtos) { - $outary[$_] .= " - "; - if ($matchto eq $matchtos[$#matchtos]) { - $outary[$_] .= " - "; - } else { - $outary[$_] .= " - "; - } - foreach $matchword (@matchwords) { - $outary[$_] .= " - - "; - $matchidx++; - } - $outary[$_] .= " - "; - } - $outary[$_] .= " -
    BREAKDOWN OF $incresponse RESPONSES
    $sphrase$matchword
    CntPct
    $matchto$matchto$qstatc[$matchidx]$qstatp[$matchidx]\%
    -
    - - - - - - "; - foreach $qiacol (@qiac) - { - $outary[$_] .= ""; - } - $outary[$_] .= "\n - - "; - foreach $qiacol (@qiac) - { - if ($qstatsqf[$qid] eq 'mtr') - { - $outary[$_] .= ""; - } - $outary[$_] .= " - "; - } - $outary[$_] .= "\n\n"; - $i=0; - foreach $qiarow (@qiar) - { - $outary[$_] .= " - "; - foreach $qiacol (@qiac) - { - if ($qstatsqf[$qid] eq 'mtr') - { - $outary[$_] .= ""; - $outary[$_] .= ""; - $outary[$_] .= ""; - $i += 10; - } - else - { - $outary[$_] .= ""; - $outary[$_] .= ""; - $i++; - } - } - $outary[$_] .= "\n\n"; - } - $outary[$_] .= "\n
    BREAKDOWN OF $incresponse RESPONSES
     $qiacol
     RankCntPct
    $qiarow"; - for $irank (1 .. 10) - { - $outary[$_] .= "$irank
    "; - } - $outary[$_] .= "
    "; - for $irank (1 .. 10) - { - $outary[$_] .= "$qstatc[$i+$irank-1]
    "; - } - $outary[$_] .= "
    "; - for $irank (1 .. 10) - { - $outary[$_] .= "$qstatp[$i+$irank-1]\%
    "; - } - $outary[$_] .= "
    $qstatc[$i]$qstatp[$i]\%
    -
    - - - - - - - - - - - - - - -
    BREAKDOWN OF $incresponse RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstato) { - $outary[$_] .= "$qstat
    "; - } - $outary[$_] .= "
    -
    "; - $holdmcm = $_; - $endidx = $#qstatc - 3; - for (0 .. $endidx) { - $outary[$_] .= "$qstatc[$_]
    "; - } - $outary[$_] .= "
    -
    "; - for (0 .. $endidx) { - $outary[$_] .= "$qstatp[$_]\%
    "; - } - $_ = $holdmcm; - $outary[$_] .= "
    -
    -
    - - - - - - - - - - - - - - -
    BREAKDOWN OF $xlatphrase[137] RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstato) { - $outary[$_] .= "$qstat
    "; - } - $outary[$_] .= "
    -
    "; - $holdmcm = $_; - $endidx = $#qstatc - 3; - for (0 .. $endidx) { - $outary[$_] .= "$qstatc[$_]
    "; - } - $outary[$_] .= "
    -
    "; - for (0 .. $endidx) { - $outary[$_] .= "$qstatp[$_]\%
    "; - } - $_ = $holdmcm; - $outary[$_] .= "
    -
    -

    "; - $outary[$_] .= " - - - - - - - - - - - - - - -
    BREAKDOWN OF $incresponse RESPONSES
    Response OptionCntPct
    "; - foreach $qstat (@qstatw) { - $outary[$_] .= "$qstat
    "; - } - $outary[$_] .= "
    -
    "; - $holdmcm = $_; - foreach (@qstatsqwc) { - $outary[$_] .= "$_
    "; - } - $outary[$_] .= "
    -
    "; - foreach (@qstatsqwp) { - $outary[$_] .= "$_\%
    "; - } - $_ = $holdmcm; - $outary[$_] .= "
    -
    -

    "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="$qstatc[2]
    $qstatc[1]"; - } else { - $outary[$_] .="$qstatc[0]
    $qstatc[2]
    $qstatc[1]"; - } - $outary[$_] .= "
    -
    "; - if ($FORM{'exnoresp'}) { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .=" 
    $qstatp[1]\%"; - } else { - $outary[$_] .="$qstatp[0]\%
     
    $qstatp[1]\%"; - } - } else { - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="$qstatp[2]\%
    $qstatp[1]\%"; - } else { - $outary[$_] .="$qstatp[0]\%
    $qstatp[2]\%
    $qstatp[1]\%"; - } - } - $outary[$_] .= "
    -
    "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="$qstato[1]
    $qstato[0]"; - } else { - $outary[$_] .="$qstato[0]
    $qstato[2]
    $qstato[1]"; - } - $outary[$_] .= "
    "; - $outary[$_] .= "
    -
     
     "; - if ($TEST{'seq'} eq 'svy' || $TEST{'seq'} eq 'dmg') { - $outary[$_] .="
    $qstato[2]"; - } else { - $outary[$_] .="
    $qstato[3]"; - } - $outary[$_] .= "
    -
    "; - #print "\n\t\t\t\n\t\t\t\t\n"; - #print "\t\t\t\t\t\n"; - #print "\t\t\t\t\t\n"; - #print "\t\t\t\t\n"; - #print "\t\t\t
    Answers:
    "; - #for $i (0 .. $#qresponses) { - #@columns=split(/\&/, $qresponses[$i]); - #if ($columns[0] eq $qid) { - #print "$columns[1]\:
    \n"; - #while (length($columns[2]) > 50) { - #$j=index($columns[2]," ",45); - #if ($j==-1) { - #$qresponse=substr($columns[2],0,50); - #$columns[2]=substr($columns[2],50); - #} else { - #$qresponse=substr($columns[2],0,$j); - #$j++; - #$columns[2]=substr($columns[2],$j); - #} - #print "$qresponse
    \n"; - #} - #print "$columns[2]
    \n"; - #} - #} - # - #print "
    \n\t\t
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstatc) { - $outary[$_] .= "$boldtag$qstat$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - $outary[$_] .= "
    -
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstatp) { - $outary[$_] .= "$boldtag$qstat\%$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - $outary[$_] .= "
    -
    "; - $boldtag = $bs; - $boldtagend = $be; - foreach $qstat (@qstato) { - $outary[$_] .= "$boldtag$qstat$boldtagend
    "; - $boldtag = ""; - $boldtagend = ""; - } - $outary[$_] .= "
    -
    \n\t\t\t"; - #} - $outary[$_] .= " - - - -
    \nComments:
    \n"; - ##### ^ ADT - 7/03/2002 ################################################ - for $i (0 .. $#qucmts) { - @columns=split(/\&/, $qucmts[$i]); - if ($columns[0] eq $qid) { - $outary[$_] .= "$columns[1]\:
    \n"; - while (length($columns[2]) > 50) { - $j=index($columns[2]," ",45); - if ($j==-1) { - $qucmt=substr($columns[2],0,50); - $columns[2]=substr($columns[2],50); - } else { - $qucmt=substr($columns[2],0,$j); - $j++; - $columns[2]=substr($columns[2],$j); - } - $outary[$_] .= "$qucmt
    \n"; - } - $outary[$_] .= "$columns[2]
    \n"; - } - } - $outary[$_] .= "
    -


    Comments
    \n"; - $outary[$_] .= "\n"; - for (1 ..$#questions) { - ($test,$qid) = split(/\./, $qstatsid[$_]); - if ($qstatsqf[$qid] ne 'obs') { - for $i (0 .. $#qucmts) { - @columns=split(/\&/, $qucmts[$i]); - if ($columns[0] eq $qid) { - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - $outary[$_] .= "\n"; - } - } - $outary[$_] .= "\n"; - } - } - $outary[$_] .= "\n\n
    IDUserComments
    $qstatsid[$_]$columns[1]\n"; - while (length($columns[2]) > 70) { - $j=index($columns[2]," ",65); - if ($j==-1) { - $qucmt=substr($columns[2],0,70); - $columns[2]=substr($columns[2],70); - } else { - $qucmt=substr($columns[2],0,$j); - $j++; - $columns[2]=substr($columns[2],$j); - } - $outary[$_] .= "$qucmt
    \n"; - } - $outary[$_] .= "$columns[2]
    \n"; - $outary[$_] .= "

    \n
    $section

    $subheader:
    \n"; -print "
    \n"; -print HTMLFooter(); -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\n". - "\n"; -} - -sub HTMLFooter { - my $year = `date +%Y`; - return "
    Copyright (c) 2004-$year, Integro Leadership Institute
    \n\n"; -} - -# -# -# diff --git a/survey-nginx/cgi-bin/IntegroTeam.pl.bu20131217 b/survey-nginx/cgi-bin/IntegroTeam.pl.bu20131217 deleted file mode 100755 index 3e090315b..000000000 --- a/survey-nginx/cgi-bin/IntegroTeam.pl.bu20131217 +++ /dev/null @@ -1,623 +0,0 @@ -#!/usr/bin/perl -# -# $Id: IntegroTeam.pl,v 1.13 2006/04/12 19:18:47 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 $testinprog $testcomplete $testpending $cgiroot $pathsep $dataroot @rptparams); - -&app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -&get_client_profile($SESSION{'clid'}); - -if ($FORM{'tstid'}) { - &get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); -} 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 =~ "^TAQ") {push @tmptrecs, join('&', "$desc", "$id");} - } - @trecs = sort @tmptrecs; - if ($#trecs > 0) { - # show test chooser - &print_test_chooser(@trecs); - } -} - - -# 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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
    ".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 (defined $timestamp) { - $timestamp = "$timestamp

    \n"; -} else { - $timestamp = "
    \n"; -} - -# Is this report for a specific canidate? -my $cndid; -#print STDERR "$FORM{'specificuser'} $FORM{'cndid'}\n"; -if ($FORM{'specificuser'} and (not $idlist or $idlist->{$FORM{'cndid'}})) { - $cndid = $FORM{'cndid'}; -} - -# Generate the reports -if ($FORM{'reportname'} eq 'commeffect') { - &CommEffectReport($idlist, $groups, $timestamp, $cndid); -} elsif ($FORM{'reportname'} eq 'commeffectsummary') { - &CommEffectSummary($idlist, $groups, $timestamp); -} elsif ($FORM{'reportname'} eq 'trustlevel') { - &TrustLevelReport($idlist, $groups, $timestamp, $cndid); -} elsif ($FORM{'reportname'} eq 'trustlevelsummary') { - &TrustLevelSummary($idlist, $groups, $timestamp); -} elsif ($FORM{'reportname'} eq 'comments') { - &CommentsReport($idlist, $timestamp, 0); -} elsif ($FORM{'reportname'} eq 'comments2') { - &CommentsReport($idlist, $timestamp, 1); -} else { - &ReportChooser(); -} - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\n". - "\n"; -} - -sub HTMLFooter { - my $year = `date +%Y`; - return "
    Copyright (c) 2004-$year, Integro Leadership Institute
    \n\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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - - my $orgname = $CLIENT{'clnmc'}; - my $uberheader; - my $test; - if ($FORM{'tstid'}) { - $test = $FORM{'tstid'}; - } elsif ($rptparams[0]) { - $test = $rptparams[0]; - } else { - $test = "TAQ01"; - } - my ($tstid) = grep((/($test\s*)&/ && ($_=$1)),get_data("tests.$CLIENT{'clid'}")); - if (not $tstid) { - print HTMLHeader("Error! No Team Alignment Questionnaire Found."); - print "

    Error! No Team Alignment Questionnaire Found.

    \n"; - print HTMLFooter(); - } - - my $grplist = getGroups($CLIENT{'clid'}); - my @grplist = keys(%$grplist); - my $grplistlen = $#grplist + 2; - $js .= "var groups = new Array($grplistlen)\;\n"; - foreach my $grp (@grplist) { - my $gidlist = getIdlist($CLIENT{'clid'}, $grp); - my @gidklist = keys(%$gidlist); - $js .= "groups[\"$grp\"] = ["; - foreach my $cnd (@gidklist) { - $js .= "\"$cnd\", "; - } - if ($#gidklist > -1) { $js = substr($js,0,-2); } - $js .= "]\;\n"; - $js .= "groups[\"$grp\"] = groups[\"$grp\"].sort()\;\n"; - } - $js .= "groups[\"all\"] = ["; - my $users = get_users($CLIENT{'clid'},"$tstid"); - my @users = keys(%$users); - foreach my $cnd (@users) { - $js .= "\"$cnd\", "; - } - if ($#users + 1) { $js = substr($js,0,-2); } - $js .= "]\;\n"; - $js .= "groups[\"all\"] = groups[\"all\"].sort()\;\n"; - $js .= "function removeOptions(optionMenu) { \ - var oml = optionMenu.options.length; \ - for (var i=0; i < oml; i++) { \ - optionMenu.remove(0); \ - } \ -} \ - \ -function addOptions(optionList, optionMenu) { \ - var oml = optionMenu.options.length; \ - for (var i=0; i < optionList.length; i++) { \ - optionMenu[oml+i] = new Option(optionList[i], optionList[i]); \ - } \ -} "; - $js .= "function buildGroupList(optionListArray, optionListMenu, optionMenu) {\n\t". - " removeOptions(optionMenu);". - " for (var i=0; i\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\n\n". - "\n". - "\n"; - print "\n"; - print ""; - print "
    Team Alignment Reports
    All GroupsChoose Groups
    \n". - "
    Specific User
    "; - print "
    \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 "

    \n"; - print "

    \n"; - print "

    General Reports

    • Comments
    • "; - print "
    • Comments by Category
    • "; - print "\n"; - print "\n"; - #my $commurl = "/cgi-bin/teststats.pl?tstid=SAS01". -# "&tid=$FORM{'tid'}&rptid=ACT-C-004&rptdesc=Test%20Statistics%20by%20Test". -# "&testsummary=composite&showcmts=donot"; - print "
    • Question Statistics
    • \n"; - print ""; - print "\n"; - print HTMLFooter(); -} - -# Also known as the Group Alignment report -sub CommEffectReport { - my ($idlist,$groups,$timestamp,$cndid) = @_; - my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my $user; - if ($cndid) {$user = &CommEffectData($CLIENT{'clid'},$TEST{'id'},{$cndid => 1},$groups);&get_candidate_profile($CLIENT{'clid'},$cndid);} - my $claritysum = $data->{'organization'}->{'claritysum'}; - my $approvalsum = $data->{'organization'}->{'approvalsum'}; - my $histograms = $data->{'organization'}->{'histogram'}; - print HTMLHeaderPlain("Team Alignment Report"); - print "
      Team Alignment Questionnaire
      Team Alignment Report

      $CANDIDATE{'sal'} $CANDIDATE{'nmf'} $CANDIDATE{'nmm'} $CANDIDATE{'nml'}

      \n"; - print "The Degree to which Team Members are in Alignment
      \n"; - print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n"; - } else { - #print "Organization-wide Report
      \n"; - print "
      \n"; - } - print $timestamp; - print "". - "". - "". - "\n"; - # fill in the rows - my $overall = {'clarity' => 0, 'approval' => 0}; - foreach my $row (qw(Purpose Values Vision Goals Procedures Roles)) { - print ""; - for my $i (0..6) { - print ""; - } - printf "\n", $claritysum->{$row}->{'value'}; - printf "\n", $approvalsum->{$row}->{'value'}; - print "\n"; - } - print "
          Very Unclear    Moderately Unclear    Moderately Clear    Very ClearTeam ClarityTeam Approval
      $row"; - if ($histograms->{$row}->{'Clarity'}->[$i]) { - if ($histograms->{$row}->{'Approval'}->[$i]->[2]) { - my $img = "/graphic/face-smile.gif"; - if ($user and $user->{'organization'}->{'histogram'}->{$row}->{'Approval'}->[$i]->[2]) { - $img = "/graphic/face-smile-green.gif"; - } - print "$histograms->{$row}->{'Approval'}->[$i]->[2]
      "; - } - if ($histograms->{$row}->{'Approval'}->[$i]->[1]) { - my $img = "/graphic/face-red.gif"; - if ($user and $user->{'organization'}->{'histogram'}->{$row}->{'Approval'}->[$i]->[1]) { - $img = "/graphic/face-red-green.gif"; - } - print "$histograms->{$row}->{'Approval'}->[$i]->[1]
      "; - } - if ($histograms->{$row}->{'Approval'}->[$i]->[0]) { - my $img = "/graphic/face-blue.gif"; - if ($user and $user->{'organization'}->{'histogram'}->{$row}->{'Approval'}->[$i]->[0]) { - $img = "/graphic/face-blue-green.gif"; - } - print "$histograms->{$row}->{'Approval'}->[$i]->[0]"; - } - } else { - print " "; - } - print "
      %.1f %%%.1f %%
      \n

      Position = Team Clarity

      \n

      Countenance = Personal Approval

      \n"; - #print "\n"; - #printf "\n", $data->{'organization'}->{'overallclarity'}; - #printf "\n", $data->{'organization'}->{'overallapproval'}; - #print "
      Overall Team Alignment
      Clarity%.1f %%
      Approval%.1f %%
      \n"; - print HTMLFooter(); -} - -sub CommEffectSummary { - my ($idlist,$groups,$timestamp) = @_; - my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - $groups = getGroups($CLIENT{'clid'}); - print HTMLHeaderPlain("Team Alignment Summary"); - print "
      Team Alignment Questionnaire
      Team Alignment Summary


      \n"; - print "The degree to which Employees are Aligned with the Organization
      \n"; - print "$FORM{'orgname'}
      \n"; - if (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n"; - } else { - #print "Organization-wide Report
      \n"; - print "
      \n"; - } - print $timestamp; - print "\n"; - print "\n"; - print ""; - printf "",$data->{'organization'}->{'overallclarity'}; - printf "\n", $data->{'organization'}->{'overallapproval'}; - if (exists $data->{'groups'}) { - print "\n"; - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - printf "", $data->{'groups'}->{$grp}->{'overallclarity'}; - printf "\n", $data->{'groups'}->{$grp}->{'overallapproval'}; - } - } - print "
       ClarityApproval
      Overall%.1f %%%.1f %%
      Group Breakdown
      GroupClarityApproval
      $groups->{$grp}->{'grpnme'}%.1f %%%.1f %%
      \n"; - print HTMLFooter(); -} - -sub TrustLevelReport { - my ($idlist,$groups,$timestamp,$cndid) = @_; - my $data = &TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups); - my $user; - if ($cndid) {$user = &TrustLevelData($CLIENT{'clid'},$TEST{'id'},{$cndid => 1},$groups);&get_candidate_profile($CLIENT{'clid'},$cndid);} - my $histograms = $data->{'organization'}->{'histogram'}; - my $trust = $data->{'organization'}->{'trust'}; - print HTMLHeaderPlain("Team Trust Level Report"); - print "
      Team Alignment Questionnaire
      Team Trust Level Report

      $CANDIDATE{'sal'} $CANDIDATE{'nmf'} $CANDIDATE{'nmm'} $CANDIDATE{'nml'}

      \n"; - print "The level of Trust Building behaviors
      \n"; - print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n"; - } else { - #print "Organization-wide Report
      \n"; - print "
      \n"; - } - print $timestamp; - print "\n"; - my $baseurl; - if (defined($ENV{'SSL_PROTOCOL'})) { - $baseurl = "https://"; - } else { - $baseurl = "http://"; - } - $baseurl .= $ENV{'HTTP_HOST'}; - - $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)) { - my $url; - if (not $user) { - $url = "$baseurl&values=".join(":",@{$histograms->{$row}}); - } else { - my (@values,@values2); - for (my $i=0; $i < @{$histograms->{$row}}; $i++) { - if ($user->{'organization'}->{'histogram'}->{$row}->[$i]) { - push @values ,''; - push @values2 , $histograms->{$row}->[$i]; - } else { - push @values2 ,''; - push @values , $histograms->{$row}->[$i]; - } - } - $url = "$baseurl&values=".join(":",@values)."&values2=".join(":",@values2); - } - print ""; - print ""; - printf "\n", $trust->{$row}->{'value'}; - } - print "
        Team Trust Level
      $row%.1f%%
      \n"; - #printf "

      Overall Team Level of Trust = %.1f %%.

      \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("Team Trust Level Summary"); - print "
      Team Alignment Questionnaire
      Team Trust Level Summary


      \n"; - print "The level of Trust Building behaviors
      \n"; - print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Summary for Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n"; - } else { - #print "Organization-wide Summary
      \n"; - print "
      \n"; - } - print $timestamp; - print "\n"; - print "\n"; - print ""; - printf "\n", $data->{'organization'}->{'overalltrust'}; - if (exists $data->{'groups'}) { - print "\n"; - print "\n"; - foreach my $grp (sort keys %{$data->{'groups'}}) { - print ""; - printf "\n", $data->{'groups'}->{$grp}->{'overalltrust'}; - } - } - print "
       Team Trust Level
      Overall%.1f %%
      Group Breakdown
      GroupTeam Trust Level
      $groups->{$grp}->{'grpnme'}%.1f %%
      \n"; - print HTMLFooter(); -} - -sub CommentsReport { - my ($idlist, $timestamp, $bycat) = @_; - 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 "
      Team Alignment Questionnaire
      Comments Report


      \n"; - print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - my $groups = getGroups($CLIENT{'clid'}); - print "Groups: " - .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n"; - } else { - #print "Organization-wide Report
      \n"; - print "
      \n"; - } - print $timestamp; - print "
      \n"; - print "
      \n"; - - my @outary = (); - for (my $i=1; $i <=40; $i++) { - if ($comments[$i] == -1) { - # inactive question - next; - } - $outary[$i] = "
      \n"; - $outary[$i] .= "$questions[$i]->[0] - $questions[$i]->[4]

      \n"; - if (@{$comments[$i]}) { - $outary[$i] .= "

        \n"; - foreach (@{$comments[$i]}) { - $outary[$i] .= "
      • $_
      • \n"; - } - $outary[$i] .= "
      \n"; - } else { - $outary[$i] .= "
      • No Comments
      \n"; - } - $outary[$i] .= "
      \n"; - } - - # Read in .rgo file which defines question presentation order - my $out; - my $lookupfile = join($pathsep,$dataroot,"IntegroTAQ.rgo"); - if ($bycat && -e $lookupfile) { - my $fh = new FileHandle; - if ($fh->open($lookupfile)) { - $out = ""; - my @lines = <$fh>; - $fh->close(); - shift @lines; - foreach (@lines) { - chomp; - my @line = split(/\&/,$_); - my $section = shift @line; - if ($section ne "") { - $out .= "
      \n"; - $out .= "$section\n"; - } - foreach my $sub (@line) { - my ($subheader, $quess) = split(/:/,$sub); - if ($subheader ne "") { - $out .= "
      $subheader:\n"; - } - my @ques = split(/\,/,$quess); - foreach my $quesid (@ques) { - $out .= $outary[$quesid]; - } - } - } - print $out; - } - } else { - for (1 .. $#outary) { - print $outary[$_]; - } - } - - print "
      \n"; - print "
      \n"; - #print "
      ".Dumper(\@questions,\@comments)."
      \n"; - print "
      ".HTMLFooter(); -} - -sub print_test_chooser { - my @trecs = @_; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) = split(/&/, $trecs[$_]); - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - $tstoption =" - $id - $desc - $testscompleted - $testsinprogress - $testspending - \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - print HTMLHeader("Integro Learning Custom Reports", $js); - print "
      Please choose the survey for which you would like reports:
      -
      - - - -
      - - - - - - - - - - - $tstoptions - -

      Test IDDescriptionCmpInPPnd


      -"; - print HTMLFooter(); - exit(); -} diff --git a/survey-nginx/cgi-bin/LikertData.pl.bu20100506 b/survey-nginx/cgi-bin/LikertData.pl.bu20100506 deleted file mode 100755 index e0a00ef29..000000000 --- a/survey-nginx/cgi-bin/LikertData.pl.bu20100506 +++ /dev/null @@ -1,449 +0,0 @@ -#!/usr/bin/perl - -# Source - LikertData.pl - -# Svn Keywords -# $Date$ -# $Revision$ -# $Author$ -# $HeadURL$ -# $Id$ - -use FileHandle; -use Time::Local; -use Data::Dumper; - -require 'questionslib.pl'; -require Exporter; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); -@ISA = qw(Exporter); -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. -@EXPORT = qw(GetLikertData); -@EXPORT_OK = qw(); -$VERSION = '0.01'; - -sub GetLikertData { -# Parameters -# $client - required String, client id. -# $testid - required String, test id. -# $idlist - optional Hash reference, keys are candidate ids, values are true for desired candidates. -# Returned value. -# $ret - reference to a Hash of a Hash. The keys of the first hash are the supercategories -# of the likert questions in the test. The keys of the second hash are 'PointsAvail', -# 'Responses', 'NoResponses', 'PointsEarned', and 'ScoreCount'. The values of the first -# four keys are numeric counts, or score totals. The value of the 'ScoreCount' is -# another hash. Its keys are the scores, and the values are the counts of the number -# of times each score was a response. - my ($client, $testid, $idlist) = @_ ; - my $ret = {} ; - my %supercat_found = () ; # hash of categories found and initialized in the hash of hashes. - &get_test_profile($client, $testid) ; # Populates %TEST - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - unless (defined $idlist) { - # warn "In GetLikertData and idlist is undefined." ; - } - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; # Strip the test id off the end of the file name. - $user =~ s/^$client.//; # Strip the client id off the start of the file name. - if (defined $idlist and %{$idlist} and not $idlist->{$user}) { - # warn "Skipped completed test for $user ." ; - # warn "Reference " . ref $idlist . " value." ; - next; - } - my $inact_ques = 0 ; # This is an offset for the inactive questions. - # The inactive questions are still listed, but without an answer. - # warn "Process completed test for $user ." ; - # Process this desired candidate's test answers. - &get_test_sequence_for_reports($client, $user, $testid) ; - # populates the Assoc. arrays %TEST_SESSION, %SUBTEST_QUESTIONS, - # %SUBTEST_ANSWERS, %SUBTEST_RESPONSES, and %SUBTEST_SUMMARY. - my $QUESTIONS_AH = get_question_definitions ($CLIENT{'clid'}, $FORM{'tstid'}); - # Populates an array of hashs that contains all of the questions and the answers. - # $QUESTIONS_AH is a reference to the arrays of hashs. - my $last_index = $#{$QUESTIONS_AH} ; # Last index of the Array of Hashs of the Q&A. - my $points, $weight, @scores, @correct_ans, @incorrect_ans, @all_ans ; - my $ques_type, $supercat, $scores, @responses, $responses ; - $responses = $SUBTEST_RESPONSES{2} ; - # warn "user $user testid $testid resp $responses .\n" ; - @responses = split (/\&/, $responses) ; - shift @responses ; # Drop the empty element in front of the list. - foreach $index1 (0 .. $last_index) { - # Skip the question if it is inactive. - if (${$QUESTIONS_AH}[$index1]->{'qil'} eq "Y") {$inact_ques++ ; next ;} - # Get the data for a single question. - $points = ${$QUESTIONS_AH}[$index1]->{'pts'} ; - $weight = ${$QUESTIONS_AH}[$index1]->{'wght'} ; - $ques_type = ${$QUESTIONS_AH}[$index1]->{'qtp'} ; - $scores = ${$QUESTIONS_AH}[$index1]->{'scores'} ; - unless ($ques_type eq "lik") {next ;} - @scores = split (/\,/ , $scores) ; - $supercat = ${$QUESTIONS_AH}[$index1]->{'supercat'} ; - unless ($supercat_found{$supercat}) { - # Initialize counters. - $ret->{$supercat}->{'PointsAvail'} = 0 ; - $ret->{$supercat}->{'NoResponses'} = 0 ; - $ret->{$supercat}->{'Responses'} = 0 ; - $ret->{$supercat}->{'PointsEarned'} = 0 ; - $ret->{$supercat}->{'ScoreCount'} = {} ; - $supercat_found{$supercat} = 1 ; - } - $responses = $responses[$index1-$inact_ques] ; - @individ = split(/\?/, $responses) ; - shift @individ ; - # warn "2user $user testid $testid resp $responses index1 $index1 prev $responses[$index1-1] next $responses[$index1+1] .\n" ; - my $no_response = 1 ; - $ret->{$supercat}->{'PointsAvail'} += $points ; - foreach $index2 (0 .. $#scores) { - # Add the key for the score count to the hash. - unless (exists $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - } - foreach $index2 (0 .. $#scores) { - # warn "index2 $index2 individ $individ[$index2] .\n" ; - if ($individ[$index2] ne "xxx" and $individ[$index2] ne "" and $individ[$index2] == $index2) { - # Answered this question. - $ret->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - # warn "Likert Answer supercat $supercat index2 $index2 scores $scores[$index2] \n" ; - $no_response = 0 ; - } # If answered. - } # foreach $index2 - if ($no_response) { - # Add to the no response count. - $ret->{$supercat}->{'NoResponses'} ++ ; - # warn "Likert Answer supercat $supercat No Response \n" ; - } else { - # Add to the response count. - $ret->{$supercat}->{'Responses'} ++ ; - # warn "Likert Answer supercat $supercat Response \n" ; - } - } # foreach question. - } # foreach file (i.e. candidate) - $ret ; # Return reference. -} # End of GetLikertData - -sub GetLikertGrpData { -# Parameters -# $client - required String, client id. -# $testid - required String, test id. -# $idlist - required Hash reference, keys are candidate ids, values are group id for desired candidates. -# Returned values - $ret_all, $ret_grp -# $ret_all - reference to a Hash of a Hash. The keys of the first hash are the supercategories -# of the likert questions in the test. The keys of the second hash are 'PointsAvail', -# 'Responses', 'NoResponses', 'PointsEarned', and 'ScoreCount'. The values of the first -# four keys are numeric counts, or score totals. The value of the 'ScoreCount' is -# another hash. Its keys are the scores, and the values are the counts of the number -# of times each score was a response. Values for candidates will be counted here regardless of -# group membership. -# $ret_grp - reference to a Hash of a Hash of a Hash. The keys of the first hash are -# the group ids. The values are structured like $ret_all. - my ($client, $testid, $idlist) = @_ ; - my $ret_all = {} ; my $ret_grp = {} ; - my %supercat_found = () ; # hash of categories found and initialized in the hash of hashes. - my $inact_ques = 0; # Count of the inactive questions found. - &get_test_profile($client, $testid) ; # Populates %TEST - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - unless (defined $idlist ) { - warn "In GetLikertData and idlist is undefined." ; - } - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; # Strip the test id off the end of the file name. - $user =~ s/^$client.//; # Strip the client id off the start of the file name. - my $user_grp = undef ; - # Process this desired candidate's test answers. - &get_test_sequence_for_reports($client, $user, $testid) ; - # populates the Assoc. arrays %TEST_SESSION, %SUBTEST_QUESTIONS, - # %SUBTEST_ANSWERS, %SUBTEST_RESPONSES, and %SUBTEST_SUMMARY. - my $QUESTIONS_AH = get_question_definitions ($CLIENT{'clid'}, $FORM{'tstid'}); - # Populates an array of hashs that contains all of the questions and the answers. - # $QUESTIONS_AH is a reference to the arrays of hashs. - my $last_index = $#{$QUESTIONS_AH} ; # Last index of the Array of Hashs of the Q&A. - my $points, $weight, @scores, @correct_ans, @incorrect_ans, @all_ans ; - my $ques_type, $supercat, $scores, @responses, $responses ; - $responses = $SUBTEST_RESPONSES{2} ; - @responses = split (/\&/, $responses) ; - shift @responses ; # Drop the empty element in front of the list. - foreach $index1 (0 .. $last_index) { - # Skip the question if it is inactive. - if (${$QUESTIONS_AH}[$index1]->{'qil'} eq "Y") {$inact_ques++ ; next ;} - # Get the data for a single question. - $points = ${$QUESTIONS_AH}[$index1]->{'pts'} ; - $weight = ${$QUESTIONS_AH}[$index1]->{'wght'} ; - $ques_type = ${$QUESTIONS_AH}[$index1]->{'qtp'} ; - $scores = ${$QUESTIONS_AH}[$index1]->{'scores'} ; - unless ($ques_type eq "lik") {next ;} - @scores = split (/\,/ , $scores) ; - $supercat = ${$QUESTIONS_AH}[$index1]->{'supercat'} ; - unless ($supercat_found{$supercat}) { - # Initialize counters. - # warn "Init all Cat $supercat" if $supercat eq "Employee Passion" ; - $ret->{$supercat}->{'PointsAvail'} = 0 ; - $ret->{$supercat}->{'NoResponses'} = 0 ; - $ret->{$supercat}->{'Responses'} = 0 ; - $ret->{$supercat}->{'PointsEarned'} = 0 ; - $ret->{$supercat}->{'ScoreCount'} = {} ; - $supercat_found{$supercat} = 1 ; - } - if (defined $idlist and %{$idlist} and $idlist->{$user}) { - unless (defined $ret_grp->{$idlist->{$user}}->{$supercat}) { - # warn "Init grp Cat $supercat user $user Grp $idlist->{$user}" if $supercat eq "Employee Passion" ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsAvail'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'NoResponses'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'Responses'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsEarned'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'} = {} ; - } - } - $responses = $responses[$index1-$inact_ques] ; - @individ = split(/\?/, $responses) ; - shift @individ ; - my $no_response = 1 ; - $ret->{$supercat}->{'PointsAvail'} += $points ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsAvail'} += $points ; - # warn "ADD USER $user GRP $idlist->{$user} PNTS $points TOT $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsAvail'}" if $supercat eq "Employee Passion" ; - foreach $index2 (0 .. $#scores) { - # Add the key for the score count to the hash. - unless (exists $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - unless (exists $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - } - # warn "CHECKING CAT $supercat USER $user GRP $idlist->{$user}" if $supercat eq "Employee Passion" ; - foreach $index2 (0 .. $#scores) { - if ($individ[$index2] ne "xxx" and $individ[$index2] ne "" and $individ[$index2] == $index2) { - # Answered this question. - # warn "Scored CAT $supercat POINTS $scores[$index2] USER $user GRP $idlist->{$user}" if $supercat eq "Employee Passion" ; - $ret->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - $no_response = 0 ; - } # If answered. - } # foreach $index2 - if ($no_response) { - # Add to the no response count. - $ret->{$supercat}->{'NoResponses'} ++ ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'NoResponses'} ++ ; - } else { - # Add to the response count. - $ret->{$supercat}->{'Responses'} ++ ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'Responses'} ++ ; - } - } # foreach question. - } # foreach file (i.e. candidate) - return ($ret, $ret_grp) ; # Return reference. -} # End of GetLikertGrpData - -sub GetFullLikertGrpData { -# Parameters -# $client - required String, client id. -# $testid - required String, test id. -# $grplist - optional Hash reference, keys are group ids, values are like getGroups function. -# if undef. then only one returned value. -# $grp_req - optional boolean, default is false. If true, then $ret_all only includes results -# for users in the $grplist, and $grplist must be provided to get any results. - -# Returned values - $ret_all, $ret_grp -# $ret_all - reference to a Hash of a Hash. The keys of the first hash are the supercategories -# of the likert questions in the test. The keys of the second hash are 'PointsAvail', -# 'Responses', 'NoResponses', 'PointsEarned', 'ScoreCount', and 'Questions'. The values of the first -# four keys are numeric counts, or score totals. The value of the 'ScoreCount' is -# another hash. Its keys are the scores, and the values are the counts of the number -# of times each score was a response. Values for candidates will be counted here regardless of -# group membership. The value of 'Questions' is an un-named hash. The keys of the un-named -# hash are the question numbers for the supercategory. The value is always 1. -# $ret_grp - reference to a Hash of a Hash of a Hash. The keys of the first hash are -# the group ids. The values are structured like $ret_all. This is not returned if -# the parameter $grplist is not provided, or undef. - - my ($client, $testid, $grplist,$grp_req) = @_ ; - # warn "grplist" ; - # warn &Dumper(\$grplist) ; - # warn "grp_req $grp_req X\n" ; - my $ret_all = {} ; my $ret_grp = {} ; - my %Group_Xref = () ; # List of groups that each member belongs to. - # The hash key is a member id, the value is an array of the groups he is in. - # Build the cross reference. - my $Group = "" ; my $Member = "" ; - foreach $Group (keys %{${grplist}}) { - foreach $Member (@{${grplist}->{$Group}->{'grplist'}}) { - push @{$Group_Xref->{$Member}} , $Group ; - } - } - # warn Dumper(\%Group_Xref) ; - my %supercat_found = () ; # hash of categories found and initialized in the hash of hashes. - &get_test_profile($client, $testid) ; # Populates %TEST - my $QUESTIONS_AH = get_question_definitions ($CLIENT{'clid'}, $FORM{'tstid'}); - # Populates an array of hashs that contains all of the questions and the answers. - # $QUESTIONS_AH is a reference to the arrays of hashs. - my $last_index = $#{$QUESTIONS_AH} ; # Last index of the Array of Hashs of the Q&A. - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; # Strip the test id off the end of the file name. - $user =~ s/^$client.//; # Strip the client id off the start of the file name. - my $user_grp = undef ; - my $inact_ques = 0; # Count of the inactive questions found. - # Do not process this user if group membership is required and not a member. - if ($grp_req and not $Group_Xref->{$user}) { - # warn "Skipped User $user X" ; - next ; - } - # Process this desired candidate's test answers. - # warn "Process User $user X" ; - &get_test_sequence_for_reports($client, $user, $testid) ; - # populates the Assoc. arrays %TEST_SESSION, %SUBTEST_QUESTIONS, - # %SUBTEST_ANSWERS, %SUBTEST_RESPONSES, and %SUBTEST_SUMMARY. - my $points, $weight, @scores, @correct_ans, @incorrect_ans, @all_ans ; - my $ques_type, $supercat, $scores, @responses, $responses ; - $responses = $SUBTEST_RESPONSES{2} ; - @responses = split (/\&/, $responses) ; - shift @responses ; # Drop the empty element in front of the list. - foreach $index1 (0 .. $last_index) { - # Skip the question if it is inactive. - if (${$QUESTIONS_AH}[$index1]->{'qil'} eq "Y") {$inact_ques++ ; next ;} - # Get the data for a single question. - $points = ${$QUESTIONS_AH}[$index1]->{'pts'} ; - $weight = ${$QUESTIONS_AH}[$index1]->{'wght'} ; - $ques_type = ${$QUESTIONS_AH}[$index1]->{'qtp'} ; - $scores = ${$QUESTIONS_AH}[$index1]->{'scores'} ; - unless ($ques_type eq "lik") {next ;} - @scores = split (/\,/ , $scores) ; - $supercat = ${$QUESTIONS_AH}[$index1]->{'supercat'} ; - unless ($supercat_found{$supercat}) { - # Initialize counters. - # warn "Init all Cat $supercat" if $supercat eq "Employee Passion" ; - $ret->{$supercat}->{'PointsAvail'} = 0 ; - $ret->{$supercat}->{'NoResponses'} = 0 ; - $ret->{$supercat}->{'Responses'} = 0 ; - $ret->{$supercat}->{'PointsEarned'} = 0 ; - $ret->{$supercat}->{'ScoreCount'} = {} ; - $ret->{$supercat}->{'Questions'}->{$index1-$inact_ques} = 1 ; - $supercat_found{$supercat} = 1 ; - } - my @Groups = @{$Group_Xref->{$user}} ; - foreach $group (@Groups) { - unless (defined $ret_grp->{$group}->{$supercat}) { - # warn "Init all Cat $supercat Group $group.\n" if $supercat eq "Improvement" ; - $ret_grp->{$group}->{$supercat}->{'PointsAvail'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'NoResponses'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'Responses'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'PointsEarned'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'ScoreCount'} = {} ; - } - } # foreach $group - $responses = $responses[$index1-$inact_ques] ; - @individ = split(/\?/, $responses) ; - shift @individ ; - my $no_response = 1 ; - $ret->{$supercat}->{'PointsAvail'} += $points ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'PointsAvail'} += $points ; - } - foreach $index2 (0 .. $#scores) { - # Add the key for the score count to the hash. - unless (exists $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - unless (exists $ret_grp->{$group}->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret_grp->{$group}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - } - # warn "CHECKING CAT $supercat USER $user GRP @group RESP $responses \n" if $supercat eq "Improvement" ; - foreach $index2 (0 .. $#scores) { - if ($individ[$index2] ne "xxx" and $individ[$index2] ne "" and $individ[$index2] == $index2) { - # Answered this question. - # warn "Scored CAT $supercat POINTS $scores[$index2] USER $user GRP @group \n" if $supercat eq "Improvement" ; - $ret->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret_grp->{$group}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - } - $no_response = 0 ; - } # If answered. - } # foreach $index2 - if ($no_response) { - # Add to the no response count. - $ret->{$supercat}->{'NoResponses'} ++ ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'NoResponses'} ++ ; - } - } else { - # Add to the response count. - $ret->{$supercat}->{'Responses'} ++ ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'Responses'} ++ ; - } - } - } # foreach question. - } # foreach file (i.e. candidate) - return ($ret, $ret_grp) ; # Return reference. -} # End of GetFullLikertGrpData - -sub BuildBarGraph { -# This subroutine builds the HTML to get an image from an URL. -# The URL is a cgi-bin PERL script, with several parameters. -# The list parameters are: labels, values, and values2. -# The scalar parameters are: xdim, ydim, hbar, title, xlabel, ylabel, ymax, ymin, yticknum, colorscheme, $t_margin, $b_margin, $l_margin, $r_margin - -# The first 3 parameters are references to three lists, which are mandatory. -# The values2 list may be an empty list. (and ignored.) -# The rest of the parameters are optional, but are order specific. -# Any parameter that is an empty string will be effectively ignored, -# but may be required to fill the list of parameters to a needed parm. - my @label_names, @value_points, @value2_points ; - my $labels_ref, $values_ref, $values2_ref ; - my $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum ; - my $colorscheme ; - my $t_margin, $b_margin, $l_margin, $r_margin ; - $labels_ref = $_[0] ; - @label_names = @{$labels_ref} ; -# @label_names is an array of character strings of the names of the bars on the graph. - $values_ref = $_[1] ; - @value_points = @{$values_ref} ; -# @value_points is an array of numeric values for each of the names in the first array. -# The sizes of the two arrays should be the same. - $values2_ref = $_[2] ; - @value2_points = @{$values2_ref} ; - shift ; shift ; shift ; # Remove the first 3 parms, to set up the next statement. - ($xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, $colorscheme, $t_margin, $b_margin, $l_margin, $r_margin) = @_ ; - my $labels, $values, $values2 ; - # print '
      label_names ' . "@label_names" . '
      ' ; - # print '
      value_points ' . "@value_points" . '
      ' ; - if ($#label_names != $#value_points) { - print '
      ERROR BuildBarGraph has different number of labels and data values.
      ' ; - } - $labels = join (":", map {munge($_)} @label_names ) ; - $values = join (":", map {munge($_)} @value_points ) ; - $values2 = join (":", map {munge($_)} @value2_points ) ; - # my $baseurl = "/cgi-bin/bargraph.pl?labels=$labels&title=Trust%20Level&ylabel=Respondents"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=$labels&values=$values" ; - if ($xdim or $xdim == 0) { $baseurl .= "&xdim=" . $xdim ; } - if ($ydim or $ydim == 0) { $baseurl .= "&ydim=" . $ydim ; } - if ($hbar or $hbar == 0) { $baseurl .= "&hbar=" . $hbar ; } - if ($title or $title == 0) { $baseurl .= "&title=" . munge( $title) ; } - if ($xlabel or $xlabel == 0) { $baseurl .= "&xlabel=" . munge( $xlabel) ; } - if ($ylabel or $ylabel == 0) { $baseurl .= "&ylabel=" . munge( $ylabel) ; } - if ($ymax or $ymax == 0) { $baseurl .= "&ymax=" . $ymax ; } - if ($ymin or $ymin == 0) { $baseurl .= "&ymin=" . $ymin ; } - if ($t_margin or $t_margin == 0) { $baseurl .= "&t_margin=" . $t_margin ; } - if ($b_margin or $b_margin == 0) { $baseurl .= "&b_margin=" . $b_margin ; } - if ($l_margin or $l_margin == 0) { $baseurl .= "&l_margin=" . $l_margin ; } - if ($r_margin or $r_margin == 0) { $baseurl .= "&r_margin=" . $r_margin ; } - if ($colorscheme) { $baseurl .= "&colorscheme=" . $colorscheme ; } - if ($yticknum or $yticknum == 0) { $baseurl .= "&yticknum=" . $yticknum ; } - return ""; -} - - - -1 ; # End of Perl Library file - diff --git a/survey-nginx/cgi-bin/LikertData.pl.bu20131217 b/survey-nginx/cgi-bin/LikertData.pl.bu20131217 deleted file mode 100755 index 5a5c7ac1c..000000000 --- a/survey-nginx/cgi-bin/LikertData.pl.bu20131217 +++ /dev/null @@ -1,449 +0,0 @@ -#!/usr/bin/perl - -# Source - LikertData.pl - -# Svn Keywords -# $Date$ -# $Revision$ -# $Author$ -# $HeadURL$ -# $Id$ - -use FileHandle; -use Time::Local; -use Data::Dumper; - -require 'questionslib.pl'; -require Exporter; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); -@ISA = qw(Exporter); -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. -@EXPORT = qw(GetLikertData); -@EXPORT_OK = qw(); -$VERSION = '0.01'; - -sub GetLikertData { -# Parameters -# $client - required String, client id. -# $testid - required String, test id. -# $idlist - optional Hash reference, keys are candidate ids, values are true for desired candidates. -# Returned value. -# $ret - reference to a Hash of a Hash. The keys of the first hash are the supercategories -# of the likert questions in the test. The keys of the second hash are 'PointsAvail', -# 'Responses', 'NoResponses', 'PointsEarned', and 'ScoreCount'. The values of the first -# four keys are numeric counts, or score totals. The value of the 'ScoreCount' is -# another hash. Its keys are the scores, and the values are the counts of the number -# of times each score was a response. - my ($client, $testid, $idlist) = @_ ; - my $ret = {} ; - my %supercat_found = () ; # hash of categories found and initialized in the hash of hashes. - &get_test_profile($client, $testid) ; # Populates %TEST - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - unless (defined $idlist) { - # warn "In GetLikertData and idlist is undefined." ; - } - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; # Strip the test id off the end of the file name. - $user =~ s/^$client.//; # Strip the client id off the start of the file name. - if (defined $idlist and %{$idlist} and not $idlist->{$user}) { - # warn "Skipped completed test for $user ." ; - # warn "Reference " . ref $idlist . " value." ; - next; - } - my $inact_ques = 0 ; # This is an offset for the inactive questions. - # The inactive questions are still listed, but without an answer. - # warn "Process completed test for $user ." ; - # Process this desired candidate's test answers. - &get_test_sequence_for_reports($client, $user, $testid) ; - # populates the Assoc. arrays %TEST_SESSION, %SUBTEST_QUESTIONS, - # %SUBTEST_ANSWERS, %SUBTEST_RESPONSES, and %SUBTEST_SUMMARY. - my $QUESTIONS_AH = get_question_definitions ($CLIENT{'clid'}, $FORM{'tstid'}); - # Populates an array of hashs that contains all of the questions and the answers. - # $QUESTIONS_AH is a reference to the arrays of hashs. - my $last_index = $#{$QUESTIONS_AH} ; # Last index of the Array of Hashs of the Q&A. - my $points, $weight, @scores, @correct_ans, @incorrect_ans, @all_ans ; - my $ques_type, $supercat, $scores, @responses, $responses ; - $responses = $SUBTEST_RESPONSES{2} ; - # warn "user $user testid $testid resp $responses .\n" ; - @responses = split (/\&/, $responses) ; - shift @responses ; # Drop the empty element in front of the list. - foreach $index1 (0 .. $last_index) { - # Skip the question if it is inactive. - if (${$QUESTIONS_AH}[$index1]->{'qil'} eq "Y") {$inact_ques++ ; next ;} - # Get the data for a single question. - $points = ${$QUESTIONS_AH}[$index1]->{'pts'} ; - $weight = ${$QUESTIONS_AH}[$index1]->{'wght'} ; - $ques_type = ${$QUESTIONS_AH}[$index1]->{'qtp'} ; - $scores = ${$QUESTIONS_AH}[$index1]->{'scores'} ; - unless ($ques_type eq "lik") {next ;} - @scores = split (/\,/ , $scores) ; - $supercat = ${$QUESTIONS_AH}[$index1]->{'supercat'} ; - unless ($supercat_found{$supercat}) { - # Initialize counters. - $ret->{$supercat}->{'PointsAvail'} = 0 ; - $ret->{$supercat}->{'NoResponses'} = 0 ; - $ret->{$supercat}->{'Responses'} = 0 ; - $ret->{$supercat}->{'PointsEarned'} = 0 ; - $ret->{$supercat}->{'ScoreCount'} = {} ; - $supercat_found{$supercat} = 1 ; - } - $responses = $responses[$index1-$inact_ques] ; - @individ = split(/\?/, $responses) ; - shift @individ ; - # warn "2user $user testid $testid resp $responses index1 $index1 prev $responses[$index1-1] next $responses[$index1+1] .\n" ; - my $no_response = 1 ; - $ret->{$supercat}->{'PointsAvail'} += $points ; - foreach $index2 (0 .. $#scores) { - # Add the key for the score count to the hash. - unless (exists $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - } - foreach $index2 (0 .. $#scores) { - # warn "index2 $index2 individ $individ[$index2] .\n" ; - if ($individ[$index2] ne "xxx" and $individ[$index2] ne "" and $individ[$index2] == $index2) { - # Answered this question. - $ret->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - # warn "Likert Answer supercat $supercat index2 $index2 scores $scores[$index2] \n" ; - $no_response = 0 ; - } # If answered. - } # foreach $index2 - if ($no_response) { - # Add to the no response count. - $ret->{$supercat}->{'NoResponses'} ++ ; - # warn "Likert Answer supercat $supercat No Response \n" ; - } else { - # Add to the response count. - $ret->{$supercat}->{'Responses'} ++ ; - # warn "Likert Answer supercat $supercat Response \n" ; - } - } # foreach question. - } # foreach file (i.e. candidate) - $ret ; # Return reference. -} # End of GetLikertData - -sub GetLikertGrpData { -# Parameters -# $client - required String, client id. -# $testid - required String, test id. -# $idlist - required Hash reference, keys are candidate ids, values are group id for desired candidates. -# Returned values - $ret_all, $ret_grp -# $ret_all - reference to a Hash of a Hash. The keys of the first hash are the supercategories -# of the likert questions in the test. The keys of the second hash are 'PointsAvail', -# 'Responses', 'NoResponses', 'PointsEarned', and 'ScoreCount'. The values of the first -# four keys are numeric counts, or score totals. The value of the 'ScoreCount' is -# another hash. Its keys are the scores, and the values are the counts of the number -# of times each score was a response. Values for candidates will be counted here regardless of -# group membership. -# $ret_grp - reference to a Hash of a Hash of a Hash. The keys of the first hash are -# the group ids. The values are structured like $ret_all. - my ($client, $testid, $idlist) = @_ ; - my $ret_all = {} ; my $ret_grp = {} ; - my %supercat_found = () ; # hash of categories found and initialized in the hash of hashes. - my $inact_ques = 0; # Count of the inactive questions found. - &get_test_profile($client, $testid) ; # Populates %TEST - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - unless (defined $idlist ) { - warn "In GetLikertData and idlist is undefined." ; - } - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; # Strip the test id off the end of the file name. - $user =~ s/^$client.//; # Strip the client id off the start of the file name. - my $user_grp = undef ; - # Process this desired candidate's test answers. - &get_test_sequence_for_reports($client, $user, $testid) ; - # populates the Assoc. arrays %TEST_SESSION, %SUBTEST_QUESTIONS, - # %SUBTEST_ANSWERS, %SUBTEST_RESPONSES, and %SUBTEST_SUMMARY. - my $QUESTIONS_AH = get_question_definitions ($CLIENT{'clid'}, $FORM{'tstid'}); - # Populates an array of hashs that contains all of the questions and the answers. - # $QUESTIONS_AH is a reference to the arrays of hashs. - my $last_index = $#{$QUESTIONS_AH} ; # Last index of the Array of Hashs of the Q&A. - my $points, $weight, @scores, @correct_ans, @incorrect_ans, @all_ans ; - my $ques_type, $supercat, $scores, @responses, $responses ; - $responses = $SUBTEST_RESPONSES{2} ; - @responses = split (/\&/, $responses) ; - shift @responses ; # Drop the empty element in front of the list. - foreach $index1 (0 .. $last_index) { - # Skip the question if it is inactive. - if (${$QUESTIONS_AH}[$index1]->{'qil'} eq "Y") {$inact_ques++ ; next ;} - # Get the data for a single question. - $points = ${$QUESTIONS_AH}[$index1]->{'pts'} ; - $weight = ${$QUESTIONS_AH}[$index1]->{'wght'} ; - $ques_type = ${$QUESTIONS_AH}[$index1]->{'qtp'} ; - $scores = ${$QUESTIONS_AH}[$index1]->{'scores'} ; - unless ($ques_type eq "lik") {next ;} - @scores = split (/\,/ , $scores) ; - $supercat = ${$QUESTIONS_AH}[$index1]->{'supercat'} ; - unless ($supercat_found{$supercat}) { - # Initialize counters. - # warn "Init all Cat $supercat" if $supercat eq "Employee Passion" ; - $ret->{$supercat}->{'PointsAvail'} = 0 ; - $ret->{$supercat}->{'NoResponses'} = 0 ; - $ret->{$supercat}->{'Responses'} = 0 ; - $ret->{$supercat}->{'PointsEarned'} = 0 ; - $ret->{$supercat}->{'ScoreCount'} = {} ; - $supercat_found{$supercat} = 1 ; - } - if (defined $idlist and %{$idlist} and $idlist->{$user}) { - unless (defined $ret_grp->{$idlist->{$user}}->{$supercat}) { - # warn "Init grp Cat $supercat user $user Grp $idlist->{$user}" if $supercat eq "Employee Passion" ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsAvail'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'NoResponses'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'Responses'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsEarned'} = 0 ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'} = {} ; - } - } - $responses = $responses[$index1-$inact_ques] ; - @individ = split(/\?/, $responses) ; - shift @individ ; - my $no_response = 1 ; - $ret->{$supercat}->{'PointsAvail'} += $points ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsAvail'} += $points ; - # warn "ADD USER $user GRP $idlist->{$user} PNTS $points TOT $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsAvail'}" if $supercat eq "Employee Passion" ; - foreach $index2 (0 .. $#scores) { - # Add the key for the score count to the hash. - unless (exists $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - unless (exists $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - } - # warn "CHECKING CAT $supercat USER $user GRP $idlist->{$user}" if $supercat eq "Employee Passion" ; - foreach $index2 (0 .. $#scores) { - if ($individ[$index2] ne "xxx" and $individ[$index2] ne "" and $individ[$index2] == $index2) { - # Answered this question. - # warn "Scored CAT $supercat POINTS $scores[$index2] USER $user GRP $idlist->{$user}" if $supercat eq "Employee Passion" ; - $ret->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - $no_response = 0 ; - } # If answered. - } # foreach $index2 - if ($no_response) { - # Add to the no response count. - $ret->{$supercat}->{'NoResponses'} ++ ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'NoResponses'} ++ ; - } else { - # Add to the response count. - $ret->{$supercat}->{'Responses'} ++ ; - $ret_grp->{$idlist->{$user}}->{$supercat}->{'Responses'} ++ ; - } - } # foreach question. - } # foreach file (i.e. candidate) - return ($ret, $ret_grp) ; # Return reference. -} # End of GetLikertGrpData - -sub GetFullLikertGrpData { -# Parameters -# $client - required String, client id. -# $testid - required String, test id. -# $grplist - optional Hash reference, keys are group ids, values are like getGroups function. -# if undef. then only one returned value. -# $grp_req - optional boolean, default is false. If true, then $ret_all only includes results -# for users in the $grplist, and $grplist must be provided to get any results. - -# Returned values - $ret_all, $ret_grp -# $ret_all - reference to a Hash of a Hash. The keys of the first hash are the supercategories -# of the likert questions in the test. The keys of the second hash are 'PointsAvail', -# 'Responses', 'NoResponses', 'PointsEarned', 'ScoreCount', and 'Questions'. The values of the first -# four keys are numeric counts, or score totals. The value of the 'ScoreCount' is -# another hash. Its keys are the scores, and the values are the counts of the number -# of times each score was a response. Values for candidates will be counted here regardless of -# group membership. The value of 'Questions' is an un-named hash. The keys of the un-named -# hash are the question numbers for the supercategory. The value is always 1. -# $ret_grp - reference to a Hash of a Hash of a Hash. The keys of the first hash are -# the group ids. The values are structured like $ret_all. This is not returned if -# the parameter $grplist is not provided, or undef. - - my ($client, $testid, $grplist,$grp_req) = @_ ; - # warn "grplist" ; - # warn &Dumper(\$grplist) ; - # warn "grp_req $grp_req X\n" ; - my $ret_all = {} ; my $ret_grp = {} ; - my %Group_Xref = () ; # List of groups that each member belongs to. - # The hash key is a member id, the value is an array of the groups he is in. - # Build the cross reference. - my $Group = "" ; my $Member = "" ; - foreach $Group (keys %{${grplist}}) { - foreach $Member (@{${grplist}->{$Group}->{'grplist'}}) { - push @{$Group_Xref->{$Member}} , $Group ; - } - } - # warn Dumper(\%Group_Xref) ; - my %supercat_found = () ; # hash of categories found and initialized in the hash of hashes. - &get_test_profile($client, $testid) ; # Populates %TEST - my $QUESTIONS_AH = get_question_definitions ($CLIENT{'clid'}, $FORM{'tstid'}); - # Populates an array of hashs that contains all of the questions and the answers. - # $QUESTIONS_AH is a reference to the arrays of hashs. - my $last_index = $#{$QUESTIONS_AH} ; # Last index of the Array of Hashs of the Q&A. - my @filelist = &main::get_test_result_files($main::testcomplete, $client,$testid); - foreach my $file (@filelist) { - my $user = $file; - $user =~ s/.$testid$//; # Strip the test id off the end of the file name. - $user =~ s/^$client.//; # Strip the client id off the start of the file name. - my $user_grp = undef ; - my $inact_ques = 0; # Count of the inactive questions found. - # Do not process this user if group membership is required and not a member. - if ($grp_req and not $Group_Xref->{$user}) { - # warn "Skipped User $user X" ; - next ; - } - # Process this desired candidate's test answers. - # warn "Process User $user X" ; - &get_test_sequence_for_reports($client, $user, $testid) ; - # populates the Assoc. arrays %TEST_SESSION, %SUBTEST_QUESTIONS, - # %SUBTEST_ANSWERS, %SUBTEST_RESPONSES, and %SUBTEST_SUMMARY. - my $points, $weight, @scores, @correct_ans, @incorrect_ans, @all_ans ; - my $ques_type, $supercat, $scores, @responses, $responses ; - $responses = $SUBTEST_RESPONSES{2} ; - @responses = split (/\&/, $responses) ; - shift @responses ; # Drop the empty element in front of the list. - foreach $index1 (0 .. $last_index) { - # Skip the question if it is inactive. - if (${$QUESTIONS_AH}[$index1]->{'qil'} eq "Y") {$inact_ques++ ; next ;} - # Get the data for a single question. - $points = ${$QUESTIONS_AH}[$index1]->{'pts'} ; - $weight = ${$QUESTIONS_AH}[$index1]->{'wght'} ; - $ques_type = ${$QUESTIONS_AH}[$index1]->{'qtp'} ; - $scores = ${$QUESTIONS_AH}[$index1]->{'scores'} ; - unless ($ques_type eq "lik") {next ;} - @scores = split (/\,/ , $scores) ; - $supercat = ${$QUESTIONS_AH}[$index1]->{'supercat'} ; - unless ($supercat_found{$supercat}) { - # Initialize counters. - # warn "Init all Cat $supercat" if $supercat eq "Employee Passion" ; - $ret->{$supercat}->{'PointsAvail'} = 0 ; - $ret->{$supercat}->{'NoResponses'} = 0 ; - $ret->{$supercat}->{'Responses'} = 0 ; - $ret->{$supercat}->{'PointsEarned'} = 0 ; - $ret->{$supercat}->{'ScoreCount'} = {} ; - $supercat_found{$supercat} = 1 ; - } - $ret->{$supercat}->{'Questions'}->{$index1-$inact_ques} = 1 ; - my @Groups = @{$Group_Xref->{$user}} ; - foreach $group (@Groups) { - unless (defined $ret_grp->{$group}->{$supercat}) { - # warn "Init all Cat $supercat Group $group.\n" if $supercat eq "Improvement" ; - $ret_grp->{$group}->{$supercat}->{'PointsAvail'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'NoResponses'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'Responses'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'PointsEarned'} = 0 ; - $ret_grp->{$group}->{$supercat}->{'ScoreCount'} = {} ; - } - } # foreach $group - $responses = $responses[$index1-$inact_ques] ; - @individ = split(/\?/, $responses) ; - shift @individ ; - my $no_response = 1 ; - $ret->{$supercat}->{'PointsAvail'} += $points ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'PointsAvail'} += $points ; - } - foreach $index2 (0 .. $#scores) { - # Add the key for the score count to the hash. - unless (exists $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - unless (exists $ret_grp->{$group}->{$supercat}->{'ScoreCount'}->{$scores[$index2]}) { - $ret_grp->{$group}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} = 0 ; - } - } - # warn "CHECKING CAT $supercat USER $user GRP @group RESP $responses \n" if $supercat eq "Improvement" ; - foreach $index2 (0 .. $#scores) { - if ($individ[$index2] ne "xxx" and $individ[$index2] ne "" and $individ[$index2] == $index2) { - # Answered this question. - # warn "Scored CAT $supercat POINTS $scores[$index2] USER $user GRP @group \n" if $supercat eq "Improvement" ; - $ret->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'PointsEarned'} += $scores[$index2] ; - $ret_grp->{$group}->{$supercat}->{'ScoreCount'}->{$scores[$index2]} ++ ; - } - $no_response = 0 ; - } # If answered. - } # foreach $index2 - if ($no_response) { - # Add to the no response count. - $ret->{$supercat}->{'NoResponses'} ++ ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'NoResponses'} ++ ; - } - } else { - # Add to the response count. - $ret->{$supercat}->{'Responses'} ++ ; - foreach $group (@Groups) { - $ret_grp->{$group}->{$supercat}->{'Responses'} ++ ; - } - } - } # foreach question. - } # foreach file (i.e. candidate) - return ($ret, $ret_grp) ; # Return reference. -} # End of GetFullLikertGrpData - -sub BuildBarGraph { -# This subroutine builds the HTML to get an image from an URL. -# The URL is a cgi-bin PERL script, with several parameters. -# The list parameters are: labels, values, and values2. -# The scalar parameters are: xdim, ydim, hbar, title, xlabel, ylabel, ymax, ymin, yticknum, colorscheme, $t_margin, $b_margin, $l_margin, $r_margin - -# The first 3 parameters are references to three lists, which are mandatory. -# The values2 list may be an empty list. (and ignored.) -# The rest of the parameters are optional, but are order specific. -# Any parameter that is an empty string will be effectively ignored, -# but may be required to fill the list of parameters to a needed parm. - my @label_names, @value_points, @value2_points ; - my $labels_ref, $values_ref, $values2_ref ; - my $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum ; - my $colorscheme ; - my $t_margin, $b_margin, $l_margin, $r_margin ; - $labels_ref = $_[0] ; - @label_names = @{$labels_ref} ; -# @label_names is an array of character strings of the names of the bars on the graph. - $values_ref = $_[1] ; - @value_points = @{$values_ref} ; -# @value_points is an array of numeric values for each of the names in the first array. -# The sizes of the two arrays should be the same. - $values2_ref = $_[2] ; - @value2_points = @{$values2_ref} ; - shift ; shift ; shift ; # Remove the first 3 parms, to set up the next statement. - ($xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, $colorscheme, $t_margin, $b_margin, $l_margin, $r_margin) = @_ ; - my $labels, $values, $values2 ; - # print '
      label_names ' . "@label_names" . '
      ' ; - # print '
      value_points ' . "@value_points" . '
      ' ; - if ($#label_names != $#value_points) { - print '
      ERROR BuildBarGraph has different number of labels and data values.
      ' ; - } - $labels = join (":", map {munge($_)} @label_names ) ; - $values = join (":", map {munge($_)} @value_points ) ; - $values2 = join (":", map {munge($_)} @value2_points ) ; - # my $baseurl = "/cgi-bin/bargraph.pl?labels=$labels&title=Trust%20Level&ylabel=Respondents"; - my $baseurl = "/cgi-bin/bargraph.pl?labels=$labels&values=$values" ; - if ($xdim or $xdim == 0) { $baseurl .= "&xdim=" . $xdim ; } - if ($ydim or $ydim == 0) { $baseurl .= "&ydim=" . $ydim ; } - if ($hbar or $hbar == 0) { $baseurl .= "&hbar=" . $hbar ; } - if ($title or $title == 0) { $baseurl .= "&title=" . munge( $title) ; } - if ($xlabel or $xlabel == 0) { $baseurl .= "&xlabel=" . munge( $xlabel) ; } - if ($ylabel or $ylabel == 0) { $baseurl .= "&ylabel=" . munge( $ylabel) ; } - if ($ymax or $ymax == 0) { $baseurl .= "&ymax=" . $ymax ; } - if ($ymin or $ymin == 0) { $baseurl .= "&ymin=" . $ymin ; } - if ($t_margin or $t_margin == 0) { $baseurl .= "&t_margin=" . $t_margin ; } - if ($b_margin or $b_margin == 0) { $baseurl .= "&b_margin=" . $b_margin ; } - if ($l_margin or $l_margin == 0) { $baseurl .= "&l_margin=" . $l_margin ; } - if ($r_margin or $r_margin == 0) { $baseurl .= "&r_margin=" . $r_margin ; } - if ($colorscheme) { $baseurl .= "&colorscheme=" . $colorscheme ; } - if ($yticknum or $yticknum == 0) { $baseurl .= "&yticknum=" . $yticknum ; } - return ""; -} - - - -1 ; # End of Perl Library file - diff --git a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100506 b/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100506 deleted file mode 100755 index 39bd8afde..000000000 --- a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100506 +++ /dev/null @@ -1,488 +0,0 @@ -#!/usr/bin/perl -# -# Source File: Likert_Gen_Groups.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' ; -require 'grepa.pm' ; - -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 ); -use vars qw($testinprog $testpending) ; - -# &app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -# print STDERR Dumper(\%FORM); -&get_client_profile($SESSION{'clid'}); -# warn "Tstid $FORM{'tstid'}\n" ; -&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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
      ".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 (defined $timestamp) { - $timestamp = "$timestamp

      \n"; -} else { - $timestamp = "
      \n"; -} - -# Generate the reports -if ($FORM{'reportname'} eq 'LikertWQ') { - &LikertWQ($idlist, $groups, $timestamp); - } elsif ($FORM{'reportname'} eq 'LikertWQG') { - &LikertWQG($idlist, $groups, $timestamp); - } else { - &ReportChooser(); - } - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\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, ACTS Corporation$ionline
      \n\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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - my $organizationname = $CLIENT{'clnmc'}; - my $uberheader; - my $TESTS = get_data_hash ("tests.$CLIENT{'clid'}") ; - # print STDERR Dumper($TESTS) ; - my %TESTS = %$TESTS ; - my @test_list = () ; - my $ids ; - for $ids (keys %TESTS) { - # warn "ID $ids DATADESC $TESTS{$ids}->{'desc'} X" ; - push @test_list, [$TESTS{$ids}->{'desc'}, $ids] ; - } - # warn "test_list count $#test_list X\n" ; - # print STDERR Dumper(\@test_list) ; - my ($js1, $test_choice_html) = ret_test_chooser_mod(@test_list) ; - - #print STDERR get_data("tests.$CLIENT{'clid'}"); - #print STDERR "Test ID = $tstid\n"; - print HTMLHeader("Integro Learning Custom Reports",$js . $js1); - print "
      \n"; - print "\n"; - # For development purposes we hardcode the survey id. - # Fix this before production - # print "\n"; # HBI This had a value of $tstid - 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 $test_choice_html ; - print "

      Likert Scale Report" ; - print "

        " ; - print "
      • Likert Scale - No Response is zero, Question Numbers listed.
      • \n" ; - print "
      • Likert Scale by Group - No Response is zero, Detail by Groups.
      • \n" ; - print "

      \n" ; - print "\n"; - print "\n"; - print "
      "; - print HTMLFooter(); -} - -sub LikertWQ { - # This does the Summary on the Likert Scale questions, - # for everybody, or the Groups selected. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale General Results"); - print "
      " ; - print "Likert Scale General Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - # Print first row. - print "" ; - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - my $supercat ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print "" ; - print "" ; - print "" ; - print "" ; - print &rep_cell_str($earned, $possible) ; - print "\n" ; - } - - # Print Total row. - print "" ; - print "" ; - print "" ; - print &rep_cell_str($tot_earned, $tot_poss) ; - print "\n" ; - - print "\n" ; - print "
      Category Scores
      CategoryQuestionsPoints PossiblePoints Earned% Earned
      $supercat$questions$possible
      Total$tot_poss
      \n" ; - - print HTMLFooter(); -} - -sub LikertWQG { - # This does the Summary on the Likert Scale questions, - # for everybody, or just groups, and lists group results. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale Group Results"); - print "
      " ; - print "Likert Scale Group Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - my $cat_count = keys %{$sumdata} ; # Number of categories. - # Print first row. - print "" ; - print "" ; - my $supercat ; - foreach $supercat (sort keys %{$sumdata}) { - print "\n" ; - } - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - print "" ; - print "\n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - # my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - # $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - - # Print heading for Groups. - my $col_count = $cat_count + 2 ; - print "\n" ; - - print "" ; - for $supercat (@supercats) { - print "" ; - } - print "\n" ; - - unless ($grpdata) { - print "\n" ; - } else { - my $group ; - foreach $group (sort keys %{$grpdata}) { - if ($group) { - print "" ; - print "" ; - my $tot_poss = 0 ; my $tot_earned = 0 ; - for $supercat (@supercats) { - my $possible = $grpdata->{$group}->{$supercat}->{'PointsAvail'} ; - my $earned = $grpdata->{$group}->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - } - } - } - print "
      $supercatTotal
      Overall
      Group Breakdown
      Supervisor$supercatTotal
      Pick Groups for more detail
      " ; - # print "$group " ; - print $all_groups->{$group}->{'grpnme'} ; - print "
      \n" ; - - print HTMLFooter(); -} - -sub rep_cell_str { - # Parameters - # $count - required, number for the cell, integer. - # $total - dividend for the percent, integer. - # $skip_tot - Optional, default false. - # If true, do not print total. - # Returned Value - # $html_str - html string to print for the cell. - my ($count, $total, $skip_tot) = @_ ; - my $html_str ; - $html_str .= "" unless ($skip_tot) ; - my ($percent, $percent_str, $count_str) ; - $count_str = sprintf("%4i", $count) ; - if ($total == 0) { - # total is 0, percent is undefined. - $percent_str = "-   - %" ; - } else { - $percent = 100.0 * $count / $total ; - $percent_str = sprintf("%5.1f %%", $percent) ; - } - $html_str .= "$count_str" unless ($skip_tot) ; - $html_str .= "" ; - $html_str .= "$percent_str" ; - return $html_str ; -} - -sub ret_test_chooser_mod { -# Return strings of html to pick a survey. -# The parameter is an array of arrays with test descriptions and ids. -# The returned value is an array with two strings. -# The first string is JavaScript for the test chooser. -# The second string is html for the tables to drive the test chooser. - my @trecs = @_; - # print STDERR Dumper(\@trecs) ; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $html_str = "" ; - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) ; - $desc = $trecs[$_][0] ; - $id = $trecs[$_][1] ; - # warn "RET_TEST_CHOOSER_MOD ID $id DESC $desc X" ; - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - my $radio_tst_button ; - $radio_tst_button = ' ' . $id ; - $tstoption = " " . - # "$id" . - "$radio_tst_button" . - "$desc" . - "$testscompleted" . - "$testsinprogress" . - "$testspending \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - $html_str = "
      Please choose the survey for which you would like reports:
      " . - # "
      " . - # "" . - # "" . - # "" . - # "
      " . -"" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - $tstoptions . - "" . - "

      Test IDDescriptionCmpInPPnd


      " ; - return ($js, $html_str) ; -} - diff --git a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100509 b/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100509 deleted file mode 100755 index 801885e50..000000000 --- a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100509 +++ /dev/null @@ -1,508 +0,0 @@ -#!/usr/bin/perl -# -# Source File: Likert_Gen_Groups.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' ; -require 'grepa.pm' ; - -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 ); -use vars qw($testinprog $testpending) ; - -# &app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -# print STDERR Dumper(\%FORM); -&get_client_profile($SESSION{'clid'}); -# warn "Tstid $FORM{'tstid'}\n" ; -&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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
      ".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 (defined $timestamp) { - $timestamp = "$timestamp

      \n"; -} else { - $timestamp = "
      \n"; -} - -# Generate the reports -if ($FORM{'reportname'} eq 'LikertWQ') { - &LikertWQ($idlist, $groups, $timestamp); - } elsif ($FORM{'reportname'} eq 'LikertWQG') { - &LikertWQG($idlist, $groups, $timestamp); - } else { - &ReportChooser(); - } - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\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, ACTS Corporation$ionline
      \n\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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - my $organizationname = $CLIENT{'clnmc'}; - my $uberheader; - my $TESTS = get_data_hash ("tests.$CLIENT{'clid'}") ; - # print STDERR Dumper($TESTS) ; - my %TESTS = %$TESTS ; - my @test_list = () ; - my $ids ; - for $ids (keys %TESTS) { - # warn "ID $ids DATADESC $TESTS{$ids}->{'desc'} X" ; - push @test_list, [$TESTS{$ids}->{'desc'}, $ids] ; - } - # warn "test_list count $#test_list X\n" ; - # print STDERR Dumper(\@test_list) ; - my ($js1, $test_choice_html) = ret_test_chooser_mod(@test_list) ; - - #print STDERR get_data("tests.$CLIENT{'clid'}"); - #print STDERR "Test ID = $tstid\n"; - print HTMLHeader("Integro Learning Custom Reports",$js . $js1); - print "
      \n"; - print "\n"; - # For development purposes we hardcode the survey id. - # Fix this before production - # print "\n"; # HBI This had a value of $tstid - 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 $test_choice_html ; - print "

      Likert Scale Report" ; - print "

        " ; - print "
      • Likert Scale - No Response is zero, Question Numbers listed.
      • \n" ; - print "
      • Likert Scale by Group - No Response is zero, Detail by Groups.
      • \n" ; - print "

      \n" ; - print "\n"; - print "\n"; - print "
      "; - print HTMLFooter(); -} - -sub LikertWQ { - # This does the Summary on the Likert Scale questions, - # for everybody, or the Groups selected. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale General Results"); - print "
      " ; - print "Likert Scale General Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - my (@img_labels, @img_data) ; - my (@values2, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum) ; - my ($colorscheme, $t_margin, $b_margin, $l_margin, $r_margin ) ; - @img_labels = () ; @img_data = () ; @values2 = () ; - ($t_margin, $b_margin, $l_margin, $r_margin) = (0, 0, 0, 30) ; - ($xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, $colorscheme) = - (800, 100, 1, "$CLIENT{'clnmc'}", "Category", "Percent for Category", 100, 0, 10, 1) ; - - # Print HTML for heading. - print "\n"; - - # Print first row. - print "" ; - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - my $supercat ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print "" ; - print "" ; - print "" ; - print "" ; - print &rep_cell_str($earned, $possible) ; - push @img_labels, $supercat ; - my ($percent) = int ((100.0 * $earned / $possible) +0.5) ; - push @img_data, $percent ; - $ydim += 15 ; # add length to the chart for another row. - print "\n" ; - } - - # Print Total row. - print "" ; - print "" ; - print "" ; - print &rep_cell_str($tot_earned, $tot_poss) ; - print "\n" ; - - print "\n" ; - print "
      Category Scores
      CategoryQuestionsPoints PossiblePoints Earned% Earned
      $supercat$questions$possible
      Total$tot_poss
      \n" ; - - if (@supercats) { - print "

      \n" ; - print BuildBarGraph(\@img_labels, \@img_data, \@values2, $xdim, - $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, - $colorscheme, $t_margin, $b_margin, $l_margin, $r_margin) ; - print "

      \n" ; - } - - print HTMLFooter(); -} - -sub LikertWQG { - # This does the Summary on the Likert Scale questions, - # for everybody, or just groups, and lists group results. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale Group Results"); - print "
      " ; - print "Likert Scale Group Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - my $cat_count = keys %{$sumdata} ; # Number of categories. - # Print first row. - print "" ; - print "" ; - my $supercat ; - foreach $supercat (sort keys %{$sumdata}) { - print "\n" ; - } - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - print "" ; - print "\n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - # my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - # $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - - # Print heading for Groups. - my $col_count = $cat_count + 2 ; - print "\n" ; - - print "" ; - for $supercat (@supercats) { - print "" ; - } - print "\n" ; - - unless ($grpdata) { - print "\n" ; - } else { - my $group ; - foreach $group (sort keys %{$grpdata}) { - if ($group) { - print "" ; - print "" ; - my $tot_poss = 0 ; my $tot_earned = 0 ; - for $supercat (@supercats) { - my $possible = $grpdata->{$group}->{$supercat}->{'PointsAvail'} ; - my $earned = $grpdata->{$group}->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - } - } - } - print "
      $supercatTotal
      Overall
      Group Breakdown
      Supervisor$supercatTotal
      Pick Groups for more detail
      " ; - # print "$group " ; - print $all_groups->{$group}->{'grpnme'} ; - print "
      \n" ; - - print HTMLFooter(); -} - -sub rep_cell_str { - # Parameters - # $count - required, number for the cell, integer. - # $total - dividend for the percent, integer. - # $skip_tot - Optional, default false. - # If true, do not print total. - # Returned Value - # $html_str - html string to print for the cell. - my ($count, $total, $skip_tot) = @_ ; - my $html_str ; - $html_str .= "" unless ($skip_tot) ; - my ($percent, $percent_str, $count_str) ; - $count_str = sprintf("%4i", $count) ; - if ($total == 0) { - # total is 0, percent is undefined. - $percent_str = "-   - %" ; - } else { - $percent = 100.0 * $count / $total ; - $percent_str = sprintf("%5.1f %%", $percent) ; - } - $html_str .= "$count_str" unless ($skip_tot) ; - $html_str .= "" ; - $html_str .= "$percent_str" ; - return $html_str ; -} - -sub ret_test_chooser_mod { -# Return strings of html to pick a survey. -# The parameter is an array of arrays with test descriptions and ids. -# The returned value is an array with two strings. -# The first string is JavaScript for the test chooser. -# The second string is html for the tables to drive the test chooser. - my @trecs = @_; - # print STDERR Dumper(\@trecs) ; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $html_str = "" ; - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) ; - $desc = $trecs[$_][0] ; - $id = $trecs[$_][1] ; - # warn "RET_TEST_CHOOSER_MOD ID $id DESC $desc X" ; - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - my $radio_tst_button ; - $radio_tst_button = ' ' . $id ; - $tstoption = " " . - # "$id" . - "$radio_tst_button" . - "$desc" . - "$testscompleted" . - "$testsinprogress" . - "$testspending \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - $html_str = "
      Please choose the survey for which you would like reports:
      " . - # "
      " . - # "" . - # "" . - # "" . - # "
      " . -"" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - $tstoptions . - "" . - "

      Test IDDescriptionCmpInPPnd


      " ; - return ($js, $html_str) ; -} - diff --git a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100513 b/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100513 deleted file mode 100755 index 85dcc6504..000000000 --- a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20100513 +++ /dev/null @@ -1,515 +0,0 @@ -#!/usr/bin/perl -# -# Source File: Likert_Gen_Groups.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' ; -require 'grepa.pm' ; - -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 ); -use vars qw($testinprog $testpending) ; - -# &app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -# print STDERR Dumper(\%FORM); -&get_client_profile($SESSION{'clid'}); -# warn "Tstid $FORM{'tstid'}\n" ; -&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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
      ".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 (defined $timestamp) { - $timestamp = "$timestamp

      \n"; -} else { - $timestamp = "
      \n"; -} - -# Generate the reports -if ($FORM{'reportname'} eq 'LikertWQ') { - &LikertWQ($idlist, $groups, $timestamp); - } elsif ($FORM{'reportname'} eq 'LikertWQG') { - &LikertWQG($idlist, $groups, $timestamp); - } else { - &ReportChooser(); - } - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\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, ACTS Corporation$ionline
      \n\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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - my $organizationname = $CLIENT{'clnmc'}; - my $uberheader; - my $TESTS = get_data_hash ("tests.$CLIENT{'clid'}") ; - # print STDERR Dumper($TESTS) ; - my %TESTS = %$TESTS ; - my @test_list = () ; - my $ids ; - for $ids (keys %TESTS) { - # warn "ID $ids DATADESC $TESTS{$ids}->{'desc'} X" ; - push @test_list, [$TESTS{$ids}->{'desc'}, $ids] ; - } - # warn "test_list count $#test_list X\n" ; - # print STDERR Dumper(\@test_list) ; - my ($js1, $test_choice_html) = ret_test_chooser_mod(@test_list) ; - - #print STDERR get_data("tests.$CLIENT{'clid'}"); - #print STDERR "Test ID = $tstid\n"; - print HTMLHeader("Integro Learning Custom Reports",$js . $js1); - print "
      \n"; - print "\n"; - # For development purposes we hardcode the survey id. - # Fix this before production - # print "\n"; # HBI This had a value of $tstid - 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 $test_choice_html ; - print "

      Likert Scale Report" ; - print "

        " ; - print "
      • Likert Scale - No Response is zero, Question Numbers listed.
      • \n" ; - print "
      • Likert Scale by Group - No Response is zero, Detail by Groups.
      • \n" ; - print "

      \n" ; - print "\n"; - print "\n"; - print "
      "; - print HTMLFooter(); -} - -sub LikertWQ { - # This does the Summary on the Likert Scale questions, - # for everybody, or the Groups selected. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale General Results"); - print "
      " ; - print "Likert Scale General Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - my (@img_labels, @img_data) ; - my (@values2, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum) ; - my ($colorscheme, $t_margin, $b_margin, $l_margin, $r_margin ) ; - @img_labels = () ; @img_data = () ; @values2 = () ; - ($t_margin, $b_margin, $l_margin, $r_margin) = (0, 0, 0, 30) ; - ($xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, $colorscheme) = - (800, 100, 1, "$CLIENT{'clnmc'}", "Category", "Percent for Category", 100, 0, 10, 1) ; - - # Print HTML for heading. - print "\n"; - - # Print first row. - print "" ; - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - my $supercat ; my $text_summ = "

      Category: Percent
      \n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print "

      " ; - print "" ; - print "" ; - print "" ; - print &rep_cell_str($earned, $possible) ; - push @img_labels, $supercat ; - my ($percent) = int ((100.0 * $earned / $possible) +0.5) ; - push @img_data, $percent ; - $text_summ .= $supercat . ": " . $percent . "
      \n" ; - $ydim += 15 ; # add length to the chart for another row. - print "\n" ; - } - - # Print Total row. - print "" ; - print "" ; - print "" ; - push @img_labels, "Total" ; - my ($percent) = int ((100.0 * $tot_earned / $tot_poss) +0.5) ; - push @img_data, $percent ; - $text_summ .= "Total" . ": " . $percent . "
      \n" ; - $ydim += 15 ; # add length to the chart for another row. - print &rep_cell_str($tot_earned, $tot_poss) ; - print "\n" ; - - print "\n" ; - print "
      Category Scores
      CategoryQuestionsPoints PossiblePoints Earned% Earned
      $supercat$questions$possible
      Total$tot_poss
      \n" ; - print $text_summ ; - - if (@supercats) { - print "

      \n" ; - print BuildBarGraph(\@img_labels, \@img_data, \@values2, $xdim, - $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, - $colorscheme, $t_margin, $b_margin, $l_margin, $r_margin) ; - print "

      \n" ; - } - - print HTMLFooter(); -} - -sub LikertWQG { - # This does the Summary on the Likert Scale questions, - # for everybody, or just groups, and lists group results. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale Group Results"); - print "
      " ; - print "Likert Scale Group Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - my $cat_count = keys %{$sumdata} ; # Number of categories. - # Print first row. - print "" ; - print "" ; - my $supercat ; - foreach $supercat (sort keys %{$sumdata}) { - print "\n" ; - } - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - print "" ; - print "\n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - # my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - # $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - - # Print heading for Groups. - my $col_count = $cat_count + 2 ; - print "\n" ; - - print "" ; - for $supercat (@supercats) { - print "" ; - } - print "\n" ; - - unless ($grpdata) { - print "\n" ; - } else { - my $group ; - foreach $group (sort keys %{$grpdata}) { - if ($group) { - print "" ; - print "" ; - my $tot_poss = 0 ; my $tot_earned = 0 ; - for $supercat (@supercats) { - my $possible = $grpdata->{$group}->{$supercat}->{'PointsAvail'} ; - my $earned = $grpdata->{$group}->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - } - } - } - print "
      $supercatTotal
      Overall
      Group Breakdown
      Supervisor$supercatTotal
      Pick Groups for more detail
      " ; - # print "$group " ; - print $all_groups->{$group}->{'grpnme'} ; - print "
      \n" ; - - print HTMLFooter(); -} - -sub rep_cell_str { - # Parameters - # $count - required, number for the cell, integer. - # $total - dividend for the percent, integer. - # $skip_tot - Optional, default false. - # If true, do not print total. - # Returned Value - # $html_str - html string to print for the cell. - my ($count, $total, $skip_tot) = @_ ; - my $html_str ; - $html_str .= "" unless ($skip_tot) ; - my ($percent, $percent_str, $count_str) ; - $count_str = sprintf("%4i", $count) ; - if ($total == 0) { - # total is 0, percent is undefined. - $percent_str = "-   - %" ; - } else { - $percent = 100.0 * $count / $total ; - $percent_str = sprintf("%5.1f %%", $percent) ; - } - $html_str .= "$count_str" unless ($skip_tot) ; - $html_str .= "" ; - $html_str .= "$percent_str" ; - return $html_str ; -} - -sub ret_test_chooser_mod { -# Return strings of html to pick a survey. -# The parameter is an array of arrays with test descriptions and ids. -# The returned value is an array with two strings. -# The first string is JavaScript for the test chooser. -# The second string is html for the tables to drive the test chooser. - my @trecs = @_; - # print STDERR Dumper(\@trecs) ; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $html_str = "" ; - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) ; - $desc = $trecs[$_][0] ; - $id = $trecs[$_][1] ; - # warn "RET_TEST_CHOOSER_MOD ID $id DESC $desc X" ; - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - my $radio_tst_button ; - $radio_tst_button = ' ' . $id ; - $tstoption = " " . - # "$id" . - "$radio_tst_button" . - "$desc" . - "$testscompleted" . - "$testsinprogress" . - "$testspending \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - $html_str = "
      Please choose the survey for which you would like reports:
      " . - # "
      " . - # "" . - # "" . - # "" . - # "
      " . -"" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - $tstoptions . - "" . - "

      Test IDDescriptionCmpInPPnd


      " ; - return ($js, $html_str) ; -} - diff --git a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20131217 b/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20131217 deleted file mode 100755 index 5951de5ca..000000000 --- a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20131217 +++ /dev/null @@ -1,517 +0,0 @@ -#!/usr/bin/perl -# -# Source File: Likert_Gen_Groups.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' ; -require 'grepa.pm' ; - -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 ); -use vars qw($testinprog $testpending) ; - -# &app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -# print STDERR Dumper(\%FORM); -&get_client_profile($SESSION{'clid'}); -# warn "Tstid $FORM{'tstid'}\n" ; -&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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
      ".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 (defined $timestamp) { - $timestamp = "$timestamp

      \n"; -} else { - $timestamp = "
      \n"; -} - -# Generate the reports -if ($FORM{'reportname'} eq 'LikertWQ') { - &LikertWQ($idlist, $groups, $timestamp); - } elsif ($FORM{'reportname'} eq 'LikertWQG') { - &LikertWQG($idlist, $groups, $timestamp); - } else { - &ReportChooser(); - } - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\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, ACTS Corporation$ionline
      \n\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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - my $organizationname = $CLIENT{'clnmc'}; - my $uberheader; - my $TESTS = get_data_hash ("tests.$CLIENT{'clid'}") ; - # print STDERR Dumper($TESTS) ; - my %TESTS = %$TESTS ; - my @test_list = () ; - my $ids ; - for $ids (keys %TESTS) { - # warn "ID $ids DATADESC $TESTS{$ids}->{'desc'} X" ; - push @test_list, [$TESTS{$ids}->{'desc'}, $ids] ; - } - # warn "test_list count $#test_list X\n" ; - # print STDERR Dumper(\@test_list) ; - my ($js1, $test_choice_html) = ret_test_chooser_mod(@test_list) ; - - #print STDERR get_data("tests.$CLIENT{'clid'}"); - #print STDERR "Test ID = $tstid\n"; - print HTMLHeader("Integro Learning Custom Reports",$js . $js1); - print "
      \n"; - print "\n"; - # For development purposes we hardcode the survey id. - # Fix this before production - # print "\n"; # HBI This had a value of $tstid - 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 $test_choice_html ; - print "

      Likert Scale Report" ; - print "

        " ; - print "
      • Likert Scale - No Response is zero, Question Numbers listed.
      • \n" ; - print "
      • Likert Scale by Group - No Response is zero, Detail by Groups.
      • \n" ; - print "

      \n" ; - print "\n"; - print "\n"; - print "
      "; - print HTMLFooter(); -} - -sub LikertWQ { - # This does the Summary on the Likert Scale questions, - # for everybody, or the Groups selected. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale General Results"); - print "
      " ; - print "Likert Scale General Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - my (@img_labels, @img_data) ; - my (@values2, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum) ; - my ($colorscheme, $t_margin, $b_margin, $l_margin, $r_margin ) ; - @img_labels = () ; @img_data = () ; @values2 = () ; - ($t_margin, $b_margin, $l_margin, $r_margin) = (0, 0, 0, 30) ; - ($xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, $colorscheme) = - (800, 100, 1, "$CLIENT{'clnmc'}", "Category", "Percent for Category", 100, 0, 10, 1) ; - - # Print HTML for heading. - print "\n"; - - # Print first row. - print "" ; - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - my $supercat ; my $text_summ = "

      " ; - $text_summ .= '' ; - $text_summ .= "Category: Percent
      \n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print "

      " ; - print "" ; - print "" ; - print "" ; - print &rep_cell_str($earned, $possible) ; - push @img_labels, $supercat ; - my ($percent) = int ((100.0 * $earned / $possible) +0.5) ; - push @img_data, $percent ; - $text_summ .= $supercat . ": " . $percent . " %
      \n" ; - $ydim += 15 ; # add length to the chart for another row. - print "
      \n" ; - } - - # Print Total row. - print "" ; - print "" ; - print "" ; - push @img_labels, "Total" ; - my ($percent) = int ((100.0 * $tot_earned / $tot_poss) +0.5) ; - push @img_data, $percent ; - $text_summ .= "Total" . ": " . $percent . " %
      \n" ; - $ydim += 15 ; # add length to the chart for another row. - print &rep_cell_str($tot_earned, $tot_poss) ; - print "
      \n" ; - - print "\n" ; - print "
      Category Scores
      CategoryQuestionsPoints PossiblePoints Earned% Earned
      $supercat$questions$possible
      Total$tot_poss
      \n" ; - print $text_summ ; - - if (@supercats) { - print "

      \n" ; - print BuildBarGraph(\@img_labels, \@img_data, \@values2, $xdim, - $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, - $colorscheme, $t_margin, $b_margin, $l_margin, $r_margin) ; - print "

      \n" ; - } - - print HTMLFooter(); -} - -sub LikertWQG { - # This does the Summary on the Likert Scale questions, - # for everybody, or just groups, and lists group results. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale Group Results"); - print "
      " ; - print "Likert Scale Group Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - my $cat_count = keys %{$sumdata} ; # Number of categories. - # Print first row. - print "" ; - print "" ; - my $supercat ; - foreach $supercat (sort keys %{$sumdata}) { - print "\n" ; - } - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - print "" ; - print "\n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - # my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - # $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - - # Print heading for Groups. - my $col_count = $cat_count + 2 ; - print "\n" ; - - print "" ; - for $supercat (@supercats) { - print "" ; - } - print "\n" ; - - unless ($grpdata) { - print "\n" ; - } else { - my $group ; - foreach $group (sort keys %{$grpdata}) { - if ($group) { - print "" ; - print "" ; - my $tot_poss = 0 ; my $tot_earned = 0 ; - for $supercat (@supercats) { - my $possible = $grpdata->{$group}->{$supercat}->{'PointsAvail'} ; - my $earned = $grpdata->{$group}->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - } - } - } - print "
      $supercatTotal
      Overall
      Group Breakdown
      Supervisor$supercatTotal
      Pick Groups for more detail
      " ; - # print "$group " ; - print $all_groups->{$group}->{'grpnme'} ; - print "
      \n" ; - - print HTMLFooter(); -} - -sub rep_cell_str { - # Parameters - # $count - required, number for the cell, integer. - # $total - dividend for the percent, integer. - # $skip_tot - Optional, default false. - # If true, do not print total. - # Returned Value - # $html_str - html string to print for the cell. - my ($count, $total, $skip_tot) = @_ ; - my $html_str ; - $html_str .= "" unless ($skip_tot) ; - my ($percent, $percent_str, $count_str) ; - $count_str = sprintf("%4i", $count) ; - if ($total == 0) { - # total is 0, percent is undefined. - $percent_str = "-   - %" ; - } else { - $percent = 100.0 * $count / $total ; - $percent_str = sprintf("%5.1f %%", $percent) ; - } - $html_str .= "$count_str" unless ($skip_tot) ; - $html_str .= "" ; - $html_str .= "$percent_str" ; - return $html_str ; -} - -sub ret_test_chooser_mod { -# Return strings of html to pick a survey. -# The parameter is an array of arrays with test descriptions and ids. -# The returned value is an array with two strings. -# The first string is JavaScript for the test chooser. -# The second string is html for the tables to drive the test chooser. - my @trecs = @_; - # print STDERR Dumper(\@trecs) ; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $html_str = "" ; - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) ; - $desc = $trecs[$_][0] ; - $id = $trecs[$_][1] ; - # warn "RET_TEST_CHOOSER_MOD ID $id DESC $desc X" ; - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - my $radio_tst_button ; - $radio_tst_button = ' ' . $id ; - $tstoption = " " . - # "$id" . - "$radio_tst_button" . - "$desc" . - "$testscompleted" . - "$testsinprogress" . - "$testspending \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - $html_str = "
      Please choose the survey for which you would like reports:
      " . - # "
      " . - # "" . - # "" . - # "" . - # "
      " . -"" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - $tstoptions . - "" . - "

      Test IDDescriptionCmpInPPnd


      " ; - return ($js, $html_str) ; -} - diff --git a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20131221 b/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20131221 deleted file mode 100755 index 9672b8670..000000000 --- a/survey-nginx/cgi-bin/Likert_Gen_Groups.pl.bu20131221 +++ /dev/null @@ -1,518 +0,0 @@ -#!/usr/bin/perl -# -# Source File: Likert_Gen_Groups.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' ; -require 'grepa.pm' ; - -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 ); -use vars qw($testinprog $testpending) ; - -# &app_initialize; - -$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma. HBI - -&LanguageSupportInit(); -# print STDERR Dumper(\%FORM); -&get_client_profile($SESSION{'clid'}); -# warn "Tstid $FORM{'tstid'}\n" ; -&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'}); - my @tmp = param('idlist'); - $FORM{'idlist'} = join(',', @tmp); - @{$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 "
      ".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 (defined $timestamp) { - $timestamp = "$timestamp

      \n"; -} else { - $timestamp = "
      \n"; -} - -# Generate the reports -if ($FORM{'reportname'} eq 'LikertWQ') { - &LikertWQ($idlist, $groups, $timestamp); - } elsif ($FORM{'reportname'} eq 'LikertWQG') { - &LikertWQG($idlist, $groups, $timestamp); - } else { - &ReportChooser(); - } - -# There should only be function definitions beyond this point. -exit(0); - -sub HTMLHeader { - return "\n\n$_[0]\n". - "\n". - "\n\n". - "\n"; -} - -sub HTMLHeaderPlain { - return "\n\n$_[0]\n". - "\n\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, ACTS Corporation$ionline
      \n\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/IntegroTS.pl';\n\t". - "oform.submit();\n};\n"; - my $organizationname = $CLIENT{'clnmc'}; - my $uberheader; - my $TESTS = get_data_hash ("tests.$CLIENT{'clid'}") ; - # print STDERR Dumper($TESTS) ; - my %TESTS = %$TESTS ; - my @test_list = () ; - my $ids ; - for $ids (keys %TESTS) { - # warn "ID $ids DATADESC $TESTS{$ids}->{'desc'} X" ; - push @test_list, [$TESTS{$ids}->{'desc'}, $ids] ; - } - # warn "test_list count $#test_list X\n" ; - # print STDERR Dumper(\@test_list) ; - my ($js1, $test_choice_html) = ret_test_chooser_mod(@test_list) ; - - #print STDERR get_data("tests.$CLIENT{'clid'}"); - #print STDERR "Test ID = $tstid\n"; - print HTMLHeader("Integro Learning Custom Reports",$js . $js1); - print "
      \n"; - print "\n"; - # For development purposes we hardcode the survey id. - # Fix this before production - # print "\n"; # HBI This had a value of $tstid - 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 $test_choice_html ; - print "

      Likert Scale Report" ; - print "

        " ; - print "
      • Likert Scale - No Response is ignored, Question Numbers listed.
      • \n" ; - print "
      • Likert Scale by Group - No Response is ignored, Detail by Groups.
      • \n" ; - print "

      \n" ; - print "\n"; - print "\n"; - print "
      "; - print HTMLFooter(); -} - -sub LikertWQ { - # This does the Summary on the Likert Scale questions, - # for everybody, or the Groups selected. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - my ($idlist,$groups,$timestamp) = @_; - my $ResponseRequired = 1 ; # Do not count a question if it is not responded to. - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required, $ResponseRequired) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale General Results"); - print "
      " ; - print "Likert Scale General Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - my (@img_labels, @img_data) ; - my (@values2, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum) ; - my ($colorscheme, $t_margin, $b_margin, $l_margin, $r_margin ) ; - @img_labels = () ; @img_data = () ; @values2 = () ; - ($t_margin, $b_margin, $l_margin, $r_margin) = (0, 0, 0, 30) ; - ($xdim, $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, $colorscheme) = - (800, 100, 1, "$CLIENT{'clnmc'}", "Category", "Percent for Category", 100, 0, 10, 1) ; - - # Print HTML for heading. - print "\n"; - - # Print first row. - print "" ; - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "" ; - print "\n" ; - - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - my $supercat ; my $text_summ = "

      " ; - $text_summ .= '' ; - $text_summ .= "Category: Percent
      \n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - $questions = join(", ", sort map { $_ + 1 } keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print "

      " ; - print "" ; - print "" ; - print "" ; - print &rep_cell_str($earned, $possible) ; - push @img_labels, $supercat ; - my ($percent) = int ((100.0 * $earned / $possible) +0.5) ; - push @img_data, $percent ; - $text_summ .= $supercat . ": " . $percent . " %
      \n" ; - $ydim += 15 ; # add length to the chart for another row. - print "
      \n" ; - } - - # Print Total row. - print "" ; - print "" ; - print "" ; - push @img_labels, "Total" ; - my ($percent) = int ((100.0 * $tot_earned / $tot_poss) +0.5) ; - push @img_data, $percent ; - $text_summ .= "Total" . ": " . $percent . " %
      \n" ; - $ydim += 15 ; # add length to the chart for another row. - print &rep_cell_str($tot_earned, $tot_poss) ; - print "
      \n" ; - - print "\n" ; - print "
      Category Scores
      CategoryQuestionsPoints PossiblePoints Earned% Earned
      $supercat$questions$possible
      Total$tot_poss
      \n" ; - print $text_summ ; - - if (@supercats) { - print "

      \n" ; - print BuildBarGraph(\@img_labels, \@img_data, \@values2, $xdim, - $ydim, $hbar, $title, $xlabel, $ylabel, $ymax, $ymin, $yticknum, - $colorscheme, $t_margin, $b_margin, $l_margin, $r_margin) ; - print "

      \n" ; - } - - print HTMLFooter(); -} - -sub LikertWQG { - # This does the Summary on the Likert Scale questions, - # for everybody, or just groups, and lists group results. - # $idlist is the list of candidate ids to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the candidate ids, and the value is 1 for candidates in the choosen groups. - # $groups is the hash of groups to report on. It is undef when all groups (everyone) is choosen. - # It is a reference to a hash. The keys are the group ids, and the values are the group ids. - # $FORM{'idlist'} is a comma separated list of the group ids of the selected groups. - # $FORM{'grouping'} is "subset" when the report should only cover the selected groups. - # $FORM{'grouping'} is "all" when the report should cover everybody. - # HBI - Pick it up here. - my ($idlist,$groups,$timestamp) = @_; - my $ResponseRequired = 1 ; # Do not count questions if there was no response. - my $all_groups = getGroups($CLIENT{'clid'}) ; - my $group_membership_required ; - if ($groups) { - $group_membership_required = 1 ; - my $group_p ; - for $group_p (keys %{$all_groups}) { - unless ($groups->{$group_p}) { - undef $all_groups->{$group_p} ; - } - } - } else { - $group_membership_required = 0 ; - } - my ($sumdata, $grpdata) = &GetFullLikertGrpData($CLIENT{'clid'},$TEST{'id'},$all_groups, $group_membership_required,$ResponseRequired) ; - # warn "sumdata" ; - # warn &Dumper(\$sumdata) ; - # warn "grpdata" ; - # warn &Dumper(\$grpdata) ; - - print HTMLHeaderPlain("Likert Scale Group Results"); - print "
      " ; - print "Likert Scale Group Results
      " ; - print "Survey/Test $TEST{'desc'}


      \n"; - # print "Improvement as Perceived by Employees
      \n"; - # print "$FORM{'orgname'}
      \n"; - if ($FORM{'uberheader'} ne "") { - print "".$FORM{'uberheader'}."
      \n"; - } elsif (defined $idlist) { - print "Summary for Groups: " - .join(", ",map($all_groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."
      \n" ; - } else { - print "$xlatphrase[798] $xlatphrase[799]
      \n"; - } - print $timestamp; - print "" ; - - # Print HTML for heading. - print "\n"; - - my $cat_count = keys %{$sumdata} ; # Number of categories. - # Print first row. - print "" ; - print "" ; - my $supercat ; - foreach $supercat (sort keys %{$sumdata}) { - print "\n" ; - } - print "" ; - print "\n" ; - - # Print second row. Heading for each column. - # Loop for Categories. - my $tot_poss = 0 ; my $tot_earned = 0 ; - print "" ; - print "\n" ; - my @supercats = sort keys %{$sumdata} ; - for $supercat (@supercats) { - # my $questions = "" ; - my $possible = 0 ; - my $earned = 0 ; - # $questions = join(", ", sort keys %{$sumdata->{$supercat}->{'Questions'}}) ; - $possible = $sumdata->{$supercat}->{'PointsAvail'} ; - $earned = $sumdata->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - - # Print heading for Groups. - my $col_count = $cat_count + 2 ; - print "\n" ; - - print "" ; - for $supercat (@supercats) { - print "" ; - } - print "\n" ; - - unless ($grpdata) { - print "\n" ; - } else { - my $group ; - foreach $group (sort keys %{$grpdata}) { - if ($group) { - print "" ; - print "" ; - my $tot_poss = 0 ; my $tot_earned = 0 ; - for $supercat (@supercats) { - my $possible = $grpdata->{$group}->{$supercat}->{'PointsAvail'} ; - my $earned = $grpdata->{$group}->{$supercat}->{'PointsEarned'} ; - $tot_poss += $possible ; - $tot_earned += $earned ; - print &rep_cell_str($earned, $possible, 1) ; - } - print &rep_cell_str($tot_earned, $tot_poss, 1) ; - print "\n" ; - } - } - } - print "
      $supercatTotal
      Overall
      Group Breakdown
      Supervisor$supercatTotal
      Pick Groups for more detail
      " ; - # print "$group " ; - print $all_groups->{$group}->{'grpnme'} ; - print "
      \n" ; - - print HTMLFooter(); -} - -sub rep_cell_str { - # Parameters - # $count - required, number for the cell, integer. - # $total - dividend for the percent, integer. - # $skip_tot - Optional, default false. - # If true, do not print total. - # Returned Value - # $html_str - html string to print for the cell. - my ($count, $total, $skip_tot) = @_ ; - my $html_str ; - $html_str .= "" unless ($skip_tot) ; - my ($percent, $percent_str, $count_str) ; - $count_str = sprintf("%4i", $count) ; - if ($total == 0) { - # total is 0, percent is undefined. - $percent_str = "-   - %" ; - } else { - $percent = 100.0 * $count / $total ; - $percent_str = sprintf("%5.1f %%", $percent) ; - } - $html_str .= "$count_str" unless ($skip_tot) ; - $html_str .= "" ; - $html_str .= "$percent_str" ; - return $html_str ; -} - -sub ret_test_chooser_mod { -# Return strings of html to pick a survey. -# The parameter is an array of arrays with test descriptions and ids. -# The returned value is an array with two strings. -# The first string is JavaScript for the test chooser. -# The second string is html for the tables to drive the test chooser. - my @trecs = @_; - # print STDERR Dumper(\@trecs) ; - my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions); - my $html_str = "" ; - my $js = "function setTest(oform,test) {\n\t". - "oform.tstid.value=test;\n\t". - "oform.submit();\n};\n"; - for (0 .. $#trecs) { - my ($desc,$id) ; - $desc = $trecs[$_][0] ; - $id = $trecs[$_][1] ; - # warn "RET_TEST_CHOOSER_MOD ID $id DESC $desc X" ; - $testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id); - $testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id); - $testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id); - $href="javascript:setTest(document.testform1,\'$id\')\;"; - my $radio_tst_button ; - $radio_tst_button = ' ' . $id ; - $tstoption = " " . - # "$id" . - "$radio_tst_button" . - "$desc" . - "$testscompleted" . - "$testsinprogress" . - "$testspending \n"; - $tstoptions = join('', $tstoptions, $tstoption); - } - $html_str = "
      Please choose the survey for which you would like reports:
      " . - # "
      " . - # "" . - # "" . - # "" . - # "
      " . -"" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - "" . - $tstoptions . - "" . - "

      Test IDDescriptionCmpInPPnd


      " ; - return ($js, $html_str) ; -} - diff --git a/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140129 b/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140129 deleted file mode 100755 index 951af4a4d..000000000 --- a/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140129 +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/perl -w -# -# $Id: bargraph_multi.pm -# - -use strict; -package bargraph_multi ; -require Exporter ; -@bargraph_multi::ISA = qw(Exporter) ; -@bargraph_multi::EXPORT = qw(Build_Labeled_X_Axis_Graph_Str Build_Labeled_X_Axis_Graph_Obj) ; -@bargraph_multi::EXPORT_OK = qw( ) ; -use GD; -use GD::Graph::colour; -use GD::Graph::bars; -use GD::Graph::hbars; -use GD::Graph::bars3d; -#use Data::Dumper; - -# This perl code is builds Graphs using the GD::Graph modules. -# This code deals with a non-numeric X-Axis. Each tick on the X-Axis is the name of a group. -# The other style has a numeric X-Axis. -sub Build_Labeled_X_Axis_Graph_Str { -# The parameters are: -# $Data_In - A reference to a list of lists. (aka, Array of Arrays) -# Each of the sublists has the same number of elements. -# An element might be the undef value. -# The first sublist is the names of the groups. -# The other sublists are related to the elements in the $Legend parameter. -# $Legend - A reference to a list. -# Each element of the list is the name of a group. -# The data for each group is a sublist in the $Data_In parameter. -# ---- The rest of the parameters are individual options as scalars: numbers, character strings, or undef. -# The returned value is a list of (reference to the plotted graphical object, and graphic string in the mode. - my ($Data_In, $Legend, $Graphic_Mode, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_label_position, $y_label_position, $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $overwrite, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols - ) = @_ ; - my $Graph_Obj = &Build_Labeled_X_Axis_Graph_Obj - ($Data_In, $Legend, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_label_position, $y_label_position, $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $overwrite, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols ) ; - my $Plotted_Str ; - unless (defined $Graph_Obj) { - return (undef, "") ; - } else { - if ($Graphic_Mode =~ m/png/i) { - $Plotted_Str = $Graph_Obj -> png ; - } elsif ($Graphic_Mode =~ m/gif/i) { - $Plotted_Str = $Graph_Obj -> gif ; - } else { - return ($Graphic_Mode, "Unsupported Graphical Mode $Graph_Obj.\n") ; - } - } - return ($Graph_Obj, $Plotted_Str) ; -} - - -sub Build_Labeled_X_Axis_Graph_Obj { - my ($Data_In, $Legend, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_label_position, $y_label_position, $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $overwrite, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols ) = @_ ; - # $colorscheme is a colon seperated string of colors. - my $HBI_Debug_Obj = 0 ; - my $Data_In_sublist ; my $Data_In_cnt = 0 ; - - if ($HBI_Debug_Obj) { - warn "INFO: " . __FILE__ . " Legend array len is $#{$Legend}.\n" ; - foreach $Data_In_sublist (@{$Data_In}) { - warn "INFO: Data array len is $#{$Data_In_sublist}.\n" ; - $Data_In_cnt ++ ; - } - warn "INFO: Data array $Data_In_cnt elements.\n" ; - } - - my $graph; - if ($hbar) { - #print STDERR "hbar set\n"; - $graph = GD::Graph::hbars->new($xdim,$ydim); - } else { - $graph = GD::Graph::bars->new($xdim,$ydim); - #print STDERR "hbar not set\n"; - } - my @ret_colour_names_avail = () ; - my %valid_colour_name = () ; - @ret_colour_names_avail = GD::Graph::colour::colour_list(59) ; - for my $clr_name (@ret_colour_names_avail) { - if (defined $clr_name) {$valid_colour_name{$clr_name} = 1;} - } - -# The keys of the hash array valid_colour_name are the known color names. - -# warn $full_colour_list ; -# warn "The number of colours is $#ret_colour_names_avail ." ; -# The colors I found at one time are: pink lbrown lred purple -# dblue lpurple green white gold blue dyellow red lgreen marine -# dred cyan yellow lblue orange lgray dgreen dbrown lyellow -# black gray dpink dgray lorange dpurple - -# Set blue yellow if the colorscheme parameter is 1. -# else use the default. -if ($colorscheme and $colorscheme ==1) { - $graph->set( dclrs => [ qw(blue yellow) ] ); -} elsif ($colorscheme) { - my @new_colors = split /:/ , $colorscheme ; - my $index = 0 ; - my $colors = $graph->get('dclrs'); - my $color ; - foreach $color (@new_colors) { - if ($valid_colour_name{$color} ) { - # warn "Pushed $color ." ; - $colors->[$index] = $color ; - $index ++ ; - } else { - warn "Invalid color $color requested." ; - } - } - # warn "Setting dclrs." ; - $graph->set( dclrs => $colors) ; - # warn "Set dclrs." ; -} - - -my %opt = ('transparent' => 0, - 'x_label_position' => 0.5, - 'show_values' => 1, - 'y_max_value' => 100, - 'overwrite' => 0); -if ($title) {$opt{'title'} = $title;} -if ($xlabel) {$opt{'x_label'} = $xlabel;} -if ($ylabel) {$opt{'y_label'} = $ylabel;} -if ($ymax) {$opt{'y_max_value'} = $ymax;} -if ($ymin) {$opt{'y_min_value'} = $ymin;} -if ($t_margin) {$opt{'t_margin'} = $t_margin;} -if ($b_margin) {$opt{'b_margin'} = $b_margin;} -if ($l_margin) {$opt{'l_margin'} = $l_margin;} -if ($r_margin) {$opt{'r_margin'} = $r_margin;} -if ($yticknum) {$opt{'y_tick_number'} = $yticknum;} -if ($bar_spacing) {$opt{'bar_spacing'} = $bar_spacing;} -if ($bargroup_spacing) {$opt{'bargroup_spacing'} = $bargroup_spacing;} -if ($show_values) {$opt{'show_values'} = $show_values;} -if ($x_label_position) {$opt{'x_label_position'} = $x_label_position;} -if ($y_label_position) {$opt{'y_label_position'} = $y_label_position;} -if ($transparent) {$opt{'transparent'} = $transparent;} -if ($overwrite) {$opt{'overwrite'} = $overwrite;} -if ($interlaced) {$opt{'interlaced'} = $interlaced;} -if ($bgclr) {$opt{'bgclr'} = $bgclr;} -if ($fgclr) {$opt{'fgclr'} = $fgclr;} -if ($boxclr) {$opt{'boxclr'} = $boxclr;} -if ($accentclr) {$opt{'accentclr'} = $accentclr;} -if ($shadowclr) {$opt{'shadowclr'} = $shadowclr;} -if ($shadow_depth) {$opt{'shadow_depth'} = $shadow_depth;} -if ($labelclr) {$opt{'labelclr'} = $labelclr ;} -if ($axislabelclr) {$opt{'axislabelclr'} = $axislabelclr ;} -if ($legendclr) {$opt{'legendclr'} = $legendclr ;} -if ($valuesclr) {$opt{'valuesclr'} = $valuesclr ;} -if ($textclr) {$opt{'textclr'} = $textclr ;} -if ($dclrs) {$opt{'dclrs'} = $dclrs ;} -if ($borderclrs) {$opt{'borderclrs'} = $borderclrs ;} -if ($cycle_clrs) {$opt{'cycle_clrs'} = $cycle_clrs ;} -if ($accent_treshold) {$opt{'accent_treshold'} = $accent_treshold ;} -if ($long_ticks) {$opt{'long_ticks'} = $long_ticks ;} -if ($tick_length) {$opt{'tick_length'} = $tick_length ;} -if ($x_ticks) {$opt{'x_ticks'} = $x_ticks ;} -if ($y_number_format) {$opt{'y_number_format'} = $y_number_format ;} -if ($x_label_skip) {$opt{'x_label_skip'} = $x_label_skip ;} -if ($y_label_skip) {$opt{'y_label_skip'} = $y_label_skip ;} -if ($x_last_label_skip) {$opt{'x_last_label_skip'} = $x_last_label_skip ;} -if ($x_tick_offset) {$opt{'x_tick_offset'} = $x_tick_offset ;} -if ($x_all_ticks) {$opt{'x_all_ticks'} = $x_all_ticks ;} -if ($x_label_position) {$opt{'x_label_position'} = $x_label_position ;} -if ($y_label_position) {$opt{'y_label_position'} = $y_label_position ;} -if ($x_labels_vertical) {$opt{'x_labels_vertical'} = $x_labels_vertical ;} -if ($x_plot_values) {$opt{'x_plot_values'} = $x_plot_values ;} -if ($y_plot_values) {$opt{'y_plot_values'} = $y_plot_values ;} -if ($box_axis) {$opt{'box_axis'} = $box_axis ;} -if ($no_axes) {$opt{'no_axes'} = $no_axes ;} -if ($two_axes) {$opt{'two_axes'} = $two_axes ;} -if ($use_axis) {$opt{'use_axis'} = $use_axis ;} -if ($zero_axis) {$opt{'zero_axis'} = $zero_axis ;} -if ($zero_axis_only) {$opt{'zero_axis_only'} = $zero_axis_only ;} -if ($axis_space) {$opt{'axis_space'} = $axis_space ;} -if ($text_space) {$opt{'text_space'} = $text_space ;} -if ($cumulate) {$opt{'cumulate'} = $cumulate ;} -if ($overwrite) {$opt{'overwrite'} = $overwrite ;} -if ($correct_width) {$opt{'correct_width'} = $correct_width ;} -if ($values_vertical) {$opt{'values_vertical'} = $values_vertical ;} -if ($values_space) {$opt{'values_space'} = $values_space ;} -if ($values_format) {$opt{'values_format'} = $values_format ;} -if ($legend_placement) {$opt{'legend_placement'} = $legend_placement ;} -if ($legend_marker_width) {$opt{'legend_marker_width'} = $legend_marker_width ;} -if ($legend_marker_height) {$opt{'legend_marker_height'} = $legend_marker_height ;} -if ($lg_cols) {$opt{'lg_cols'} = $lg_cols ;} - -if ((defined $Legend) && (ref($Legend) eq "ARRAY") && ($#{${Legend}} >= 0)) { - $graph -> set_legend(@{$Legend}) ; -} else { - warn "ERROR: Empty Legend array passed to XXX." ; -} - -$graph->set(%opt) or die $graph->error; -$graph->set_title_font(gdGiantFont); -$graph->set_x_label_font(gdGiantFont); -$graph->set_y_label_font(gdGiantFont); -$graph->set_x_axis_font(gdGiantFont); -$graph->set_y_axis_font(gdGiantFont); -$graph->set_values_font(gdGiantFont); -$graph->set_legend_font(gdGiantFont); - -my $gd = $graph->plot($Data_In) ; - -return $gd - -} - -1 ; - diff --git a/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140131 b/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140131 deleted file mode 100755 index de717b5f6..000000000 --- a/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140131 +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/perl -w -# -# $Id: bargraph_multi.pm -# - -use strict; -package bargraph_multi ; -require Exporter ; -@bargraph_multi::ISA = qw(Exporter) ; -@bargraph_multi::EXPORT = qw(Build_Labeled_X_Axis_Graph_Str Build_Labeled_X_Axis_Graph_Obj) ; -@bargraph_multi::EXPORT_OK = qw( ) ; -use GD; -use GD::Graph::colour; -use GD::Graph::bars; -use GD::Graph::hbars; -use GD::Graph::bars3d; -#use Data::Dumper; - -# This perl code is builds Graphs using the GD::Graph modules. -# This code deals with a non-numeric X-Axis. Each tick on the X-Axis is the name of a group. -# The other style has a numeric X-Axis. -sub Build_Labeled_X_Axis_Graph_Str { -# The parameters are: -# $Data_In - A reference to a list of lists. (aka, Array of Arrays) -# Each of the sublists has the same number of elements. -# An element might be the undef value. -# The first sublist is the names of the groups. -# The other sublists are related to the elements in the $Legend parameter. -# $Legend - A reference to a list. -# Each element of the list is the name of a group. -# The data for each group is a sublist in the $Data_In parameter. -# ---- The rest of the parameters are individual options as scalars: numbers, character strings, or undef. -# The returned value is a list of (reference to the plotted graphical object, and graphic string in the mode. - my ($Data_In, $Legend, $Graphic_Mode, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols - ) = @_ ; - my $Graph_Obj ; - $Graph_Obj = &Build_Labeled_X_Axis_Graph_Obj - ($Data_In, $Legend, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols ) ; - my $Plotted_Str ; - unless (defined $Graph_Obj) { - return (undef, "") ; - } else { - if ($Graphic_Mode =~ m/png/i) { - $Plotted_Str = $Graph_Obj -> png ; - } elsif ($Graphic_Mode =~ m/gif/i) { - $Plotted_Str = $Graph_Obj -> gif ; - } else { - return ($Graphic_Mode, "Unsupported Graphical Mode $Graph_Obj.\n") ; - } - } - return ($Graph_Obj, $Plotted_Str) ; -} - - -sub Build_Labeled_X_Axis_Graph_Obj { - my ($Data_In, $Legend, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols ) = @_ ; - # $colorscheme is a colon seperated string of colors. - my $HBI_Debug_Obj = 0 ; - my $Data_In_sublist ; my $Data_In_cnt = 0 ; - - if ($HBI_Debug_Obj) { - warn "INFO: " . __FILE__ . " Legend array len is $#{$Legend}.\n" ; - foreach $Data_In_sublist (@{$Data_In}) { - warn "INFO: Data array len is $#{$Data_In_sublist}.\n" ; - $Data_In_cnt ++ ; - } - warn "INFO: Data array $Data_In_cnt elements.\n" ; - } - - my $graph; - if ($hbar) { - #print STDERR "hbar set\n"; - $graph = GD::Graph::hbars->new($xdim,$ydim); - } else { - $graph = GD::Graph::bars->new($xdim,$ydim); - #print STDERR "hbar not set\n"; - } - my @ret_colour_names_avail = () ; - my %valid_colour_name = () ; - @ret_colour_names_avail = GD::Graph::colour::colour_list(59) ; - for my $clr_name (@ret_colour_names_avail) { - if (defined $clr_name) {$valid_colour_name{$clr_name} = 1;} - } - -# The keys of the hash array valid_colour_name are the known color names. - -# warn $full_colour_list ; -# warn "The number of colours is $#ret_colour_names_avail ." ; -# The colors I found at one time are: pink lbrown lred purple -# dblue lpurple green white gold blue dyellow red lgreen marine -# dred cyan yellow lblue orange lgray dgreen dbrown lyellow -# black gray dpink dgray lorange dpurple - -# Set blue yellow if the colorscheme parameter is 1. -# else use the default. -if ($colorscheme and $colorscheme ==1) { - $graph->set( dclrs => [ qw(blue yellow) ] ); -} elsif ($colorscheme) { - my @new_colors = split /:/ , $colorscheme ; - my $index = 0 ; - my $colors = $graph->get('dclrs'); - my $color ; - foreach $color (@new_colors) { - if ($valid_colour_name{$color} ) { - # warn "Pushed $color ." ; - $colors->[$index] = $color ; - $index ++ ; - } else { - warn "Invalid color $color requested." ; - } - } - # warn "Setting dclrs." ; - $graph->set( dclrs => $colors) ; - # warn "Set dclrs." ; -} - - -my %opt = ('transparent' => 0, - 'x_label_position' => 0.5, - 'show_values' => 1, - 'y_max_value' => 100, - 'overwrite' => 0); -if ($title) {$opt{'title'} = $title;} -if ($xlabel) {$opt{'x_label'} = $xlabel;} -if ($ylabel) {$opt{'y_label'} = $ylabel;} -if ($ymax) {$opt{'y_max_value'} = $ymax;} -if ($ymin) {$opt{'y_min_value'} = $ymin;} -if ($t_margin) {$opt{'t_margin'} = $t_margin;} -if ($b_margin) {$opt{'b_margin'} = $b_margin;} -if ($l_margin) {$opt{'l_margin'} = $l_margin;} -if ($r_margin) {$opt{'r_margin'} = $r_margin;} -if ($yticknum) {$opt{'y_tick_number'} = $yticknum;} -if ($bar_spacing) {$opt{'bar_spacing'} = $bar_spacing;} -if ($bargroup_spacing) {$opt{'bargroup_spacing'} = $bargroup_spacing;} -if ($show_values) {$opt{'show_values'} = $show_values;} -if ($x_label_position) {$opt{'x_label_position'} = $x_label_position;} -if ($y_label_position) {$opt{'y_label_position'} = $y_label_position;} -if ($transparent) {$opt{'transparent'} = $transparent;} -if ($overwrite) {$opt{'overwrite'} = $overwrite;} -if ($interlaced) {$opt{'interlaced'} = $interlaced;} -if ($bgclr) {$opt{'bgclr'} = $bgclr;} -if ($fgclr) {$opt{'fgclr'} = $fgclr;} -if ($boxclr) {$opt{'boxclr'} = $boxclr;} -if ($accentclr) {$opt{'accentclr'} = $accentclr;} -if ($shadowclr) {$opt{'shadowclr'} = $shadowclr;} -if ($shadow_depth) {$opt{'shadow_depth'} = $shadow_depth;} -if ($labelclr) {$opt{'labelclr'} = $labelclr ;} -if ($axislabelclr) {$opt{'axislabelclr'} = $axislabelclr ;} -if ($legendclr) {$opt{'legendclr'} = $legendclr ;} -if ($valuesclr) {$opt{'valuesclr'} = $valuesclr ;} -if ($textclr) {$opt{'textclr'} = $textclr ;} -if ($dclrs) {$opt{'dclrs'} = $dclrs ;} -if ($borderclrs) {$opt{'borderclrs'} = $borderclrs ;} -if ($cycle_clrs) {$opt{'cycle_clrs'} = $cycle_clrs ;} -if ($accent_treshold) {$opt{'accent_treshold'} = $accent_treshold ;} -if ($long_ticks) {$opt{'long_ticks'} = $long_ticks ;} -if ($tick_length) {$opt{'tick_length'} = $tick_length ;} -if ($x_ticks) {$opt{'x_ticks'} = $x_ticks ;} -if ($y_number_format) {$opt{'y_number_format'} = $y_number_format ;} -if ($x_label_skip) {$opt{'x_label_skip'} = $x_label_skip ;} -if ($y_label_skip) {$opt{'y_label_skip'} = $y_label_skip ;} -if ($x_last_label_skip) {$opt{'x_last_label_skip'} = $x_last_label_skip ;} -if ($x_tick_offset) {$opt{'x_tick_offset'} = $x_tick_offset ;} -if ($x_all_ticks) {$opt{'x_all_ticks'} = $x_all_ticks ;} -if ($x_label_position) {$opt{'x_label_position'} = $x_label_position ;} -if ($y_label_position) {$opt{'y_label_position'} = $y_label_position ;} -if ($x_labels_vertical) {$opt{'x_labels_vertical'} = $x_labels_vertical ;} -if ($x_plot_values) {$opt{'x_plot_values'} = $x_plot_values ;} -if ($y_plot_values) {$opt{'y_plot_values'} = $y_plot_values ;} -if ($box_axis) {$opt{'box_axis'} = $box_axis ;} -if ($no_axes) {$opt{'no_axes'} = $no_axes ;} -if ($two_axes) {$opt{'two_axes'} = $two_axes ;} -if ($use_axis) {$opt{'use_axis'} = $use_axis ;} -if ($zero_axis) {$opt{'zero_axis'} = $zero_axis ;} -if ($zero_axis_only) {$opt{'zero_axis_only'} = $zero_axis_only ;} -if ($axis_space) {$opt{'axis_space'} = $axis_space ;} -if ($text_space) {$opt{'text_space'} = $text_space ;} -if ($cumulate) {$opt{'cumulate'} = $cumulate ;} -if ($overwrite) {$opt{'overwrite'} = $overwrite ;} -if ($correct_width) {$opt{'correct_width'} = $correct_width ;} -if ($values_vertical) {$opt{'values_vertical'} = $values_vertical ;} -if ($values_space) {$opt{'values_space'} = $values_space ;} -if ($values_format) {$opt{'values_format'} = $values_format ;} -if ($legend_placement) {$opt{'legend_placement'} = $legend_placement ;} -if ($legend_marker_width) {$opt{'legend_marker_width'} = $legend_marker_width ;} -if ($legend_marker_height) {$opt{'legend_marker_height'} = $legend_marker_height ;} -if ($lg_cols) {$opt{'lg_cols'} = $lg_cols ;} - -if ((defined $Legend) && (ref($Legend) eq "ARRAY") && ($#{${Legend}} >= 0)) { - $graph -> set_legend(@{$Legend}) ; -} else { - warn "ERROR: Empty Legend array passed to XXX." ; -} - -$graph->set(%opt) or die $graph->error; -$graph->set_title_font(gdGiantFont); -$graph->set_x_label_font(gdGiantFont); -$graph->set_y_label_font(gdGiantFont); -$graph->set_x_axis_font(gdGiantFont); -$graph->set_y_axis_font(gdGiantFont); -$graph->set_values_font(gdGiantFont); -$graph->set_legend_font(gdGiantFont); - -my $gd = $graph->plot($Data_In) ; - -return $gd - -} - -1 ; - diff --git a/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140207 b/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140207 deleted file mode 100755 index 8241afea2..000000000 --- a/survey-nginx/cgi-bin/bargraph_multi.pm.bu20140207 +++ /dev/null @@ -1,464 +0,0 @@ -#!/usr/bin/perl -w -# -# $Id: bargraph_multi.pm -# - -use strict; -use diagnostics ; -package bargraph_multi ; -use Exporter () ; -@bargraph_multi::ISA = qw(Exporter) ; -@bargraph_multi::EXPORT = qw(Build_Labeled_X_Axis_Graph_Str Build_Labeled_X_Axis_Graph_Obj - Build_Labeled_X_Axis_Graph_Obj_opts Build_Labeled_X_Axis_Graph_Str_opts ) ; -@bargraph_multi::EXPORT_OK = qw( ) ; -use GD; -use GD::Graph::colour; -use GD::Graph::bars; -use GD::Graph::hbars; -use GD::Graph::bars3d; -#use Data::Dumper; - - - -# This perl code is builds Graphs using the GD::Graph modules. -# This code deals with a non-numeric X-Axis. Each tick on the X-Axis is the name of a group. -# The other style has a numeric X-Axis. -sub Build_Labeled_X_Axis_Graph_Str { -# The parameters are: -# $Data_In - A reference to a list of lists. (aka, Array of Arrays) -# Each of the sublists has the same number of elements. -# An element might be the undef value. -# The first sublist is the names of the groups. -# The other sublists are related to the elements in the $Legend parameter. -# $Legend - A reference to a list. -# Each element of the list is the name of a group. -# The data for each group is a sublist in the $Data_In parameter. -# ---- The rest of the parameters are individual options as scalars: numbers, character strings, or undef. -# The returned value is a list of (reference to the plotted graphical object, and graphic string in the mode. - my ($Data_In, $Legend, $Graphic_Mode, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols - ) = @_ ; - my $Graph_Obj ; - $Graph_Obj = &Build_Labeled_X_Axis_Graph_Obj - ($Data_In, $Legend, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols ) ; - my $Plotted_Str ; - unless (defined $Graph_Obj) { - return (undef, "") ; - } else { - if ($Graphic_Mode =~ m/png/i) { - $Plotted_Str = $Graph_Obj -> png ; - } elsif ($Graphic_Mode =~ m/gif/i) { - $Plotted_Str = $Graph_Obj -> gif ; - } else { - return ($Graphic_Mode, "Unsupported Graphical Mode $Graph_Obj.\n") ; - } - } - return ($Graph_Obj, $Plotted_Str) ; -} - - -sub Build_Labeled_X_Axis_Graph_Obj { - my ($Data_In, $Legend, $xdim, $ydim, $hbar, $title, $xlabel, $ylabel, - $ymax, $ymin, $yticknum, $t_margin, $b_margin, $l_margin, $r_margin, - $colorscheme, $bar_spacing, $bargroup_spacing, - $show_values, $x_label_position, $y_label_position, $transparent, $overwrite, - $interlaced, $bgclr, $fgclr, $boxclr, $accentclr, $shadowclr, $shadow_depth, - $labelclr, $axislabelclr, $legendclr, $valuesclr, $textclr, $dclrs, $borderclrs, - $cycle_clrs, $accent_treshold, $long_ticks, $tick_length, $x_ticks, $y_number_format, - $x_label_skip, $y_label_skip, $x_last_label_skip, $x_tick_offset, $x_all_ticks, - $x_labels_vertical, $x_plot_values, $y_plot_values, - $box_axis, $no_axes, $two_axes, $use_axis, $zero_axis, $zero_axis_only, $axis_space, - $text_space, $cumulate, $correct_width, $values_vertical, $values_space, - $values_format, $legend_placement, $legend_marker_width, $legend_marker_height, $lg_cols ) = @_ ; - # $colorscheme is a colon seperated string of colors. - my $HBI_Debug_Obj = 0 ; - my $Data_In_sublist ; my $Data_In_cnt = 0 ; - - if ($HBI_Debug_Obj) { - warn "INFO: " . __FILE__ . " Parm List Legend array len is $#{$Legend}.\n" ; - foreach $Data_In_sublist (@{$Data_In}) { - warn "INFO: Data array len is $#{$Data_In_sublist}.\n" ; - $Data_In_cnt ++ ; - } - warn "INFO: Data array $Data_In_cnt elements.\n" ; - } - - my $graph; - if ($hbar) { - #print STDERR "hbar set\n"; - $graph = GD::Graph::hbars->new($xdim,$ydim); - } else { - $graph = GD::Graph::bars->new($xdim,$ydim); - #print STDERR "hbar not set\n"; - } - my @ret_colour_names_avail = () ; - my %valid_colour_name = () ; - @ret_colour_names_avail = GD::Graph::colour::colour_list(59) ; - for my $clr_name (@ret_colour_names_avail) { - if (defined $clr_name) {$valid_colour_name{$clr_name} = 1;} - } - -# The keys of the hash array valid_colour_name are the known color names. - -# warn $full_colour_list ; -# warn "The number of colours is $#ret_colour_names_avail ." ; -# The colors I found at one time are: pink lbrown lred purple -# dblue lpurple green white gold blue dyellow red lgreen marine -# dred cyan yellow lblue orange lgray dgreen dbrown lyellow -# black gray dpink dgray lorange dpurple - -# Set blue yellow if the colorscheme parameter is 1. -# else use the default. -if ($colorscheme and $colorscheme ==1) { - $graph->set( dclrs => [ qw(blue yellow) ] ); -} elsif ($colorscheme) { - my @new_colors = split /:/ , $colorscheme ; - my $index = 0 ; - my $colors = $graph->get('dclrs'); - my $color ; - foreach $color (@new_colors) { - if ($valid_colour_name{$color} ) { - # warn "Pushed $color ." ; - $colors->[$index] = $color ; - $index ++ ; - } else { - warn "Invalid color $color requested." ; - } - } - # warn "Setting dclrs." ; - $graph->set( dclrs => $colors) ; - # warn "Set dclrs." ; -} - - -my %opt = ('transparent' => 0, - 'x_label_position' => 0.5, - 'show_values' => 1, - 'y_max_value' => 100, - 'overwrite' => 0); -if ($title) {$opt{'title'} = $title;} -if ($xlabel) {$opt{'x_label'} = $xlabel;} -if ($ylabel) {$opt{'y_label'} = $ylabel;} -if ($ymax) {$opt{'y_max_value'} = $ymax;} -if ($ymin) {$opt{'y_min_value'} = $ymin;} -if ($t_margin) {$opt{'t_margin'} = $t_margin;} -if ($b_margin) {$opt{'b_margin'} = $b_margin;} -if ($l_margin) {$opt{'l_margin'} = $l_margin;} -if ($r_margin) {$opt{'r_margin'} = $r_margin;} -if ($yticknum) {$opt{'y_tick_number'} = $yticknum;} -if ($bar_spacing) {$opt{'bar_spacing'} = $bar_spacing;} -if ($bargroup_spacing) {$opt{'bargroup_spacing'} = $bargroup_spacing;} -if ($show_values) {$opt{'show_values'} = $show_values;} -if ($x_label_position) {$opt{'x_label_position'} = $x_label_position;} -if ($y_label_position) {$opt{'y_label_position'} = $y_label_position;} -if ($transparent) {$opt{'transparent'} = $transparent;} -if ($overwrite) {$opt{'overwrite'} = $overwrite;} -if ($interlaced) {$opt{'interlaced'} = $interlaced;} -if ($bgclr) {$opt{'bgclr'} = $bgclr;} -if ($fgclr) {$opt{'fgclr'} = $fgclr;} -if ($boxclr) {$opt{'boxclr'} = $boxclr;} -if ($accentclr) {$opt{'accentclr'} = $accentclr;} -if ($shadowclr) {$opt{'shadowclr'} = $shadowclr;} -if ($shadow_depth) {$opt{'shadow_depth'} = $shadow_depth;} -if ($labelclr) {$opt{'labelclr'} = $labelclr ;} -if ($axislabelclr) {$opt{'axislabelclr'} = $axislabelclr ;} -if ($legendclr) {$opt{'legendclr'} = $legendclr ;} -if ($valuesclr) {$opt{'valuesclr'} = $valuesclr ;} -if ($textclr) {$opt{'textclr'} = $textclr ;} -if ($dclrs) {$opt{'dclrs'} = $dclrs ;} -if ($borderclrs) {$opt{'borderclrs'} = $borderclrs ;} -if ($cycle_clrs) {$opt{'cycle_clrs'} = $cycle_clrs ;} -if ($accent_treshold) {$opt{'accent_treshold'} = $accent_treshold ;} -if ($long_ticks) {$opt{'long_ticks'} = $long_ticks ;} -if ($tick_length) {$opt{'tick_length'} = $tick_length ;} -if ($x_ticks) {$opt{'x_ticks'} = $x_ticks ;} -if ($y_number_format) {$opt{'y_number_format'} = $y_number_format ;} -if ($x_label_skip) {$opt{'x_label_skip'} = $x_label_skip ;} -if ($y_label_skip) {$opt{'y_label_skip'} = $y_label_skip ;} -if ($x_last_label_skip) {$opt{'x_last_label_skip'} = $x_last_label_skip ;} -if ($x_tick_offset) {$opt{'x_tick_offset'} = $x_tick_offset ;} -if ($x_all_ticks) {$opt{'x_all_ticks'} = $x_all_ticks ;} -if ($x_label_position) {$opt{'x_label_position'} = $x_label_position ;} -if ($y_label_position) {$opt{'y_label_position'} = $y_label_position ;} -if ($x_labels_vertical) {$opt{'x_labels_vertical'} = $x_labels_vertical ;} -if ($x_plot_values) {$opt{'x_plot_values'} = $x_plot_values ;} -if ($y_plot_values) {$opt{'y_plot_values'} = $y_plot_values ;} -if ($box_axis) {$opt{'box_axis'} = $box_axis ;} -if ($no_axes) {$opt{'no_axes'} = $no_axes ;} -if ($two_axes) {$opt{'two_axes'} = $two_axes ;} -if ($use_axis) {$opt{'use_axis'} = $use_axis ;} -if ($zero_axis) {$opt{'zero_axis'} = $zero_axis ;} -if ($zero_axis_only) {$opt{'zero_axis_only'} = $zero_axis_only ;} -if ($axis_space) {$opt{'axis_space'} = $axis_space ;} -if ($text_space) {$opt{'text_space'} = $text_space ;} -if ($cumulate) {$opt{'cumulate'} = $cumulate ;} -if ($overwrite) {$opt{'overwrite'} = $overwrite ;} -if ($correct_width) {$opt{'correct_width'} = $correct_width ;} -if ($values_vertical) {$opt{'values_vertical'} = $values_vertical ;} -if ($values_space) {$opt{'values_space'} = $values_space ;} -if ($values_format) {$opt{'values_format'} = $values_format ;} -if ($legend_placement) {$opt{'legend_placement'} = $legend_placement ;} -if ($legend_marker_width) {$opt{'legend_marker_width'} = $legend_marker_width ;} -if ($legend_marker_height) {$opt{'legend_marker_height'} = $legend_marker_height ;} -if ($lg_cols) {$opt{'lg_cols'} = $lg_cols ;} - -if ((defined $Legend) && (ref($Legend) eq "ARRAY") && ($#{${Legend}} >= 0)) { - $graph -> set_legend(@{$Legend}) ; -} else { - warn "ERROR: Empty Legend array passed to XXX." ; -} - -$graph->set(%opt) or die $graph->error; -$graph->set_title_font(gdGiantFont); -$graph->set_x_label_font(gdGiantFont); -$graph->set_y_label_font(gdGiantFont); -$graph->set_x_axis_font(gdGiantFont); -$graph->set_y_axis_font(gdGiantFont); -$graph->set_values_font(gdGiantFont); -$graph->set_legend_font(gdGiantFont); - -my $gd = $graph->plot($Data_In) ; - -return $gd - -} - -# This perl code is builds Graphs using the GD::Graph modules. -# This code deals with a non-numeric X-Axis. Each tick on the X-Axis is the name of a group. -# The other style has a numeric X-Axis. -sub Build_Labeled_X_Axis_Graph_Str_opts { -# The parameters are: -# $Data_In - A reference to a list of lists. (aka, Array of Arrays) -# Each of the sublists has the same number of elements. -# An element might be the undef value. -# The first sublist is the names of the groups. -# The other sublists are related to the elements in the $Legend parameter. -# $Legend - A reference to a list. -# $opts - A reference to a hash array of parameters. -# We use the standard options for the GRAPH package. -# We add Graphic_Mode for PNG or GIF. -# We add the fonts to use for text. The default font is a large font. -# The returned value is a list of (reference to the plotted graphical object, and graphic string in the mode. - my ($Data_In, $Legend, $opts) = @_ ; - my $Graph_Obj ; - $Graph_Obj = &Build_Labeled_X_Axis_Graph_Obj_opts ($Data_In, $Legend, $opts) ; - my $Graphic_Mode = $opts->{'Graphic_Mode'} ; - unless (defined $Graphic_Mode) {$Graphic_Mode = "png" ;} - my $Graphic_Mode_ref = ref $Graphic_Mode ; - if ($Graphic_Mode_ref) { - return ($Graph_Obj, "Unsupported Reference Graphical Mode $Graphic_Mode_ref.\n") ; - } - my $Plotted_Str ; - unless (defined $Graph_Obj) { - return (undef, "") ; - } else { - if ($Graphic_Mode =~ m/png/i) { - $Plotted_Str = $Graph_Obj -> png ; - } elsif ($Graphic_Mode =~ m/gif/i) { - $Plotted_Str = $Graph_Obj -> gif ; - } else { - return ($Graph_Obj, "Unsupported Graphical Mode $Graphic_Mode.\n") ; - } - } - return ($Graph_Obj, $Plotted_Str) ; -} - -sub Build_Labeled_X_Axis_Graph_Obj_opts { - my ($Data_In, $Legend, $opts ) = @_ ; - # $colorscheme is a colon seperated string of colors. - my $HBI_Debug_Obj = 0 ; - my $Data_In_sublist ; my $Data_In_cnt = 0 ; - - if ($HBI_Debug_Obj) { - warn "INFO: " . __FILE__ . " Opts Legend array len is $#{$Legend}.\n" ; - foreach $Data_In_sublist (@{$Data_In}) { - warn "INFO: Data array len is $#{$Data_In_sublist}.\n" ; - warn "Info: Elements " . join(" ", @{$Data_In_sublist}) . " X" ; - $Data_In_cnt ++ ; - } - warn "INFO: Data array $Data_In_cnt elements.\n" ; - if (defined $Data_In) { - my $Data_In_ref = ref $Data_In ; - if ($Data_In_ref) { - warn "INFO: Data_In is a reference to a $Data_In_ref \n" ; - } else { - warn "INFO: Data_In is a scalar $Data_In \n" ; - } - } else { - warn "ERROR: Data_In is not defined." ; - } - } - my $hbar = $opts->{'hbar'} ; - my $xdim = $opts->{'width'} ; - my $ydim = $opts->{'height'} ; - warn "INFO: hbar $hbar xdim $xdim ydim $ydim X" if ($HBI_Debug_Obj) ; - my $graph; - if ($hbar) { - #print STDERR "hbar set\n"; - $graph = GD::Graph::hbars->new($xdim,$ydim); - } else { - $graph = GD::Graph::bars->new($xdim,$ydim); - #print STDERR "hbar not set\n"; - } - - if ($HBI_Debug_Obj) { - if (defined $graph) { - my $graph_ref = ref $graph ; - if ($graph_ref) { - warn "INFO: graph is a reference to a $graph_ref \n" ; - } else { - warn "INFO: graph is a scalar $graph \n" ; - } - } else { - warn "ERROR: graph is not defined." ; - } - } - - my @ret_colour_names_avail = () ; - my %valid_colour_name = () ; - @ret_colour_names_avail = GD::Graph::colour::colour_list(59) ; - for my $clr_name (@ret_colour_names_avail) { - if (defined $clr_name) {$valid_colour_name{$clr_name} = 1;} - } - -# The keys of the hash array valid_colour_name are the known color names. - -# warn $full_colour_list ; -# warn "The number of colours is $#ret_colour_names_avail ." ; -# The colors I found at one time are: pink lbrown lred purple -# dblue lpurple green white gold blue dyellow red lgreen marine -# dred cyan yellow lblue orange lgray dgreen dbrown lyellow -# black gray dpink dgray lorange dpurple - -# Set blue yellow if the colorscheme parameter is 1. -# else use the default. - my $colorscheme = $opts->{'colorscheme'} ; - if ((defined $colorscheme) and ($colorscheme eq 1)) { - $graph->set( dclrs => [ qw(blue yellow) ] ); - } elsif ($colorscheme) { - my @new_colors = split /:/ , $colorscheme ; - my $index = 0 ; - my $colors = $graph->get('dclrs'); - my $color ; - foreach $color (@new_colors) { - if ($valid_colour_name{$color} ) { - # warn "Pushed $color ." ; - $colors->[$index] = $color ; - $index ++ ; - } else { - warn "Invalid color $color requested." ; - } - } - # warn "Setting dclrs." ; - $graph->set( dclrs => $colors) ; - # warn "Set dclrs." ; - } - - if ((defined $Legend) && (ref($Legend) eq "ARRAY") && ($#{${Legend}} >= 0)) { - $graph -> set_legend(@{$Legend}) ; - } else { - warn "ERROR: Empty Legend array passed to XXX." ; - } - - my %G_Opts = () ; - my $key ; - foreach $key (keys %{$opts}) { - $G_Opts{$key} = $opts->{$key} ; - } - delete $G_Opts{'colorscheme'} ; - delete $G_Opts{'hbar'} ; - delete $G_Opts{'Graphic_Mode'} ; - delete $G_Opts{'width'} ; - delete $G_Opts{'height'} ; - - unless ($graph->set(%G_Opts)) { - warn "ERROR: graph->set complained" ; - warn $graph->error; - } - my $use_font ; - $use_font = $opts->{'title_font'} ; - if (defined $use_font) { - $graph->set_title_font($use_font); - } else { - $graph->set_title_font(gdGiantFont); - } - $use_font = $opts->{'x_label_font'} ; - if (defined $use_font) { - $graph->set_x_label_font($use_font); - } else { - $graph->set_x_label_font(gdGiantFont); - } - $use_font = $opts->{'y_label_font'} ; - if (defined $use_font) { - $graph->set_y_label_font($use_font); - } else { - $graph->set_y_label_font(gdGiantFont); - } - $use_font = $opts->{'x_axis_font'} ; - if (defined $use_font) { - $graph->set_x_axis_font($use_font); - } else { - $graph->set_x_axis_font(gdGiantFont); - } - $use_font = $opts->{'y_axis_font'} ; - if (defined $use_font) { - $graph->set_y_axis_font($use_font); - } else { - $graph->set_y_axis_font(gdGiantFont); - } - $use_font = $opts->{'values_font'} ; - if (defined $use_font) { - $graph->set_values_font($use_font); - } else { - $graph->set_values_font(gdGiantFont); - } - $use_font = $opts->{'legend_font'} ; - if (defined $use_font) { - $graph->set_legend_font($use_font); - } else { - $graph->set_legend_font(gdGiantFont); - } - - # my $gd = $graph->plot(@{$Data_In}) ; # rejected. Bad Data - my $gd = $graph->plot($Data_In) ; - - if ($HBI_Debug_Obj) { - if (defined $gd) { - my $gd_ref = ref $gd ; - if ($gd_ref) { - warn "INFO: gd is a reference to a $gd_ref \n" ; - } else { - warn "INFO: gd is a scalar $gd \n" ; - } - } else { - warn "ERROR: gd is not defined." ; - warn "ERROR: graph error is " . $graph->error ; - } - } - - return $gd -} - -1 ; - diff --git a/survey-nginx/cgi-bin/creports.pl.bu20120228 b/survey-nginx/cgi-bin/creports.pl.bu20120228 deleted file mode 100755 index b4330c6ed..000000000 --- a/survey-nginx/cgi-bin/creports.pl.bu20120228 +++ /dev/null @@ -1,1894 +0,0 @@ -#!/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 - -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 (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 "\n"; - print "\n"; - print " - -\n"; - print "\n"; - } - } - } -} - -close(STDOUT); - -sub show_frames { - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; -} - -sub show_frames_001 { - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\t\n"; - print "\t\n"; - print "\t\n"; - print "\t\n"; - print "\n"; - print "\n"; -} - - -sub show_frames_002 { - print "\n"; - print "\n"; - print "\n"; - print "\t\n"; - print "\t\n"; - print "\n"; - print "\n"; -} - -sub show_frames_003 { - print "\n"; - print "\n"; - print "\n"; - print "\t\n"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\n"; - print "\n"; -} - -sub show_frames_007 { - print "\n"; - print "\n"; - print "\n"; - print "\t\n"; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print "\t\n"; - print "\n"; - print "\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="\n"; - $fparms=join('',$fparms,"\n"); - $fparms=join('',$fparms,"\n"); - $fparms=join('',$fparms,"\n"); - $fparms=join('',$fparms,"\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 "\n"; - foreach (sort @tmparray[1..$#tmparray]) { - @flds=split(/&/,$_); - $testoptions=join('',$testoptions,"