--- loncom/interface/statistics/lonstathelpers.pm 2004/03/16 16:41:26 1.9 +++ 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.9 2004/03/16 16:41:26 matthew Exp $ +# $Id: lonstathelpers.pm,v 1.11 2004/04/01 22:13:39 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -478,11 +478,11 @@ sub get_answer { } foreach my $foil (@{$Answer{$prefix.'.shown'}}) { if (ref($values{$foil}) eq 'ARRAY') { - $returnvalue.=&HTML::Entities::encode($foil).'='. - join(',',map {&HTML::Entities::encode($_)} @{$values{$foil}}).'&'; + $returnvalue.=&HTML::Entities::encode($foil,'<>&"').'='. + join(',',map {&HTML::Entities::encode($_,'<>&"')} @{$values{$foil}}).'&'; } else { - $returnvalue.=&HTML::Entities::encode($foil).'='. - &HTML::Entities::encode($values{$foil}).'&'; + $returnvalue.=&HTML::Entities::encode($foil,'<>&"').'='. + &HTML::Entities::encode($values{$foil},'<>&"').'&'; } } $returnvalue =~ s/ /\%20/g; @@ -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; +} + #################################################### ####################################################