--- loncom/interface/statistics/lonproblemanalysis.pm 2003/12/12 20:18:36 1.51 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/01/16 15:35:04 1.55 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.51 2003/12/12 20:18:36 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.55 2004/01/16 15:35:04 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,14 +42,19 @@ my $plotcolors = ['#33ff00', '#66ccff', '#ff9999', '#cccc33', '#660000', '#33cc66', ]; -my @SubmitButtons = ({ name => 'ProblemAnalyis', +my @SubmitButtons = ({ name => 'PrevProblemAnalysis', + text => 'Previous Problem' }, + { name => 'ProblemAnalysis', text => 'Analyze Problem Again' }, + { name => 'NextProblemAnalysis', + text => 'Next Problem' }, + { name => 'break'}, { name => 'ClearCache', text => 'Clear Caches' }, { name => 'updatecaches', text => 'Update Student Data' }, { name => 'SelectAnother', - text => 'Choose a different resource' }, + text => 'Choose a different Problem' }, { name => 'ExcelOutput', text => 'Produce Excel Output' }); @@ -112,34 +117,57 @@ sub BuildProblemAnalysisPage { if (exists($ENV{'form.problemchoice'}) && ! exists($ENV{'form.SelectAnother'})) { foreach my $button (@SubmitButtons) { - $r->print(''); - $r->print(' 'x5); + if ($button->{'name'} eq 'break') { + $r->print("
\n"); + } else { + $r->print(''); + $r->print(' 'x5); + } } - $r->print(''); # $r->print('
'); - # - my ($symb,$part,$resid,$resptype) = &get_problem_symb( - &Apache::lonnet::unescape($ENV{'form.problemchoice'})); $r->rflush(); # - my $resource = &get_resource_from_symb($symb); - if (! defined($resource) || ! defined($resptype)) { + # Determine which problem we are to analyze + my $current_problem = &get_target_from_id($ENV{'form.problemchoice'}); + # + my ($prev,$curr,$next) = &get_prev_curr_next($current_problem); + if (exists($ENV{'form.PrevProblemAnalysis'}) && defined($prev)) { + $current_problem = $prev; + } elsif (exists($ENV{'form.NextProblemAnalysis'}) && defined($next)) { + $current_problem = $next; + } else { + $current_problem = $curr; + } + # + # Store the current problem choice and send it out in the form + $ENV{'form.problemchoice'} = &make_target_id($current_problem); + $r->print(''); + # + if (! defined($current_problem->{'resource'})) { $r->print('resource is undefined'); } else { + my $resource = $current_problem->{'resource'}; $r->print('

'.$resource->{'title'}.'

'); $r->print('

'.$resource->{'src'}.'

'); $r->print(&render_resource($resource)); $r->rflush(); my %Data = &get_problem_data($resource->{'src'}); - my $ProblemData = $Data{$part.'.'.$resid}; - if ($resptype eq 'option') { - &OptionResponseAnalysis($r,$resource,$resid,$ProblemData, + my $ProblemData = $Data{$current_problem->{'part'}. + '.'. + $current_problem->{'respid'}}; + if ($current_problem->{'resptype'} eq 'option') { + &OptionResponseAnalysis($r,$resource, + $current_problem->{'respid'}, + $ProblemData, \@Students); - } elsif ($resptype eq 'radiobutton') { - &RadioResponseAnalysis($r,$resource,$part,$resid,$ProblemData, + } elsif ($current_problem->{'resptype'} eq 'radiobutton') { + &RadioResponseAnalysis($r,$resource, + $current_problem->{'part'}, + $current_problem->{'respid'}, + $ProblemData, \@Students); } else { $r->print('

This analysis is not supported

'); @@ -355,10 +383,10 @@ sub get_Radio_problem_data { ######################################################### ######################################################### sub OptionResponseAnalysis { - my ($r,$resource,$resid,$ProblemData,$Students) = @_; + my ($r,$resource,$respid,$ProblemData,$Students) = @_; my $PerformanceData = &Apache::loncoursedata::get_response_data - ($Students,$resource->{'symb'},$resid); + ($Students,$resource->{'symb'},$respid); if (! defined($PerformanceData) || ref($PerformanceData) ne 'ARRAY' ) { $r->print('

'. @@ -1438,6 +1466,8 @@ sub CreateInterface { } { $Str .= '
'.&mt('Number of Plots:'); + $Str .= &Apache::loncommon::help_open_topic + ('Analysis_num_plots'); $Str .= '