--- loncom/interface/lonprintout.pm 2012/05/28 10:31:17 1.616 +++ loncom/interface/lonprintout.pm 2012/06/07 10:27:26 1.618 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.616 2012/05/28 10:31:17 foxr Exp $ +# $Id: lonprintout.pm,v 1.618 2012/06/07 10:27:26 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -102,7 +102,6 @@ sub printable_sequence { if ($res->is_sequence()) { my $symb = $res->symb(); - &Apache::lonnet::logthis("Symb: $symb"); my $navmap = $res->{NAV_MAP}; # Find the first resource in the map: @@ -111,14 +110,7 @@ sub printable_sequence { my $first = $iterator->next(); while (1) { - if ($first == $iterator->END_ITERATOR) { - &Apache::lonnet::logthis("End of iterator"); - last; } - if (ref($first)) { - &Apache::lonnet::logthis("Looking at: " . $first->symb()); - } else { - &Apache::lonnet::logthis("Got: $first"); - } + if ($first == $iterator->END_ITERATOR) { last; } if (ref($first) && ! $first->is_sequence()) {last; } $first = $iterator->next(); } @@ -127,16 +119,11 @@ sub printable_sequence { # Might be an empty map: if (!ref($first)) { - &Apache::lonnet::logthis("printable_sequence: empty"); return 0; } my $partsref = $first->parts(); my @parts = @$partsref; - &Apache::lonnet::logthis("Dates for " . $first->symb()); my ($open, $close) = $navmap->map_printdates($first, $parts[0]); - &Apache::lonnet::logthis("Opens $open, closes $close"); - &Apache::lonnet::logthis(ctime($open)); - &Apache::lonnet::logthis(ctime($close)); return &printable($open, $close); } return 0; @@ -1246,6 +1233,22 @@ sub is_code_valid { } } +# +# Compare two students by section (Used to sort by section). +# +# Implicit inputs, +# $a - The first one +# $b - The second one. +# +# Returns: +# a-section cmp b-section +# +sub compare_sections { + my ($u1, $d1, $s1, $n1, $stat1) = split(/:/, $a); + my ($u2, $d2, $s2, $n2, $stat2) = split(/:/, $b); + + return $s1 cmp $s2; +} # Compare two students by name. The students are in the form # returned by the helper: @@ -3116,6 +3119,8 @@ ENDPART if (($helper->{'VARS'}->{'student_sort'} eq 1) && ($helper->{'VARS'}->{'SPLIT_PDFS'} ne "sections")) { @students = sort compare_names @students; + } else { + @students = sort compare_sections @students; } &adjust_number_to_print($helper);