--- loncom/interface/statistics/lonproblemanalysis.pm 2002/09/07 23:07:38 1.10 +++ loncom/interface/statistics/lonproblemanalysis.pm 2003/10/21 16:00:30 1.44 @@ -1,7 +1,6 @@ # The LearningOnline Network with CAPA -# (Publication Handler # -# $Id: lonproblemanalysis.pm,v 1.10 2002/09/07 23:07:38 minaeibi Exp $ +# $Id: lonproblemanalysis.pm,v 1.44 2003/10/21 16:00:30 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,507 +24,1368 @@ # # http://www.lon-capa.org/ # -# (Navigate problems for statistical reports -# YEAR=2002 -# 5/12,7/26 Behrouz Minaei -# -### -package Apache::lonproblemanalysis; +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; +use HTML::Entities(); +use Time::Local(); +use Spreadsheet::WriteExcel(); + +my $plotcolors = ['#33ff00', + '#0033cc', '#990000', '#aaaa66', '#663399', '#ff9933', + '#66ccff', '#ff9999', '#cccc33', '#660000', '#33cc66', + ]; 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 .= '
Select Sections'; - $Ptr .= ' | '."\n"; - $Ptr .= ''."\n"; - my @sectionsSelected = split(':',$cache{'sectionsSelected'}); - my @sections = split(':',$cache{'sectionList'}); - $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections, - \@sectionsSelected, - 'Statistics'); - $Ptr .= ' |
Intervals | '."\n"; - $Ptr .= ''; - $Ptr .= &IntervalOptions($cache{'Interval'}); - $Ptr .= ' |
'.
+ ' |
'.&mt('Concept Number').' | '. + ''.&mt('Concept').' | '. + ''.&mt('Foil Number').' | '. + ''.&mt('Foil Name').' | '. + ''.&mt('Foil Text').' | '. + ''.&mt('Correct Value').' | '. + "
---|---|---|---|---|---|
'.&mt('Foil Number').' | '. + ''.&mt('Foil Name').' | '. + ''.&mt('Foil Text').' | '. + ''.&mt('Correct Value').' | '. + "||
'.$conceptindex.' | '. + ''.$concept->{'name'}.' | '. + ''.$foilindex++.' | '. + ''.$Foildata{$firstfoil}->{'name'}.' | '. + ''.$Foildata{$firstfoil}->{'text'}.' | '. + ''.$Foildata{$firstfoil}->{'value'}.' | '. + "
'.$foilindex++.' | '. + ''.$Foildata{$firstfoil}->{'name'}.' | '. + ''.$Foildata{$firstfoil}->{'text'}.' | '. + ''.$Foildata{$firstfoil}->{'value'}.' | '. + "||
'. + ' | '. + ' | '.$foilindex.' | '. + ''.$Foildata{$foilid}->{'name'}.' | '. + ''.$Foildata{$foilid}->{'text'}.' | '. + ''.$Foildata{$foilid}->{'value'}.' | '. + "
'.$foilindex.' | '. + ''.$Foildata{$foilid}->{'name'}.' | '. + ''.$Foildata{$foilid}->{'text'}.' | '. + ''.$Foildata{$foilid}->{'value'}.' | '. + "
'. + (' 'x4).' | '. + ''.$option.' | '. + "
'.$correctgraph.' | '; + ## + ## + for (my $i=0; $i< scalar(@{$Datasets[0]});$i++) { + $Datasets[0]->[$i]=0; + } + $count = $ResponseData{'_total'}->[$i]-$ResponseData{'_correct'}->[$i]; + if ($count == 0) { + $count = 'no submissions'; + } elsif ($count == 1) { + $count = '1 submission'; + } else { + $count = $count.' submissions'; + } + $title = 'Attempt '.$i.', '.$count; + my $incorrectgraph = &Apache::loncommon::DrawGraph + ($title,'Foil Number','% Option Chosen Incorrectly', + 100,$plotcolors,@Datasets); + $analysis_html.= ''.$incorrectgraph.' | '; + $analysis_html.= ''.$foilkey." |
'.$graphlink." |
'.$correctplot.' | '. + ''.$incorrectplot.' | '. + ''.$foilkey.' | '."
'.
+ 'Start Time:'.
+ ' '.$interval->{'startdateform'}.' '. + 'End Time : '. + ' '.$interval->{'enddateform'}.' '. +# 'Plot Title :'. +# (" "x3).$interval->{'titleform'}. + ' | '.
+ "||
'.$correctplot.' | '. + ''.
+ 'Start Time: '.$interval->{'startdateform'}.' '. + 'End Time : '. + ' '.$interval->{'enddateform'}.' '. +# 'Plot Title :'.(" "x3). +# $interval->{'titleform'}. + ' | '.
+ "