--- loncom/interface/statistics/lonproblemanalysis.pm 2002/11/22 04:04:10 1.13
+++ loncom/interface/statistics/lonproblemanalysis.pm 2003/10/10 13:35:43 1.29
@@ -1,7 +1,6 @@
# The LearningOnline Network with CAPA
-# (Publication Handler
#
-# $Id: lonproblemanalysis.pm,v 1.13 2002/11/22 04:04:10 minaeibi Exp $
+# $Id: lonproblemanalysis.pm,v 1.29 2003/10/10 13:35:43 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,635 +24,427 @@
#
# http://www.lon-capa.org/
#
-# (Navigate problems for statistical reports
-# YEAR=2002
-# 5/12,7/26,9/7,11/22 Behrouz Minaei
-#
-###
package Apache::lonproblemanalysis;
use strict;
use Apache::lonnet();
+use Apache::loncommon();
use Apache::lonhtmlcommon();
-use GDBM_File;
-
-my $jr;
+use Apache::loncoursedata();
+use Apache::lonstatistics;
+use Apache::lonlocal;
sub BuildProblemAnalysisPage {
- my ($cacheDB, $r)=@_;
-
- my %cache;
- unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $r->print('Unable to tie database.');
- return;
- }
-
- my $Ptr = '';
- $Ptr .= '
';
- $Ptr .= 'Select Sections';
- $Ptr .= ' | '."\n";
- $Ptr .= ''."\n";
- my @sectionsSelected = split(':',$cache{'sectionsSelected'});
- my @sections = split(':',$cache{'sectionList'});
- $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections,
- \@sectionsSelected,
- 'Statistics');
- $Ptr .= ' |
'."\n";
- $Ptr .= 'Intervals | '."\n";
- $Ptr .= '';
- $Ptr .= &IntervalOptions($cache{'Interval'});
- $Ptr .= ' |
';
- $r->print($Ptr);
- $r->rflush();
- $r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache, $r));
-
- untie(%cache);
-
- return;
-}
-
-sub BuildAnalyzePage {
- my ($cacheDB, $students, $courseID,$r)=@_;
-
- $jr = $r;
- my $c = $r->connection;
-
- my $Str = '';
- my %cache;
-
- unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $Str .= 'Unable to tie database.';
- $r->print($Str);
- return;
- }
-
- # Remove students who don't have the proper section.
- my @sectionsSelected = split(':',$cache{'sectionsSelected'});
- for(my $studentIndex=((scalar @$students)-1); $studentIndex>=0;
- $studentIndex--) {
- my $value = $cache{$students->[$studentIndex].':section'};
- my $found = 0;
- foreach (@sectionsSelected) {
- if($_ eq 'none') {
- if($value eq '' || !defined($value) || $value eq ' ') {
- $found = 1;
- last;
+ my ($r,$c)=@_;
+ $r->print(''.&mt('Option Response Problem Analysis').'
');
+ $r->print(&CreateInterface());
+ #
+ my @Students = @Apache::lonstatistics::Students;
+ #
+ if (exists($ENV{'form.problemchoice'})) {
+ $r->print('
');
+ &Apache::lonstatistics::Gather_Full_Student_Data($r);
+ #
+ my ($symb,$part,$resid) = &get_problem_symb(
+ &Apache::lonnet::unescape($ENV{'form.problemchoice'})
+ );
+ #
+# my ($firsttime,$lasttime) =
+# &Apache::loncoursedata::get_timestamp_data($symb,$resid);
+ #
+ my $resource = &get_resource_from_symb($symb);
+ if (defined($resource)) {
+ my %Data = &get_problem_data($resource->{'src'});
+ my $ORdata = $Data{$part.'.'.$resid};
+ ##
+ ## Render the problem
+ my $base;
+ ($base,undef) = ($resource->{'src'} =~ m|(.*/)[^/]*$|);
+ $base = "http://".$ENV{'SERVER_NAME'}.$base;
+ my $rendered_problem =
+ &Apache::lonnet::ssi_body($resource->{'src'});
+ $rendered_problem =~ s/