version 1.81, 2004/03/16 16:41:26
|
version 1.85, 2004/06/04 21:42:18
|
Line 51 my @SubmitButtons = ({ name => 'PrevProb
|
Line 51 my @SubmitButtons = ({ name => 'PrevProb
|
{ name => 'NextProblemAnalysis', |
{ name => 'NextProblemAnalysis', |
text => 'Next Problem' }, |
text => 'Next Problem' }, |
{ name => 'break'}, |
{ name => 'break'}, |
{ name => 'ClearCache', |
|
text => 'Clear Caches' }, |
|
{ name => 'updatecaches', |
|
text => 'Update Student Data' }, |
|
{ name => 'SelectAnother', |
{ name => 'SelectAnother', |
text => 'Choose a different Problem' }, |
text => 'Choose a different Problem' }, |
{ name => 'ExcelOutput', |
{ name => 'ExcelOutput', |
Line 85 sub BuildProblemAnalysisPage {
|
Line 81 sub BuildProblemAnalysisPage {
|
$r->print('<h2>There are no students in the sections selected</h2>'); |
$r->print('<h2>There are no students in the sections selected</h2>'); |
} |
} |
# |
# |
&Apache::loncoursedata::clear_internal_caches(); |
my @CacheButtonHTML = |
if (exists($ENV{'form.ClearCache'}) || |
&Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status'); |
exists($ENV{'form.updatecaches'}) || |
|
(exists($ENV{'form.firstanalysis'}) && |
|
$ENV{'form.firstanalysis'} ne 'no')) { |
|
&Apache::lonstatistics::Gather_Full_Student_Data($r); |
|
} |
|
if (! exists($ENV{'form.firstanalysis'})) { |
|
$r->print('<input type="hidden" name="firstanalysis" value="yes" />'); |
|
} else { |
|
$r->print('<input type="hidden" name="firstanalysis" value="no" />'); |
|
} |
|
$r->rflush(); |
$r->rflush(); |
# |
# |
my $problem_types = '(option|radiobutton|numerical)'; |
my $problem_types = '(option|radiobutton|numerical)'; |
Line 111 sub BuildProblemAnalysisPage {
|
Line 97 sub BuildProblemAnalysisPage {
|
$r->print(' 'x5); |
$r->print(' 'x5); |
} |
} |
} |
} |
|
foreach my $html (@CacheButtonHTML) { |
|
$r->print($html.(' 'x5)); |
|
} |
# |
# |
$r->print('<hr />'); |
$r->print('<hr />'); |
$r->rflush(); |
$r->rflush(); |
Line 160 sub BuildProblemAnalysisPage {
|
Line 149 sub BuildProblemAnalysisPage {
|
$ProblemData, |
$ProblemData, |
\@Students); |
\@Students); |
} elsif ($current_problem->{'resptype'} eq 'numerical') { |
} elsif ($current_problem->{'resptype'} eq 'numerical') { |
&NumericalResponseAnalysis($r,$current_problem, |
## |
$ProblemData,\@Students); |
## analyze all responses of a problem at once |
|
my $res = $current_problem->{'resource'}; |
|
foreach my $partid (@{$res->{'parts'}}) { |
|
$current_problem->{'part'} = $partid; |
|
foreach my $respid (@{$res->{'partdata'}->{$partid}->{'ResponseIds'}}) { |
|
$current_problem->{'respid'}=$respid; |
|
&NumericalResponseAnalysis($r,$current_problem, |
|
$ProblemData,\@Students); |
|
} |
|
} |
} else { |
} else { |
$r->print('<h2>This analysis is not supported</h2>'); |
$r->print('<h2>This analysis is not supported</h2>'); |
} |
} |
Line 188 sub BuildProblemAnalysisPage {
|
Line 186 sub BuildProblemAnalysisPage {
|
sub NumericalResponseAnalysis { |
sub NumericalResponseAnalysis { |
my ($r,$problem,$ProblemData,$Students) = @_; |
my ($r,$problem,$ProblemData,$Students) = @_; |
my $c = $r->connection(); |
my $c = $r->connection(); |
my ($resource,$respid) = ($problem->{'resource'}, |
my ($resource,$partid,$respid) = ($problem->{'resource'}, |
$problem->{'respid'}); |
$problem->{'part'}, |
$r->print('Response '.$respid.'</br />'); |
$problem->{'respid'}); |
|
# |
|
if (scalar(@{$resource->{'parts'}})>1) { |
|
if (@{$resource->{'partdata'}->{$partid}->{'ResponseIds'}}>1) { |
|
$r->print('<h3>'. |
|
&mt('Part [_1], response [_2].',$partid,$respid). |
|
'</h3>'); |
|
} else { |
|
$r->print('<h3>'. |
|
&mt('Part [_1]',$partid,$respid). |
|
'</h3>'); |
|
} |
|
} elsif (@{$resource->{'partdata'}->{$partid}->{'ResponseIds'}}>1) { |
|
$r->print('<h3>'.&mt('Response [_1]',$respid).'</h3>'); |
|
} |
|
# |
my $analysis_html; |
my $analysis_html; |
my $PerformanceData = |
my $PerformanceData = &Apache::loncoursedata::get_response_data |
&Apache::loncoursedata::get_response_data |
(\@Apache::lonstatistics::SelectedSections, |
($Students,$resource->{'symb'},$respid); |
$Apache::lonstatistics::enrollment_status, |
|
$resource->{'symb'},$respid); |
if (! defined($PerformanceData) || |
if (! defined($PerformanceData) || |
ref($PerformanceData) ne 'ARRAY' ) { |
ref($PerformanceData) ne 'ARRAY' ) { |
$analysis_html = '<h2>'. |
$analysis_html = '<h2>'. |
Line 205 sub NumericalResponseAnalysis {
|
Line 219 sub NumericalResponseAnalysis {
|
} |
} |
# |
# |
# This next call causes all the waiting around that people complain about |
# This next call causes all the waiting around that people complain about |
my ($max,$min) = &Apache::lonstathelpers::GetStudentAnswers($r,$problem, |
my ($max,$min) = |
$Students); |
&Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students, |
|
'Statistics', |
|
'stats_status'); |
return if ($c->aborted()); |
return if ($c->aborted()); |
# |
# |
# Collate the data |
# Collate the data |
Line 232 sub one_dimensional_plot {
|
Line 248 sub one_dimensional_plot {
|
# Compute data -> image scaling factors |
# Compute data -> image scaling factors |
my $min = $Labels->[0]; |
my $min = $Labels->[0]; |
my $max = $Labels->[-1]; |
my $max = $Labels->[-1]; |
|
if ($max == $min) { |
|
$max =$min+1; |
|
} |
my $h_scale = ($width-10)/($max-$min); |
my $h_scale = ($width-10)/($max-$min); |
# |
# |
my $max_y = 0; |
my $max_y = 0; |
Line 294 sub line {
|
Line 313 sub line {
|
return qq{<line x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" />$/}; |
return qq{<line x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" />$/}; |
} |
} |
|
|
|
sub text { |
|
my ($x,$y,$color,$text,$font,$direction) = @_; |
|
if (! defined($font) || $font !~ /^(tiny|small|medium|large|giant)$/) { |
|
$font = 'medium'; |
|
} |
|
if (! defined($direction) || $direction ne 'vertical') { |
|
$direction = ''; |
|
} |
|
return qq{<text x="$x" y="$y" color="$color" font="$font" direction="$direction" >$text</text>}; |
|
} |
|
|
sub rectangle { |
sub rectangle { |
my ($x1,$y1,$x2,$y2,$color,$thickness,$filled) = @_; |
my ($x1,$y1,$x2,$y2,$color,$thickness,$filled) = @_; |
return qq{<rectangle x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" filled="$filled" />}; |
return qq{<rectangle x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" filled="$filled" />}; |
Line 348 sub RadioResponseAnalysis {
|
Line 378 sub RadioResponseAnalysis {
|
my ($resource,$respid) = ($problem->{'resource'}, |
my ($resource,$respid) = ($problem->{'resource'}, |
$problem->{'respid'}); |
$problem->{'respid'}); |
my $analysis_html; |
my $analysis_html; |
my $PerformanceData = |
my $PerformanceData = &Apache::loncoursedata::get_response_data |
&Apache::loncoursedata::get_response_data |
(\@Apache::lonstatistics::SelectedSections, |
($Students,$resource->{'symb'},$respid); |
$Apache::lonstatistics::enrollment_status, |
|
$resource->{'symb'},$respid); |
if (! defined($PerformanceData) || |
if (! defined($PerformanceData) || |
ref($PerformanceData) ne 'ARRAY' ) { |
ref($PerformanceData) ne 'ARRAY' ) { |
$analysis_html = '<h2>'. |
$analysis_html = '<h2>'. |
Line 533 sub OptionResponseAnalysis {
|
Line 564 sub OptionResponseAnalysis {
|
my ($resource,$respid) = ($problem->{'resource'}, |
my ($resource,$respid) = ($problem->{'resource'}, |
$problem->{'respid'}); |
$problem->{'respid'}); |
# Note: part data is not needed. |
# Note: part data is not needed. |
my $PerformanceData = |
my $PerformanceData = &Apache::loncoursedata::get_response_data |
&Apache::loncoursedata::get_response_data |
(\@Apache::lonstatistics::SelectedSections, |
($Students,$resource->{'symb'},$respid); |
$Apache::lonstatistics::enrollment_status, |
|
$resource->{'symb'},$respid); |
if (! defined($PerformanceData) || |
if (! defined($PerformanceData) || |
ref($PerformanceData) ne 'ARRAY' ) { |
ref($PerformanceData) ne 'ARRAY' ) { |
$r->print('<h2>'. |
$r->print('<h2>'. |
Line 1279 sub build_foil_index {
|
Line 1311 sub build_foil_index {
|
if (@Concepts > 1) { |
if (@Concepts > 1) { |
$table .= '<tr>'. |
$table .= '<tr>'. |
'<td>'.$conceptindex.'</td>'. |
'<td>'.$conceptindex.'</td>'. |
'<td>'.&HTML::Entities::encode($concept->{'name'}).'</td>'. |
'<td>'.&HTML::Entities::encode($concept->{'name'},'<>&"').'</td>'. |
'<td>'.$foilindex++.'</td>'. |
'<td>'.$foilindex++.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'},'<>&"').'</td>'. |
'<td>'.$Foildata{$firstfoil}->{'text'}.'</td>'. |
'<td>'.$Foildata{$firstfoil}->{'text'}.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'},'<>&"').'</td>'. |
"</tr>\n"; |
"</tr>\n"; |
} else { |
} else { |
$table .= '<tr>'. |
$table .= '<tr>'. |
'<td>'.$foilindex++.'</td>'. |
'<td>'.$foilindex++.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'},'<>&"').'</td>'. |
'<td>'.$Foildata{$firstfoil}->{'text'}.'</td>'. |
'<td>'.$Foildata{$firstfoil}->{'text'}.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'},'<>&"').'</td>'. |
"</tr>\n"; |
"</tr>\n"; |
} |
} |
foreach my $foilid (@FoilsInConcept) { |
foreach my $foilid (@FoilsInConcept) { |
Line 1299 sub build_foil_index {
|
Line 1331 sub build_foil_index {
|
'<td></td>'. |
'<td></td>'. |
'<td></td>'. |
'<td></td>'. |
'<td>'.$foilindex.'</td>'. |
'<td>'.$foilindex.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'name'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'name'},'<>&"').'</td>'. |
'<td>'.$Foildata{$foilid}->{'text'}.'</td>'. |
'<td>'.$Foildata{$foilid}->{'text'}.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'value'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'value'},'<>&"').'</td>'. |
"</tr>\n"; |
"</tr>\n"; |
} else { |
} else { |
$table .= '<tr>'. |
$table .= '<tr>'. |
'<td>'.$foilindex.'</td>'. |
'<td>'.$foilindex.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'name'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'name'},'<>&"').'</td>'. |
'<td>'.$Foildata{$foilid}->{'text'}.'</td>'. |
'<td>'.$Foildata{$foilid}->{'text'}.'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'value'}).'</td>'. |
'<td>'.&HTML::Entities::encode($Foildata{$foilid}->{'value'},'<>&"').'</td>'. |
"</tr>\n"; |
"</tr>\n"; |
} |
} |
} continue { |
} continue { |
Line 1333 sub build_option_index {
|
Line 1365 sub build_option_index {
|
'<tr>'. |
'<tr>'. |
'<td bgcolor="'.$plotcolors->[$optionindex++].'">'. |
'<td bgcolor="'.$plotcolors->[$optionindex++].'">'. |
(' 'x4).'</td>'. |
(' 'x4).'</td>'. |
'<td>'.&HTML::Entities::encode($option).'</td>'. |
'<td>'.&HTML::Entities::encode($option,'<>&"').'</td>'. |
"</tr>\n"); |
"</tr>\n"); |
} |
} |
shift(@Rows); # Throw away 'correct option chosen' color |
shift(@Rows); # Throw away 'correct option chosen' color |
Line 1427 sub CreateInterface {
|
Line 1459 sub CreateInterface {
|
$Str .= '</select></nobr><br />'; |
$Str .= '</select></nobr><br />'; |
} |
} |
{ |
{ |
$Str .= '<br /><nobr>'.&mt('Number of Plots:'); |
$Str .= '<nobr>'.&mt('Number of Plots:'); |
$Str .= &Apache::loncommon::help_open_topic |
$Str .= &Apache::loncommon::help_open_topic |
('Analysis_num_plots'); |
('Analysis_num_plots'); |
$Str .= '<select name="NumPlots">'; |
$Str .= '<select name="NumPlots">'; |
Line 1441 sub CreateInterface {
|
Line 1473 sub CreateInterface {
|
if ($ENV{'form.NumPlots'} == $i) { $Str.=' selected '; } |
if ($ENV{'form.NumPlots'} == $i) { $Str.=' selected '; } |
$Str .= '>'.$i.'</option>'; |
$Str .= '>'.$i.'</option>'; |
} |
} |
$Str .= '</select></nobr>'; |
$Str .= '</select></nobr><br />'; |
|
} |
|
{ |
|
$Str .= '<nobr>'.&mt('Status: [_1]', |
|
'<input type="text" '. |
|
'name="stats_status" size="60" value="" />' |
|
). |
|
'</nobr><br />'; |
} |
} |
} |
} |
$Str .= '</td>'; |
$Str .= '</td>'; |