version 1.5, 2002/08/13 00:37:18
|
version 1.10, 2002/09/07 23:07:38
|
Line 26
|
Line 26
|
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# (Navigate problems for statistical reports |
# (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 |
# 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,7/26 Behrouz Minaei |
# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei |
|
# |
# |
### |
### |
|
|
Line 39 package Apache::lonproblemanalysis;
|
Line 35 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 45 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, $r)); |
|
|
untie(%cache); |
untie(%cache); |
|
|
Line 69 sub BuildAnalyzePage {
|
Line 81 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); |
$r->print($Str); |
return; |
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); |
|
} |
|
} |
|
unless(untie(%cache)) { |
|
$r->print('Can not untie hash.'); |
|
$r->rflush(); |
|
} |
|
|
|
my $error = |
|
&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, |
|
'true', |
|
$cacheDB, |
|
'true', |
|
'true', |
|
$courseID, |
|
$r, $c); |
|
if($error ne 'OK') { |
|
$r->print($error.'<br>Error downloading course data<br>'); |
|
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 175 sub IntervalOptions {
|
Line 226 sub IntervalOptions {
|
} |
} |
|
|
sub OptionResponseTable { |
sub OptionResponseTable { |
my ($optionResponses,$cache)=@_; |
my ($optionResponses,$cache,$r)=@_; |
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(':',$_); |
my @orderedSequences=(); |
|
foreach(@optionResponses) { |
|
my ($sequence, $problemId, $part, undef)=split(':',$_); |
$partCount{$problemId.':'.$part}++; |
$partCount{$problemId.':'.$part}++; |
|
if(!defined($sequences{$sequence})) { |
|
push(@orderedSequences, $sequence); |
|
$sequences{$sequence} = $_; |
|
} else { |
|
$sequences{$sequence} .= ':::'.$_; |
|
} |
} |
} |
|
|
|
my $Str = ''; |
|
|
foreach (@optionResponses) { |
foreach my $sequence (@orderedSequences) { |
my ($problemId, $part, $response)=split(':',$_); |
my @optionProblems = split(':::', $sequences{$sequence}); |
my $uri = $cache->{$problemId.':source'}; |
|
my $title = $cache->{$problemId.':title'}; |
$Str .= '<b>'.$cache->{$sequence.':title'}.'</b>'."\n"; |
|
$Str .= "<table border=2><tr><th> \# </th><th> Problem Title </th>"; |
my $Temp = '<a href="'.$uri.'" target="_blank">'.$title.'</a>'; |
$Str .= '<th> Resource </th><th> Analysis </th></tr>'."\n"; |
$Str .= '<tr>'; |
|
$Str .= '<td> '.$number.' </td>'; |
my $count = 1; |
$Str .= '<td bgcolor="#DDFFDD">'.$Temp.'</td>'; |
foreach(@optionProblems) { |
$Str .= '<td bgcolor="#EEFFCC">'.$uri.'</td>'; |
my (undef, $problemId, $part, $response)= |
if($partCount{$problemId.':'.$part} < 2) { |
split(':',$optionProblems[$count-1]); |
$Str .= '<td><input type="submit" name="Analyze:::'; |
# split(':',$sequences{$sequence}); |
$Str .= $problemId.':'.$part.'" value="'; |
my $uri = $cache->{$problemId.':source'}; |
$Str .= 'Part '.$part; |
my $title = $cache->{$problemId.':title'}; |
$Str .= '" /></td></tr>'."\n"; |
|
} else { |
my $Temp = '<a href="'.$uri.'" target="_blank">'.$title.'</a>'; |
$Str .= '<td><input type="submit" name="Analyze:::'.$_.'" value="'; |
$Str .= '<tr>'; |
$Str .= 'Part '.$part.' Response '.$response; |
$Str .= '<td> '.$count.' </td>'; |
$Str .= '" /></td></tr>'."\n"; |
$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; |
} |
} |
Line 381 sub InitAnalysis {
|
Line 449 sub InitAnalysis {
|
'grade_domain' => $domain, |
'grade_domain' => $domain, |
'grade_courseid' => $courseID, |
'grade_courseid' => $courseID, |
'grade_symb' => $problem)); |
'grade_symb' => $problem)); |
my ($a)=&Apache::lonnet::str2hashref($Answ); |
my ($Answer)=&Apache::lonnet::str2hashref($Answ); |
my %b; |
|
foreach (keys(%$a)) { |
|
$b{&Apache::lonnet::unescape($_)} = $a->{$_}; |
|
} |
|
my $Answer=\%b; |
|
|
|
my $found = 0; |
my $found = 0; |
my @parts=(); |
my @parts=(); |