--- loncom/interface/statistics/lonsurveyreports.pm 2006/02/14 15:44:25 1.10 +++ loncom/interface/statistics/lonsurveyreports.pm 2007/04/03 20:10:41 1.15 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonsurveyreports.pm,v 1.10 2006/02/14 15:44:25 albertel Exp $ +# $Id: lonsurveyreports.pm,v 1.15 2007/04/03 20:10:41 albertel 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'}, @@ -201,7 +204,7 @@ sub SurveyProblemSelector { $checked = 'checked '; } my $link = $problem->{'res'}->src. - '?symb='.&Apache::lonnet::escape($problem->{'res'}->symb); + '?symb='.&escape($problem->{'res'}->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}); @@ -509,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}; @@ -541,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 .= ''. @@ -606,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 .= ''; - $Str .= ''; + $Str .= ''; + $Str .= ''; $Str .= ''; $Str .= ''; $Str .= ''."\n"; @@ -621,6 +628,10 @@ sub CreateInterface { $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= ''; # + $Str .= ''; + # $Str .= '';
'.&mt('Sections').''.&mt('Enrollment Status').''.&mt('Groups').''.&mt('Access Status').''.&mt('Output Format').''.' '.'
'."\n"; + $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5); + $Str .= ''; $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); $Str .= '