version 1.62, 2011/01/17 00:19:41
|
version 1.66, 2011/12/21 21:25:51
|
Line 35 use Apache::loncoursedata();
|
Line 35 use Apache::loncoursedata();
|
use Apache::lonstatistics; |
use Apache::lonstatistics; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonstathelpers; |
use Apache::lonstathelpers; |
|
use Apache::lonmsgdisplay(); |
use HTML::Entities(); |
use HTML::Entities(); |
use Time::Local(); |
use Time::Local(); |
use Spreadsheet::WriteExcel(); |
use Spreadsheet::WriteExcel(); |
Line 324 sub prepare_html_output {
|
Line 325 sub prepare_html_output {
|
my @extra_resp_headers = &get_extra_response_headers($show_named); |
my @extra_resp_headers = &get_extra_response_headers($show_named); |
# |
# |
# Create the table header |
# Create the table header |
my @student_columns; |
my @student_columns = &get_student_columns($show_named); |
if ($show_named) { |
|
@student_columns = @Apache::lonstatistics::SelectedStudentData; |
|
if (grep(/^all$/,@student_columns)) { |
|
@student_columns = qw(fullname username domain id section status groups comments); |
|
} |
|
} else { |
|
@student_columns = ('username'); |
|
} |
|
# |
|
my %headers; |
my %headers; |
my $student_column_count = scalar(@student_columns); |
my $student_column_count = scalar(@student_columns); |
$headers{'problem'} = qq{<th colspan="$student_column_count">\ </th>}; |
$headers{'problem'} = qq{<th colspan="$student_column_count">\ </th>}; |
foreach (@student_columns) { |
foreach my $field (@student_columns) { |
$headers{'student'}.= '<th>'.ucfirst($_).'</th>'; |
$headers{'student'}.= '<th>'.ucfirst($field).'</th>'; |
} |
} |
# |
# |
# we put the headers into the %headers hash |
# we put the headers into the %headers hash |
my $total_col = scalar(@student_columns); |
my $total_col = $student_column_count; |
my $nonempty_part_headers = 0; |
my $nonempty_part_headers = 0; |
# |
# |
my %problem_analysis; |
my %problem_analysis; |
Line 839 sub prepare_excel_output {
|
Line 831 sub prepare_excel_output {
|
$worksheet->write($partid_row,0,'Part ID',$format->{'bold'}); |
$worksheet->write($partid_row,0,'Part ID',$format->{'bold'}); |
$worksheet->write($respid_row,0,'Response ID',$format->{'bold'}); |
$worksheet->write($respid_row,0,'Response ID',$format->{'bold'}); |
# Student headers |
# Student headers |
my @StudentColumns; |
my @StudentColumns = &get_student_columns($show_named); |
if ($show_named) { |
foreach my $field (@StudentColumns) { |
@StudentColumns = qw(username domain id section); |
$worksheet->write($header_row,$cols_output++,ucfirst($field), |
} else { |
|
@StudentColumns = qw(username); |
|
} |
|
foreach (@StudentColumns) { |
|
$worksheet->write($header_row,$cols_output++,ucfirst($_), |
|
$format->{'bold'}); |
$format->{'bold'}); |
} |
} |
# Problem headers |
# Problem headers |
Line 888 sub prepare_excel_output {
|
Line 875 sub prepare_excel_output {
|
} |
} |
# |
# |
# Populate the worksheet with the student data |
# Populate the worksheet with the student data |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,scalar(@$Students)); |
($r,'Excel File Compilation Status', |
|
'Excel File Compilation Progress', |
|
scalar(@$Students),'inline',undef,'Statistics','stats_status'); |
|
my $max_row = $rows_output; |
my $max_row = $rows_output; |
foreach my $student (@$Students) { |
foreach my $student (@$Students) { |
last if ($c->aborted()); |
last if ($c->aborted()); |
$cols_output = 0; |
$cols_output = 0; |
my $student_row = $max_row; |
my $student_row = $max_row; |
foreach my $field (@StudentColumns) { |
|
if ($show_named) { |
|
$worksheet->write($student_row,$cols_output++, |
|
$student->{$field}); |
|
} else { |
|
$worksheet->write($student_row,$cols_output++, |
|
&mt('Anonymized')); |
|
} |
|
} |
|
my $last_student_col = $cols_output-1; |
|
foreach my $prob (@$Problems) { |
foreach my $prob (@$Problems) { |
my $symb = $prob->symb(); |
my $symb = $prob->symb(); |
foreach my $partid (@{$prob->parts}) { |
foreach my $partid (@{$prob->parts}) { |
Line 961 sub prepare_excel_output {
|
Line 935 sub prepare_excel_output {
|
} |
} |
} |
} |
} |
} |
# Fill in the remaining rows with the students data |
# Prepend current student's user information to all rows |
for (my $row = $student_row+1;$row<$max_row;$row++) { |
for (my $row = $student_row;$row<$max_row;$row++) { |
my $cols = 0; |
my $cols = 0; |
foreach my $field (@StudentColumns) { |
foreach my $field (@StudentColumns) { |
if ($show_named) { |
if ($show_named) { |
$worksheet->write($row,$cols++, |
my $value = $student->{$field}; |
$student->{$field}); |
if ($field eq 'comments') { |
|
$value = &Apache::lonmsgdisplay::retrieve_instructor_comments |
|
($student->{'username'},$student->{'domain'}); |
|
} |
|
$worksheet->write($row,$cols++,$value); |
} else { |
} else { |
$worksheet->write($row,$cols++, |
$worksheet->write($row,$cols++, |
&mt('Anonymized')); |
&mt('Anonymized')); |
} |
} |
} |
} |
} |
} |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student'); |
'last student'); |
|
} |
} |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
# |
# |
Line 1088 sub prepare_csv_output {
|
Line 1065 sub prepare_csv_output {
|
&mt('Generating CSV report of student responses').'</h2>'); |
&mt('Generating CSV report of student responses').'</h2>'); |
# |
# |
# Progress window |
# Progress window |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,scalar(@$students)); |
($r,'CSV File Compilation Status', |
|
'CSV File Compilation Progress', |
|
scalar(@$students),'inline',undef,'Statistics','stats_status'); |
|
|
|
$r->rflush(); |
$r->rflush(); |
# |
# |
Line 1116 sub prepare_csv_output {
|
Line 1090 sub prepare_csv_output {
|
my @extra_resp_headers = &get_extra_response_headers($show_named); |
my @extra_resp_headers = &get_extra_response_headers($show_named); |
# |
# |
# Create the table header |
# Create the table header |
my @student_columns = ('username','domain','id','section'); |
my @student_columns = &get_student_columns($show_named); |
if ($show_named) { |
|
@student_columns = qw(username domain id section); |
|
} else { |
|
@student_columns = qw(username); |
|
} |
|
my $student_column_count = scalar(@student_columns); |
my $student_column_count = scalar(@student_columns); |
# |
# |
my %headers; |
my %headers; |
Line 1134 sub prepare_csv_output {
|
Line 1103 sub prepare_csv_output {
|
# we put the headers into the %headers hash |
# we put the headers into the %headers hash |
my %problem_analysis; |
my %problem_analysis; |
my %start_col; |
my %start_col; |
my $max_column = scalar(@student_columns); |
my $max_column = $student_column_count; |
foreach my $prob (@$problems) { |
foreach my $prob (@$problems) { |
my $symb = $prob->symb(); |
my $symb = $prob->symb(); |
my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src); |
my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src); |
Line 1225 sub prepare_csv_output {
|
Line 1194 sub prepare_csv_output {
|
foreach my $row (@rows) { |
foreach my $row (@rows) { |
my $student_row_data = ''; |
my $student_row_data = ''; |
if ($show_named) { |
if ($show_named) { |
$student_row_data = '"'.join('","', |
foreach my $field (@student_columns) { |
map { $student->{$_}; } |
my $value = $student->{$field}; |
@student_columns).'"'; |
if ($field eq 'comments') { |
|
$value = &Apache::lonmsgdisplay::retrieve_instructor_comments |
|
($student->{'username'},$student->{'domain'}); |
|
} |
|
$student_row_data .= '"'.&Apache::loncommon::csv_translate($value).'",'; |
|
} |
|
$student_row_data =~ s/,$//; |
} else { |
} else { |
$student_row_data = '"'.&mt('Anonymized').'"'; |
$student_row_data = '"'.&mt('Anonymized').'"'; |
} |
} |
Line 1240 sub prepare_csv_output {
|
Line 1215 sub prepare_csv_output {
|
print $outputfile $/; |
print $outputfile $/; |
} |
} |
undef(@rows); |
undef(@rows); |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student'); |
'last student'); |
|
} |
} |
close($outputfile); |
close($outputfile); |
# |
# |
Line 1365 sub CreateInterface {
|
Line 1339 sub CreateInterface {
|
$Str .= &Apache::loncommon::end_data_table_row(); |
$Str .= &Apache::loncommon::end_data_table_row(); |
$Str .= &Apache::loncommon::end_data_table(); |
$Str .= &Apache::loncommon::end_data_table(); |
# |
# |
$Str .= '<p><span class="LC_nobreak">' |
|
.&mt('Status: [_1]', |
|
'<input type="text" name="stats_status"' |
|
.' size="60" value="" readonly="readonly" />') |
|
.'</span></p>'; |
|
## |
|
return $Str; |
return $Str; |
} |
} |
|
|
|
sub get_student_columns { |
|
my ($show_named) = @_; |
|
my @student_columns; |
|
if ($show_named) { |
|
@student_columns = @Apache::lonstatistics::SelectedStudentData; |
|
if (grep(/^all$/,@student_columns)) { |
|
@student_columns = qw(fullname username domain id section status groups comments); |
|
} |
|
} else { |
|
@student_columns = ('username'); |
|
} |
|
return @student_columns; |
|
} |
|
|
1; |
1; |
|
|
__END__ |
__END__ |