--- loncom/interface/loncommon.pm 2008/02/24 22:59:13 1.641 +++ loncom/interface/loncommon.pm 2008/02/29 19:07:07 1.642 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.641 2008/02/24 22:59:13 raeburn Exp $ +# $Id: loncommon.pm,v 1.642 2008/02/29 19:07:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -6653,6 +6653,31 @@ sub personal_data_fieldtitles { return %fieldtitles; } +sub sorted_inst_types { + my ($dom) = @_; + my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($dom); + my $othertitle = &mt('All users'); + if ($env{'request.course.id'}) { + $othertitle = 'any'; + } + my @types; + if (ref($order) eq 'ARRAY') { + @types = @{$order}; + } + if (@types == 0) { + if (ref($usertypes) eq 'HASH') { + @types = sort(keys(%{$usertypes})); + } + } + if (keys(%{$usertypes}) > 0) { + $othertitle = &mt('Other users'); + if ($env{'request.course.id'}) { + $othertitle = 'other'; + } + } + return ($othertitle,$usertypes,\@types); +} + =pod =back