[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 25 Apr 2006 21:24:07 -0000
albertel Tue Apr 25 17:24:07 2006 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- find all courses now can take a list of roles that you want curse for
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.354 loncom/interface/loncommon.pm:1.355
--- loncom/interface/loncommon.pm:1.354 Tue Apr 25 16:48:38 2006
+++ loncom/interface/loncommon.pm Tue Apr 25 17:24:06 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.354 2006/04/25 20:48:38 albertel Exp $
+# $Id: loncommon.pm,v 1.355 2006/04/25 21:24:06 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2610,12 +2610,16 @@
#########################################
sub findallcourses {
+ my ($roles) = @_;
+ my %roles;
+ if (ref($roles)) { %roles = map { $_ => 1 } @{$roles}; }
my %courses;
my $now=time;
foreach my $key (keys(%env)) {
if ( $key=~m{^user\.role\.(\w+)\./(\w+)/(\w+)} ) {
my ($role,$domain,$id) = ($1,$2,$3);
next if ($role eq 'ca' || $role eq 'aa');
+ next if (%roles && !exists($roles{$role}));
my ($starttime,$endtime)=split(/\./,$env{$key});
my $active=1;
if ($starttime) {