version 1.3, 2003/05/23 19:36:04
|
version 1.5, 2003/05/27 14:52:45
|
Line 51 use Apache::loncoursedata();
|
Line 51 use Apache::loncoursedata();
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::Spreadsheet; |
use Apache::Spreadsheet; |
use Apache::studentcalc; |
use Apache::studentcalc; |
|
use Apache::lonstatistics(); |
use HTML::Entities(); |
use HTML::Entities(); |
use Spreadsheet::WriteExcel; |
use Spreadsheet::WriteExcel; |
use Apache::lonnet; |
use Apache::lonnet; |
Line 61 use Time::HiRes;
|
Line 62 use Time::HiRes;
|
sub html_header { |
sub html_header { |
my $self = shift; |
my $self = shift; |
my ($toprow,$bottomrow); |
my ($toprow,$bottomrow); |
foreach (['Sections','Section selector goes here'], |
&Apache::lonstatistics::clear_classlist_variables(); |
|
foreach (['Sections',&Apache::lonstatistics::SectionSelect('Section','multpile',3)], |
['Enrollment Status',&Apache::lonhtmlcommon::StatusOptions(undef,undef,3)], |
['Enrollment Status',&Apache::lonhtmlcommon::StatusOptions(undef,undef,3)], |
['Output Format',&Apache::Spreadsheet::output_selector()]) { |
['Output Format',&Apache::Spreadsheet::output_selector()]) { |
my ($name,$selector) = @{$_}; |
my ($name,$selector) = @{$_}; |
Line 76 sub html_header {
|
Line 78 sub html_header {
|
|
|
sub get_classlist { |
sub get_classlist { |
my $self = shift; |
my $self = shift; |
# Retrieve the classlist |
# Retrieve the classlist and return it |
my @Students = (); |
return &Apache::lonstatistics::get_students(); |
my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist |
|
($self->{'cid'},$self->{'cdom'},$self->{'cnum'}); |
|
while (my ($student,$student_data) = each (%$classlist)) { |
|
my $studenthash = (); |
|
for (my $i=0; $i< scalar(@$field_names);$i++) { |
|
my $field = $field_names->[$i]; |
|
$studenthash->{$field}=$student_data->[$i]; |
|
} |
|
# This is where we can skip students because they are in |
|
# the wrong section, have expired or pending roles, whatever... |
|
push (@Students,$studenthash); |
|
} |
|
my @SortedStudents = sort { $a->{'fullname'} cmp $b->{'fullname'} } @Students; |
|
return @SortedStudents; |
|
} |
} |
|
|
sub get_title { |
sub get_title { |
Line 192 END
|
Line 180 END
|
return; |
return; |
} |
} |
|
|
sub outsheet_csv { |
|
my $self = shift; |
|
my ($r) = @_; |
|
$r->print('<h1>csv output is not supported yet</h1>'); |
|
} |
|
|
|
|
|
sub excel_rows { |
sub excel_rows { |
# writes the meat of the spreadsheet to an excel worksheet. Called |
# writes the meat of the spreadsheet to an excel worksheet. Called |
# by Spreadsheet::outsheet_excel; |
# by Spreadsheet::outsheet_excel; |
Line 229 sub excel_rows {
|
Line 210 sub excel_rows {
|
return; |
return; |
} |
} |
|
|
|
sub csv_rows { |
|
# writes the meat of the spreadsheet to an excel worksheet. Called |
|
# by Spreadsheet::outsheet_excel; |
|
my $self = shift; |
|
my ($filehandle) = @_; |
|
# |
|
# Write a header row |
|
|
|
$self->csv_output_row($filehandle,undef, |
|
('fullname','username','domain','section','status')); |
|
# |
|
# Write each students row |
|
foreach my $student ($self->get_classlist()) { |
|
my $rownum = $self->get_row_number_from_key |
|
($student->{'username'}.':'.$student->{'domain'}); |
|
$student->{'section'} = 'none' if ($student->{'section'} eq '-1'); |
|
my @studentdata = ($student->{'fullname'}, |
|
$student->{'username'}, |
|
$student->{'domain'}, |
|
$student->{'section'}, |
|
$student->{'status'}); |
|
$self->csv_output_row($filehandle,$rownum,@studentdata); |
|
} |
|
return; |
|
} |
|
|
sub outsheet_recursive_excel { |
sub outsheet_recursive_excel { |
my $self = shift; |
my $self = shift; |