version 1.6, 2002/08/13 14:44:33
|
version 1.7, 2002/08/14 16:18:55
|
Line 39 package Apache::lonproblemanalysis;
|
Line 39 package Apache::lonproblemanalysis;
|
|
|
use strict; |
use strict; |
use Apache::lonnet(); |
use Apache::lonnet(); |
|
use Apache::lonhtmlcommon(); |
use GDBM_File; |
use GDBM_File; |
|
|
my $jr; |
my $jr; |
Line 48 sub BuildProblemAnalysisPage {
|
Line 49 sub BuildProblemAnalysisPage {
|
|
|
my %cache; |
my %cache; |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('<html><body>Unable to tie database.</body></html>'); |
$r->print('Unable to tie database.'); |
return; |
return; |
} |
} |
|
|
$r->print(&IntervalOptions($cache{'Interval'})); |
my $Ptr = ''; |
|
$Ptr .= '<table border="0"><tbody>'; |
|
$Ptr .= '<tr><td align="right"><b>Select Sections</b>'; |
|
$Ptr .= '</td>'."\n"; |
|
$Ptr .= '<td align="left">'."\n"; |
|
my @sectionsSelected = split(':',$cache{'sectionsSelected'}); |
|
my @sections = split(':',$cache{'sectionList'}); |
|
$Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections, |
|
\@sectionsSelected, |
|
'Statistics'); |
|
$Ptr .= '</td></tr>'."\n"; |
|
$Ptr .= '<tr><td align="right"><b>Intervals</b></td>'."\n"; |
|
$Ptr .= '<td align="left">'; |
|
$Ptr .= &IntervalOptions($cache{'Interval'}); |
|
$Ptr .= '</td></tr></table><br>'; |
|
$r->print($Ptr); |
$r->rflush(); |
$r->rflush(); |
$r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache)); |
$r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache)); |
|
|
Line 69 sub BuildAnalyzePage {
|
Line 85 sub BuildAnalyzePage {
|
|
|
my $Str = '</form>'; |
my $Str = '</form>'; |
my %cache; |
my %cache; |
if(&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, 'true', |
|
$cacheDB, 'true', |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
'true', $courseID, |
$Str .= 'Unable to tie database.'; |
$r, $c) ne 'OK') { |
$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; |
|
} |
|
} else { |
|
if($value eq $_) { |
|
$found = 1; |
|
last; |
|
} |
|
} |
|
} |
|
if($found == 0) { |
|
splice(@$students, $studentIndex, 1); |
|
} |
|
} |
|
untie(%cache); |
|
|
|
if(&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, |
|
'true', |
|
$cacheDB, |
|
'true', |
|
'true', |
|
$courseID, |
|
$r, |
|
$c) ne 'OK') { |
$r->print($Str); |
$r->print($Str); |
return; |
return; |
} |
} |
|
|
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$Str .= '<html><body>Unable to tie database.</body></html>'; |
$Str .= 'Unable to tie database.'; |
$r->print($Str); |
$r->print($Str); |
return; |
return; |
} |
} |
Line 160 sub IntervalOptions {
|
Line 212 sub IntervalOptions {
|
} |
} |
} |
} |
|
|
my $Ptr = '<br><b>Select number of intervals</b>'."\n". |
my $Ptr = '<select name="Interval">'."\n"; |
'<select name="Interval">'."\n"; |
|
for(my $n=1; $n<=7;$ n++) { |
for(my $n=1; $n<=7;$ n++) { |
$Ptr .= '<option'; |
$Ptr .= '<option'; |
if($interval == $n) { |
if($interval == $n) { |
Line 176 sub IntervalOptions {
|
Line 227 sub IntervalOptions {
|
|
|
sub OptionResponseTable { |
sub OptionResponseTable { |
my ($optionResponses,$cache)=@_; |
my ($optionResponses,$cache)=@_; |
my $Str = ''; |
|
$Str .= '<br><b> Option Response Problems in this course:</b>'."\n"; |
|
$Str .= '<br><br>'."\n"; |
|
$Str .= "<table border=2><tr><th> \# </th><th> Problem Title </th>"; |
|
$Str .= '<th> Resource </th><th> Analysis </th></tr>'."\n"; |
|
|
|
my $number=1; |
|
my @optionResponses=split(':::', $optionResponses); |
my @optionResponses=split(':::', $optionResponses); |
my %partCount; |
my %partCount; |
foreach (@optionResponses) { |
my %sequences; |
my ($problemId, $part, undef)=split(':',$_); |
foreach(@optionResponses) { |
|
my ($sequence, $problemId, $part, undef)=split(':',$_); |
$partCount{$problemId.':'.$part}++; |
$partCount{$problemId.':'.$part}++; |
|
if(!defined($sequences{$sequence})) { |
|
$sequences{$sequence} = $_; |
|
} else { |
|
$sequences{$sequence} .= ':::'.$_; |
|
} |
} |
} |
|
|
foreach (@optionResponses) { |
my $Str = ''; |
my ($problemId, $part, $response)=split(':',$_); |
|
my $uri = $cache->{$problemId.':source'}; |
foreach my $sequence (sort(keys(%sequences))) { |
my $title = $cache->{$problemId.':title'}; |
my @optionProblems = split(':::', $sequences{$sequence}); |
|
|
my $Temp = '<a href="'.$uri.'" target="_blank">'.$title.'</a>'; |
$Str .= '<b>'.$cache->{$sequence.':title'}.'</b>'."\n"; |
$Str .= '<tr>'; |
$Str .= "<table border=2><tr><th> \# </th><th> Problem Title </th>"; |
$Str .= '<td> '.$number.' </td>'; |
$Str .= '<th> Resource </th><th> Analysis </th></tr>'."\n"; |
$Str .= '<td bgcolor="#DDFFDD">'.$Temp.'</td>'; |
|
$Str .= '<td bgcolor="#EEFFCC">'.$uri.'</td>'; |
my $count = 1; |
if($partCount{$problemId.':'.$part} < 2) { |
foreach(@optionProblems) { |
$Str .= '<td><input type="submit" name="Analyze:::'; |
my (undef, $problemId, $part, $response)= |
$Str .= $problemId.':'.$part.'" value="'; |
split(':',$sequences{$sequence}); |
$Str .= 'Part '.$part; |
my $uri = $cache->{$problemId.':source'}; |
$Str .= '" /></td></tr>'."\n"; |
my $title = $cache->{$problemId.':title'}; |
} else { |
|
$Str .= '<td><input type="submit" name="Analyze:::'.$_.'" value="'; |
my $Temp = '<a href="'.$uri.'" target="_blank">'.$title.'</a>'; |
$Str .= 'Part '.$part.' Response '.$response; |
$Str .= '<tr>'; |
$Str .= '" /></td></tr>'."\n"; |
$Str .= '<td> '.$count.' </td>'; |
|
$Str .= '<td bgcolor="#DDFFDD">'.$Temp.'</td>'; |
|
$Str .= '<td bgcolor="#EEFFCC">'.$uri.'</td>'; |
|
if($partCount{$problemId.':'.$part} < 2) { |
|
$Str .= '<td><input type="submit" name="Analyze:::'; |
|
$Str .= $problemId.':'.$part.'" value="'; |
|
$Str .= 'Part '.$part; |
|
$Str .= '" /></td></tr>'."\n"; |
|
} else { |
|
my $value = $problemId.':'.$part.':'.$response; |
|
$Str .= '<td><input type="submit" name="Analyze:::'.$value; |
|
$Str .= '" value="'; |
|
$Str .= 'Part '.$part.' Response '.$response; |
|
$Str .= '" /></td></tr>'."\n"; |
|
} |
|
$count++; |
} |
} |
$number++; |
$Str .= '</table><br>'."\n"; |
} |
} |
$Str .= '</table>'."\n"; |
|
|
|
return $Str; |
return $Str; |
} |
} |