version 1.7, 2004/03/07 20:41:28
|
version 1.13, 2004/08/31 15:22:51
|
Line 43 my @SubmitButtons = ({ name => 'PrevProb
|
Line 43 my @SubmitButtons = ({ name => 'PrevProb
|
{ name => 'NextProblem', |
{ name => 'NextProblem', |
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 => 'Generate', |
{ name => 'Generate', |
Line 75 sub BuildStudentSubmissionsPage {
|
Line 71 sub BuildStudentSubmissionsPage {
|
$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(); |
# |
# |
if (exists($ENV{'form.problemchoice'}) && |
if (exists($ENV{'form.problemchoice'}) && |
Line 100 sub BuildStudentSubmissionsPage {
|
Line 86 sub BuildStudentSubmissionsPage {
|
$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 153 sub BuildStudentSubmissionsPage {
|
Line 142 sub BuildStudentSubmissionsPage {
|
} |
} |
} |
} |
|
|
|
|
######################################################### |
######################################################### |
######################################################### |
######################################################### |
## |
## |
Line 163 sub BuildStudentSubmissionsPage {
|
Line 151 sub BuildStudentSubmissionsPage {
|
######################################################### |
######################################################### |
sub prepare_excel_output { |
sub prepare_excel_output { |
my ($r,$problem,$ProblemData,$Students) = @_; |
my ($r,$problem,$ProblemData,$Students) = @_; |
|
my $c = $r->connection(); |
my ($resource,$respid,$partid) = ($problem->{'resource'}, |
my ($resource,$respid,$partid) = ($problem->{'resource'}, |
$problem->{'respid'}, |
$problem->{'respid'}, |
$problem->{'part'}); |
$problem->{'part'}); |
$r->print('<h2>'. |
$r->print('<h2>'. |
&mt('Preparing Excel spreadsheet of student responses'). |
&mt('Preparing Excel spreadsheet of student responses'). |
'</h2>'); |
'</h2>'. |
# |
'<p>'. |
&GetStudentAnswers($r,$problem,$Students); |
&mt('See the status bar above for student answer computation progress'). |
|
'</p>'); |
|
# |
|
if ($ENV{'form.correctans'} eq 'true') { |
|
&Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students, |
|
'Statistics', |
|
'stats_status'); |
|
} |
# |
# |
my @Columns = ( 'username','domain','attempt','time', |
$r->print('<script>'. |
'submission','correct', 'grading','awarded','weight', |
'window.document.Statistics.stats_status.value="'. |
'score'); |
'Done computing student answers. Compiling spreadsheet.'. |
my $awarded_col = 7; |
'";</script>'); |
my $weight_col = 8; |
$r->rflush(); |
|
my @Columns; |
|
push(@Columns,'username'); |
|
push(@Columns,'domain'); |
|
push(@Columns,'attempt'); |
|
push(@Columns,'time'); |
|
push(@Columns,'submission'); |
|
if ($ENV{'form.correctans'} eq 'true') { push(@Columns,'correct'); } |
|
push(@Columns,'grading'); |
|
push(@Columns,'awarded'); |
|
push(@Columns,'weight'); |
|
push(@Columns,'score'); |
|
my ($awarded_col,$weight_col); |
|
if ($ENV{'form.correctans'} eq 'true') { |
|
$awarded_col = 7; |
|
$weight_col = 8; |
|
} else { |
|
$awarded_col = 6; |
|
$weight_col = 7; |
|
} |
# |
# |
# Create excel worksheet |
# Create excel worksheet |
my $filename = '/prtspool/'. |
my $filename = '/prtspool/'. |
Line 209 sub prepare_excel_output {
|
Line 224 sub prepare_excel_output {
|
# |
# |
# Populate the worksheet with the student data |
# Populate the worksheet with the student data |
foreach my $student (@$Students) { |
foreach my $student (@$Students) { |
|
last if ($c->aborted()); |
my $results = &Apache::loncoursedata::get_response_data_by_student |
my $results = &Apache::loncoursedata::get_response_data_by_student |
($student,$resource->{'symb'},$respid); |
($student,$resource->{'symb'},$respid); |
my %row; |
my %row; |
$row{'username'} = $student->{'username'}; |
$row{'username'} = $student->{'username'}; |
$row{'domain'} = $student->{'domain'}; |
$row{'domain'} = $student->{'domain'}; |
$row{'correct'} = $student->{'answer'}; |
$row{'correct'} = $student->{'answer'}; |
$row{'weight'} = &Apache::lonnet::EXT |
$row{'weight'} = &Apache::lonnet::EXT |
('resource.'.$partid.'.weight',$resource->{'symb'}, |
('resource.'.$partid.'.weight',$resource->{'symb'}, |
undef,undef,undef); |
undef,undef,undef); |
Line 284 sub prepare_excel_output {
|
Line 300 sub prepare_excel_output {
|
$r->print('<p><a href="'.$filename.'">'. |
$r->print('<p><a href="'.$filename.'">'. |
&mt('Your Excel spreadsheet.'). |
&mt('Your Excel spreadsheet.'). |
'</a></p>'."\n"); |
'</a></p>'."\n"); |
} |
$r->print('<script>'. |
|
'window.document.Statistics.stats_status.value="'. |
sub GetStudentAnswers { |
'Done compiling spreadsheet. See link below to download.'. |
my ($r,$problem,$Students) = @_; |
'";</script>'); |
my %Answers; |
|
my ($resource,$partid,$respid) = ($problem->{'resource'}, |
|
$problem->{'part'}, |
|
$problem->{'respid'}); |
|
# Open progress window |
|
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
|
($r,'Student Answer Compilation Status', |
|
'Student Answer Compilation Progress', scalar(@$Students)); |
|
$r->print("<table>\n"); |
|
$r->rflush(); |
$r->rflush(); |
foreach my $student (@$Students) { |
|
my $sname = $student->{'username'}; |
|
my $sdom = $student->{'domain'}; |
|
my $answer = &Apache::lonstathelpers::analyze_problem_as_student |
|
($resource,$sname,$sdom,$partid,$respid); |
|
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
|
&mt('last student')); |
|
$student->{'answer'} = $answer; |
|
} |
|
$r->print("</table>\n"); |
|
$r->rflush(); |
|
# close progress window |
|
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
|
return; |
|
} |
|
|
|
|
} |
|
|
######################################################### |
######################################################### |
######################################################### |
######################################################### |
Line 328 sub CreateInterface {
|
Line 321 sub CreateInterface {
|
my $Str = ''; |
my $Str = ''; |
$Str .= &Apache::lonhtmlcommon::breadcrumbs |
$Str .= &Apache::lonhtmlcommon::breadcrumbs |
(undef,'Student Submission Reports'); |
(undef,'Student Submission Reports'); |
|
$Str .= '<p>'; |
$Str .= '<table cellspacing="5">'."\n"; |
$Str .= '<table cellspacing="5">'."\n"; |
$Str .= '<tr>'; |
$Str .= '<tr>'; |
$Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>'; |
$Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>'; |
$Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>'; |
$Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>'; |
$Str .= '<td align="center"> </td>'; |
$Str .= '<td> </td>'; |
$Str .= '</tr>'."\n"; |
$Str .= '</tr>'."\n"; |
## |
# |
## |
|
$Str .= '<tr><td align="center">'."\n"; |
$Str .= '<tr><td align="center">'."\n"; |
$Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); |
$Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); |
$Str .= '</td>'; |
$Str .= '</td>'; |
Line 344 sub CreateInterface {
|
Line 337 sub CreateInterface {
|
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= '</td>'; |
$Str .= '</td>'; |
# |
# |
$Str .= '<td></td>'; |
my $checkbox = '<input type="checkbox" name="correctans" '; |
|
if (exists($ENV{'form.correctans'}) && $ENV{'form.correctans'} eq 'true') { |
|
$checkbox .= ' checked '; |
|
} |
|
$checkbox .= 'value="true" />'; |
|
$Str .= '<td align="center">'.'<label><b>'. |
|
&mt('compute correct answers [_1]',$checkbox).'</b></label>'.'</td>'; |
# |
# |
my $only_seq_with_assessments = sub { |
|
my $s=shift; |
|
if ($s->{'num_assess'} < 1) { |
|
return 0; |
|
} else { |
|
return 1; |
|
} |
|
}; |
|
## |
|
## |
|
$Str .= '</tr>'."\n"; |
$Str .= '</tr>'."\n"; |
$Str .= '</table>'."\n"; |
$Str .= '</table>'."\n"; |
# |
# |
# We do this to make sure the sequence information is initialized |
$Str .= '<nobr>'.&mt('Status: [_1]', |
&Apache::lonstatistics::MapSelect('Maps','multiple,all',5, |
'<input type="text" '. |
$only_seq_with_assessments); |
'name="stats_status" size="60" value="" />'). |
|
'</nobr>'.'</p>'; |
# |
## |
return $Str; |
return $Str; |
} |
} |
|
|