--- loncom/interface/spreadsheet/classcalc.pm 2003/05/23 19:36:04 1.3 +++ loncom/interface/spreadsheet/classcalc.pm 2003/05/23 21:03:29 1.4 @@ -1,5 +1,5 @@ # -# $Id: classcalc.pm,v 1.3 2003/05/23 19:36:04 matthew Exp $ +# $Id: classcalc.pm,v 1.4 2003/05/23 21:03:29 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -192,13 +192,6 @@ END return; } -sub outsheet_csv { - my $self = shift; - my ($r) = @_; - $r->print('

csv output is not supported yet

'); -} - - sub excel_rows { # writes the meat of the spreadsheet to an excel worksheet. Called # by Spreadsheet::outsheet_excel; @@ -229,6 +222,31 @@ sub excel_rows { 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 { my $self = shift;