[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet classcalc.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 27 May 2003 14:52:45 -0000


matthew		Tue May 27 10:52:45 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	classcalc.pm 
  Log:
  Use lonstatistics to retrieve the list of students.   Added output of
  the section selector dialog.  Seems to work.
  
  
Index: loncom/interface/spreadsheet/classcalc.pm
diff -u loncom/interface/spreadsheet/classcalc.pm:1.4 loncom/interface/spreadsheet/classcalc.pm:1.5
--- loncom/interface/spreadsheet/classcalc.pm:1.4	Fri May 23 17:03:29 2003
+++ loncom/interface/spreadsheet/classcalc.pm	Tue May 27 10:52:45 2003
@@ -1,5 +1,5 @@
 #
-# $Id: classcalc.pm,v 1.4 2003/05/23 21:03:29 matthew Exp $
+# $Id: classcalc.pm,v 1.5 2003/05/27 14:52:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -51,6 +51,7 @@
 use Apache::lonhtmlcommon();
 use Apache::Spreadsheet;
 use Apache::studentcalc;
+use Apache::lonstatistics();
 use HTML::Entities();
 use Spreadsheet::WriteExcel;
 use Apache::lonnet;
@@ -61,7 +62,8 @@
 sub html_header {
     my $self = shift;
     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)],
              ['Output Format',&Apache::Spreadsheet::output_selector()]) {
         my ($name,$selector) = @{$_};
@@ -76,22 +78,8 @@
 
 sub get_classlist {
     my $self = shift;
-    # Retrieve the classlist
-    my @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;
+    # Retrieve the classlist and return it 
+    return &Apache::lonstatistics::get_students();
 }
 
 sub get_title {