--- loncom/interface/statistics/lonproblemanalysis.pm 2002/08/01 20:49:06 1.3
+++ loncom/interface/statistics/lonproblemanalysis.pm 2003/09/29 21:13:23 1.24
@@ -1,7 +1,6 @@
# The LearningOnline Network with CAPA
-# (Publication Handler
#
-# $Id: lonproblemanalysis.pm,v 1.3 2002/08/01 20:49:06 stredwic Exp $
+# $Id: lonproblemanalysis.pm,v 1.24 2003/09/29 21:13:23 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,460 +25,202 @@
# http://www.lon-capa.org/
#
# (Navigate problems for statistical reports
-# YEAR=2001
-# 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei
-# 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
# YEAR=2002
-# 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
-# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei
+# 5/12,7/26,9/7,11/22 Behrouz Minaei
#
###
-package Apache::lonproblemanalysis;
+package Apache::lonproblemanalysis;
use strict;
use Apache::lonnet();
-use GDBM_File;
-
-my $jr;
+use Apache::lonhtmlcommon();
+use Apache::loncoursedata();
+use Apache::lonstatistics;
+use Apache::lonlocal;
sub BuildProblemAnalysisPage {
- my ($cacheDB)=@_;
-
- my %cache;
- my $Str = '';
- unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $Str .= '
Unable to tie database.';
- return $Str;
- }
-
- $Str .= &IntervalOptions($cache{'Interval'});
- $Str .= &OptionResponseTable($cache{'OptionResponses'}, \%cache);
-
- untie(%cache);
-
- return $Str;
-}
-
-sub BuildAnalyzePage {
- my ($cacheDB, $students, $courseID,$r)=@_;
-
- $jr = $r;
- my $c = $r->connection;
-
- my $Str = '';
- my %cache;
- foreach (@$students) {
- if($c->aborted) {
- return $Str;
- }
- my $downloadTime='';
- if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $downloadTime = $cache{$_.':lastDownloadTime'};
- untie(%cache);
- }
- if($downloadTime eq 'Not downloaded') {
- my $courseData =
- &Apache::loncoursedata::DownloadCourseInformation($_,
- $courseID);
- if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) {
- &Apache::loncoursedata::ProcessStudentData(\%cache,
- $courseData, $_);
- untie(%cache);
- } else {
- next;
- }
+ my ($r,$c)=@_;
+ $r->print(''.&mt('Option Response Problem Analysis').' ');
+ if (exists($ENV{'form.problemchoice'})) {
+ # This is me getting around my own cleverness:
+ &Apache::lonstatistics::MapSelect('Maps','multiple,all',5,
+ undef);
+ #
+ my ($symb,$id) = &get_problem_symb(
+ &Apache::lonnet::unescape($ENV{'form.problemchoice'})
+ );
+ $r->print(' ');
+ my $resource = &get_resource_from_symb($symb);
+ if (defined($resource)) {
+ $r->print(''.
+ # Oh this is dumb! Need to rewrite relative links
+ # otherwise images (for example) will not show.
+ &Apache::lonnet::ssi_body($resource->{'src'}).
+ '
');
+ } else {
+ $r->print('resource is undefined');
}
+ $r->print('');
+ $r->print(" render problem\n");
+ $r->print(" image tag for plot\n");
+ $r->print(" plot key\n");
+ $r->print(' ');
+ $r->print("\nProblem choice = $symb $id\n \n");
+ $r->print(' ');
+ }
+ $r->print(' ');
+ $r->print(&CreateInterface());
+ if (! exists($ENV{'form.analysisfirstcall'})) {
+ return;
}
-
- unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $Str .= 'Unable to tie database.';
- return $Str;
- }
-
- my ($problemId, $part, $responseId)=split(':',$cache{'AnalyzeInfo'});
- my $uri = $cache{$problemId.':source'};
- my $problem = $cache{$problemId.':problem'};
- my $title = $cache{$problemId.':title'};
- my $interval = $cache{'Interval'};
-
- my %ConceptData;
- $ConceptData{"Interval"} = $interval;
-
- #Initialize the option response true answers
- my ($analyzeData) = &InitAnalysis($uri, $part, $responseId, $problem,
- $students->[0], $courseID);
- if(defined($analyzeData->{'error'})) {
- $Str .= 'Incorrect part requested. ';
- return $Str;
- }
-
- if($c->aborted()) { untie(%cache); return $Str; }
-
- #compute the intervals
- &Interval($part, $problem, $interval, $analyzeData->{'concepts'},
- \%ConceptData);
-
- $title =~ s/\ /"_"/eg;
- $Str .= ''.$uri.' ';
-
- if($c->aborted()) { untie(%cache); return $Str; }
-
- #Java script Progress window
-# &Create_PrgWin();
-# &Update_PrgWin("Starting-to-analyze-problem");
- for(my $index=0; $index<(scalar @$students); $index++) {
- if($c->aborted()) { untie(%cache); return $Str; }
-# &Update_PrgWin($index);
-# &OpStatus($problem, $students->[$index], $courseID, \%ConceptData,
-# $analyzeData->{'foil_to_concept'}, $analyzeData, \%cache);
- &OpStatus($problem, $students->[$index], \%ConceptData,
- $analyzeData->{'foil_to_concept'}, $analyzeData, \%cache);
- }
-# &Close_PrgWin();
-
- $Str .= ' ';
- for (my $k=0; $k<$interval; $k++ ) {
- if($c->aborted()) { untie(%cache); return $Str; }
- $Str .= &DrawGraph($k, $title, $analyzeData->{'concepts'},
- \%ConceptData);
- }
- for (my $k=0; $k<$interval; $k++ ) {
- if($c->aborted()) { untie(%cache); return $Str; }
- $Str .= &DrawTable($k, $analyzeData->{'concepts'}, \%ConceptData);
- }
- my $Answ=&Apache::lonnet::ssi($uri);
- $Str .= 'Here you can see the Problem: '.$Answ;
-
- untie(%cache);
-
- return $Str.'