--- loncom/interface/statistics/lonsurveyreports.pm 2005/04/07 06:56:24 1.8
+++ loncom/interface/statistics/lonsurveyreports.pm 2008/09/14 15:16:30 1.16
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonsurveyreports.pm,v 1.8 2005/04/07 06:56:24 albertel Exp $
+# $Id: lonsurveyreports.pm,v 1.16 2008/09/14 15:16:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,6 +37,9 @@ use Apache::lonstathelpers;
use Spreadsheet::WriteExcel;
use HTML::Entities();
use Time::Local();
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+
my @SubmitButtons = (
{ name => 'break'},
@@ -200,13 +203,13 @@ sub SurveyProblemSelector {
if ($env{'form.problemchoice'} eq $value) {
$checked = 'checked ';
}
- my $link = $problem->{'res'}->src.
- '?symb='.&Apache::lonnet::escape($problem->{'res'}->symb);
+ my $link = $problem->{'res'}->link.
+ '?symb='.&escape($problem->{'res'}->shown_symb);
$Str .= '
'.
''.' | '.
''.
- ' |
'.$/;
}
@@ -249,18 +252,19 @@ sub compile_student_answers {
foreach my $response (@responses) {
my ($foilid,$option) =
map {
- &Apache::lonnet::unescape($_);
+ &unescape($_);
} split('=',$response);
$data->{'foil_count'}->{$foilid}++;
$data->{'foil_responses'}->{$foilid}->{$option}++;
}
} elsif ($resptype =~ /^(radiobutton)$/) {
- my ($foil,$value) = map { &Apache::lonnet::unescape($_); } split('=',$student_response);
+ my ($foil,$value) = map { &unescape($_); } split('=',$student_response);
$value += 1; # explicitly increment it...
$data->{'foil_responses'}->{$foil}++;
$data->{'foil_values'}->{$value}++;
if (! exists($data->{'map'}->{$value})) {
$data->{'map'}->{$value} = $foil;
+ $data->{'map_fv'}->{$foil} = $value;
}
} else {
# Variable stuff (essays, raw numbers, strings) go here
@@ -401,7 +405,7 @@ sub make_Excel_report {
$worksheet->write_row($rows_output++,0,
\@rowdata,$format->{'h4'});
#
- my @foils = sort(keys(%{$data->{'foil_responses'}}));
+ my @foils = sort(keys(%{$respdata->{'_Foils'}}));
foreach my $foilid (@foils) {
my $foil_count = $data->{'foil_count'}->{$foilid};
my $foiltext = $respdata->{'_Foils'}->{$foilid}->{'text'};
@@ -429,9 +433,10 @@ sub make_Excel_report {
my @rowdata = ('Foil Name','Foil Text','Frequency');
$worksheet->write_row($rows_output++,0,
\@rowdata,$format->{'h4'});
- foreach my $value (sort(keys(%{$data->{'foil_values'}}))) {
+ my @foils = sort(keys(%{$respdata->{'_Foils'}}));
+ foreach my $foilid (@foils) {
undef(@rowdata);
- my $foilid = $data->{'map'}->{$value};
+ my $value = $data->{'map_fv'}->{$foilid};
push(@rowdata,$respdata->{'_Foils'}->{$foilid}->{'name'});
push(@rowdata,$respdata->{'_Foils'}->{$foilid}->{'text'});
push(@rowdata,$data->{'foil_values'}->{$value});
@@ -483,7 +488,8 @@ sub make_HTML_report {
$Str .= ''.
''.&mt('Total').' | '.
''.$data->{'_count'}.' | '.
- ''.&mt('Part [_1], Response [_2]',$partid,$respid).' | '.
+ ''.&mt('Part [_1], Response [_2]',
+ $resource->part_display($partid),$respid).' | '.
'
';
if (exists($data->{'responses'}) &&
ref($data->{'responses'}) eq 'ARRAY') {
@@ -508,7 +514,7 @@ sub make_HTML_report {
&mt('Option'),
&mt('Frequency'),
&mt('Percent'))).'';
- my @foils = sort(keys(%{$data->{'foil_responses'}}));
+ my @foils = sort(keys(%{$ProblemData->{$partid.'.'.$respid}->{'_Foils'}}));
foreach my $foilid (@foils) {
my $prob_data = $ProblemData->{$partid.'.'.$respid};
my $foil_count = $data->{'foil_count'}->{$foilid};
@@ -540,9 +546,11 @@ sub make_HTML_report {
my $total = $data->{'_count'};
my $sum = 0;
my $tmp;
- foreach my $value (sort(keys(%{$data->{'foil_values'}}))) {
+ my @foils = sort(keys(%{$ProblemData->{$partid.'.'.$respid}
+ ->{'_Foils'}}));
+ foreach my $foilid (@foils) {
+ my $value = $data->{'map_fv'}->{$foilid};
my $count = $data->{'foil_values'}->{$value};
- my $foilid = $data->{'map'}->{$value};
my $foiltext = $ProblemData->{$partid.'.'.$respid}->{'_Foils'}->{$foilid}->{'text'};
my $foilname = $ProblemData->{$partid.'.'.$respid}->{'_Foils'}->{$foilid}->{'name'};
$tmp .= ''.
@@ -605,13 +613,13 @@ sub CreateInterface {
$output_selector.= '>'.$output_format->{'text'}.''.$/;
}
$output_selector .= ''.$/;
- $Str .= &Apache::lonhtmlcommon::breadcrumbs
- (undef,'Student Submission Reports');
+ $Str .= &Apache::lonhtmlcommon::breadcrumbs('Student Submission Reports');
$Str .= '';
$Str .= '
'."\n";
$Str .= '';
$Str .= ''.&mt('Sections').' | ';
- $Str .= ''.&mt('Enrollment Status').' | ';
+ $Str .= ''.&mt('Groups').' | ';
+ $Str .= ''.&mt('Access Status').' | ';
$Str .= ''.&mt('Output Format').' | ';
$Str .= ''.' '.' | ';
$Str .= '
'."\n";
@@ -620,6 +628,10 @@ sub CreateInterface {
$Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
$Str .= '';
#
+ $Str .= ''."\n";
+ $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
+ $Str .= ' | ';
+ #
$Str .= '';
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
$Str .= ' | ';