--- loncom/interface/statistics/lonproblemanalysis.pm 2003/11/11 22:07:46 1.48
+++ 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.48 2003/11/11 22:07:46 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' });
@@ -73,6 +78,19 @@ sub render_resource {
sub BuildProblemAnalysisPage {
my ($r,$c)=@_;
#
+ my %Saveable_Parameters = ('Status' => 'scalar',
+ 'Section' => 'array',
+ 'NumPlots' => 'scalar',
+ 'AnalyzeAs' => 'scalar',
+ 'AnalyzeOver' => 'scalar',
+ );
+ &Apache::loncommon::store_course_settings('problem_analysis',
+ \%Saveable_Parameters);
+ &Apache::loncommon::restore_course_settings('problem_analysis',
+ \%Saveable_Parameters);
+ #
+ &Apache::lonstatistics::PrepareClasslist();
+ #
$r->print('
'.&mt('Option Response Problem Analysis').'
');
$r->print(&CreateInterface());
#
@@ -99,34 +117,57 @@ sub BuildProblemAnalysisPage {
if (exists($ENV{'form.problemchoice'}) &&
! exists($ENV{'form.SelectAnother'})) {
foreach my $button (@SubmitButtons) {
- $r->print('{'text'}).'" />');
- $r->print(' 'x5);
+ if ($button->{'name'} eq 'break') {
+ $r->print("
\n");
+ } else {
+ $r->print('{'text'}).'" />');
+ $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
');
@@ -342,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(''.
@@ -1390,6 +1431,8 @@ sub CreateInterface {
{ # These braces are here to organize the code, not scope it.
{
$Str .= ''.&mt('Analyze Over ');
+ $Str .= &Apache::loncommon::help_open_topic
+ ('Analysis_Analyze_Over');
$Str .='
';
+ $Str .= '';
+ $Str .= '
';
}
{
$Str .= ''.&mt('Analyze as ');
+ $Str .= &Apache::loncommon::help_open_topic
+ ('Analysis_Analyze_as');
$Str .='