--- loncom/interface/statistics/lonsurveyreports.pm 2005/03/18 00:20:44 1.7
+++ loncom/interface/statistics/lonsurveyreports.pm 2006/05/30 12:46:50 1.13
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonsurveyreports.pm,v 1.7 2005/03/18 00:20:44 matthew Exp $
+# $Id: lonsurveyreports.pm,v 1.13 2006/05/30 12:46:50 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,7 +27,7 @@
package Apache::lonsurveyreports;
use strict;
-use Apache::lonnet();
+use Apache::lonnet;
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::loncoursedata();
@@ -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'},
@@ -77,8 +80,8 @@ sub BuildSurveyReportsPage {
&Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status');
$r->rflush();
#
- if (exists($ENV{'form.problemchoice'}) &&
- ! exists($ENV{'form.SelectAnother'})) {
+ if (exists($env{'form.problemchoice'}) &&
+ ! exists($env{'form.SelectAnother'})) {
$r->print(' 'x3);
foreach my $button (@SubmitButtons) {
if ($button->{'name'} eq 'break') {
@@ -102,26 +105,26 @@ sub BuildSurveyReportsPage {
#
# Determine which problem we are to analyze
my $current_problem = &Apache::lonstathelpers::get_target_from_id
- ($ENV{'form.problemchoice'});
+ ($env{'form.problemchoice'});
#
my ($navmap,$prev,$curr,$next) =
&Apache::lonstathelpers::get_prev_curr_next($current_problem,
'.',
'part_survey',
);
- if (exists($ENV{'form.PrevProblem'}) && defined($prev)) {
+ if (exists($env{'form.PrevProblem'}) && defined($prev)) {
$current_problem = $prev;
- } elsif (exists($ENV{'form.NextProblem'}) && defined($next)) {
+ } elsif (exists($env{'form.NextProblem'}) && defined($next)) {
$current_problem = $next;
} else {
$current_problem = $curr;
}
#
# Store the current problem choice and send it out in the form
- $ENV{'form.problemchoice'} =
+ $env{'form.problemchoice'} =
&Apache::lonstathelpers::make_target_id($current_problem);
$r->print('');
+ $env{'form.problemchoice'}.'" />');
#
if (! defined($current_problem->{'resource'})) {
$r->print('resource is undefined');
@@ -129,19 +132,19 @@ sub BuildSurveyReportsPage {
my $resource = $current_problem->{'resource'};
$r->print('
'.$resource->compTitle.'
');
$r->print(''.$resource->src.'
');
- if ($ENV{'form.renderprob'} eq 'true') {
+ if ($env{'form.renderprob'} eq 'true') {
$r->print(&Apache::lonstathelpers::render_resource($resource));
}
$r->rflush();
my %Data = &Apache::lonstathelpers::get_problem_data
($resource->src);
&compile_student_answers($r,$current_problem,\%Data,\@Students);
- if ($ENV{'form.output'} eq 'HTML' ||
- ! defined($ENV{'form.output'})) {
+ if ($env{'form.output'} eq 'HTML' ||
+ ! defined($env{'form.output'})) {
&make_HTML_report($r,$current_problem,\%Data,\@Students);
- } elsif ($ENV{'form.output'} eq 'Excel') {
+ } elsif ($env{'form.output'} eq 'Excel') {
&make_Excel_report($r,$current_problem,\%Data,\@Students);
- } elsif ($ENV{'form.output'} eq 'TXT') {
+ } elsif ($env{'form.output'} eq 'TXT') {
&make_text_report($r,$current_problem,\%Data,\@Students);
}
}
@@ -197,16 +200,16 @@ sub SurveyProblemSelector {
respid=>undef,
resptype=>undef});
my $checked = '';
- if ($ENV{'form.problemchoice'} eq $value) {
+ if ($env{'form.problemchoice'} eq $value) {
$checked = 'checked ';
}
my $link = $problem->{'res'}->src.
- '?symb='.&Apache::lonnet::escape($problem->{'res'}->symb);
+ '?symb='.&escape($problem->{'res'}->symb);
$Str .= ''.
''.' | '.
''.
- ' |
'.$/;
}
@@ -249,13 +252,13 @@ 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}++;
@@ -357,7 +360,7 @@ sub make_Excel_report {
#
my $rows_output=0;
$worksheet->write($rows_output++,0,
- $ENV{'course.'.$ENV{'request.course.id'}.'.description'},
+ $env{'course.'.$env{'request.course.id'}.'.description'},
$format->{'h1'});
$rows_output++;
#
@@ -483,7 +486,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') {
@@ -591,26 +595,26 @@ sub CreateInterface {
## Environment variable initialization
my $Str = '';
my $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('Groups').' | ';
$Str .= ''.&mt('Enrollment Status').' | ';
$Str .= ''.&mt('Output Format').' | ';
$Str .= ''.' '.' | ';
@@ -620,6 +624,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 .= ' | ';
@@ -628,7 +636,7 @@ sub CreateInterface {
#
# Render problem checkbox
my $prob_checkbox = '