--- loncom/interface/statistics/lonstathelpers.pm 2004/03/31 05:24:00 1.10 +++ loncom/interface/statistics/lonstathelpers.pm 2004/04/01 22:13:39 1.11 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstathelpers.pm,v 1.10 2004/03/31 05:24:00 albertel Exp $ +# $Id: lonstathelpers.pm,v 1.11 2004/04/01 22:13:39 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1001,6 +1001,43 @@ sub get_time_limits { return ($starttime,$endtime); } + + +#################################################### +#################################################### + +=pod + +=item sections_description + +Inputs: @Sections, an array of sections + +Returns: A text description of the sections selected. + +=cut + +#################################################### +#################################################### +sub sections_description { + my @Sections = @_; + my $sectionstring = ''; + if (scalar(@Sections) > 1) { + if (scalar(@Sections) > 2) { + my $last = pop(@Sections); + $sectionstring = "Sections ".join(', ',@Sections).', and '.$last; + } else { + $sectionstring = "Sections ".join(' and ',@Sections); + } + } else { + if ($Sections[0] eq 'all') { + $sectionstring = "All sections"; + } else { + $sectionstring = "Section ".$Sections[0]; + } + } + return $sectionstring; +} + #################################################### ####################################################