--- loncom/interface/loncommon.pm 2009/05/18 16:08:07 1.820 +++ loncom/interface/loncommon.pm 2009/05/18 16:29:55 1.821 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.820 2009/05/18 16:08:07 raeburn Exp $ +# $Id: loncommon.pm,v 1.821 2009/05/18 16:29:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -6791,6 +6791,38 @@ sub get_users_function { } ############################################### + +=pod + +=item * &show_course() + +Used by lonmenu.pm and lonroles.pm to determine whether to use the word +'Courses' or 'Roles' in inline navigation and on screen displaying user's roles. + +Inputs: +None + +Outputs: +Scalar: 1 if 'Course' to be used, 0 otherwise. + +=cut + +############################################### +sub show_course { + my $course = !$env{'user.adv'}; + if (!$env{'user.adv'}) { + foreach my $env (keys(%env)) { + next if ($env !~ m/^user\.priv\./); + if ($env !~ m/^user\.priv\.(?:st|cm)/) { + $course = 0; + last; + } + } + } + return $course; +} + +############################################### =pod