version 1.121, 2005/03/18 00:19:35
|
version 1.122, 2005/03/21 19:47:53
|
Line 359 sub get_selected_sections {
|
Line 359 sub get_selected_sections {
|
|
|
=item §ion_and_enrollment_description |
=item §ion_and_enrollment_description |
|
|
|
Returns a string describing the currenly selected section(s) and |
|
enrollment status. |
|
|
|
Inputs: mode = 'plaintext' or 'localized' (defaults to 'localized') |
|
'plaintext' is used for example in Excel spreadsheets. |
|
Returns: scalar description string. |
|
|
=cut |
=cut |
|
|
####################################################### |
####################################################### |
####################################################### |
####################################################### |
sub section_and_enrollment_description { |
sub section_and_enrollment_description { |
|
my ($mode) = @_; |
|
if (! defined($mode)) { $mode = 'localized'; } |
my @sections = &Apache::lonstatistics::get_selected_sections(); |
my @sections = &Apache::lonstatistics::get_selected_sections(); |
my $description = &mt('Unable to determine section and enrollment'); |
my $description; |
|
if ($mode eq 'localized') { |
|
$description = &mt('Unable to determine section and enrollment'); |
|
} elsif ($mode eq 'plaintext') { |
|
$description = 'Unable to determine section and enrollment'; |
|
} else { |
|
$description = 'Bad parameter passed to lonstatistics::section_and_enrollment_description'; |
|
&Apache::lonnet::logthis($description); |
|
} |
if (scalar(@sections) == 1 && $sections[0] ne 'all') { |
if (scalar(@sections) == 1 && $sections[0] ne 'all') { |
$description = &mt('Section [_1]. [_2] enrollment status.', |
if ($mode eq 'localized') { |
$sections[0],$ENV{'form.Status'}); |
$description = &mt('Section [_1]. [_2] enrollment status.', |
|
$sections[0],$ENV{'form.Status'}); |
|
} elsif ($mode eq 'plaintext') { |
|
$description = 'Section '.$sections[0].'. '. |
|
$ENV{'form.Status'}.' enrollment status.'; |
|
} |
} elsif (scalar(@sections) && $sections[0] eq 'all') { |
} elsif (scalar(@sections) && $sections[0] eq 'all') { |
$description = &mt('All sections. [_1] enrollment status.', |
if ($mode eq 'localized') { |
$ENV{'form.Status'}); |
$description = &mt('All sections. [_1] enrollment status.', |
|
$ENV{'form.Status'}); |
|
} elsif ($mode eq 'plaintext') { |
|
$description = 'All sections. '. |
|
$ENV{'form.Status'}.' enrollment status.'; |
|
} |
} elsif (scalar(@sections)) { |
} elsif (scalar(@sections)) { |
my $lastsection = pop(@sections); |
my $lastsection = pop(@sections); |
$description = &mt('Sections [_1] and [_2]. [_3] enrollment status.', |
if ($mode eq 'localized') { |
join(', ',@sections),$lastsection, |
$description = &mt('Sections [_1] and [_2]. [_3] enrollment status.', |
$ENV{'form.Status'}); |
join(', ',@sections),$lastsection, |
|
$ENV{'form.Status'}); |
|
} elsif ($mode eq 'plaintext') { |
|
$description = |
|
'Sections '.join(', ',@sections).' and '.$lastsection.'. '. |
|
$ENV{'form.Status'}.' enrollment status.'; |
|
} |
} |
} |
return $description; |
return $description; |
} |
} |