version 1.816, 2006/12/28 19:59:48
|
version 1.817, 2006/12/28 20:09:10
|
Line 920 sub getsection {
|
Line 920 sub getsection {
|
# If there is a role which has expired, return it. |
# If there is a role which has expired, return it. |
# |
# |
$courseid = &courseid_to_courseurl($courseid); |
$courseid = &courseid_to_courseurl($courseid); |
foreach my $line (split(/\&/,&reply('dump:'.$udom.':'.$unam.':roles', |
my %roleshash = &dump('roles',$udom,$unam,$courseid); |
&homeserver($unam,$udom)))) { |
foreach my $key (keys(%roleshash)) { |
my ($key,$value)=split(/\=/,$line,2); |
|
$key=&unescape($key); |
|
next if ($key !~/^\Q$courseid\E(?:\/)*(\w+)*\_st$/); |
next if ($key !~/^\Q$courseid\E(?:\/)*(\w+)*\_st$/); |
my $section=$1; |
my $section=$1; |
if ($key eq $courseid.'_st') { $section=''; } |
if ($key eq $courseid.'_st') { $section=''; } |
my ($dummy,$end,$start)=split(/\_/,&unescape($value)); |
my ($dummy,$end,$start)=split(/\_/,&unescape($roleshash{$key})); |
my $now=time; |
my $now=time; |
if (defined($end) && $end && ($now > $end)) { |
if (defined($end) && $end && ($now > $end)) { |
$Expired{$end}=$section; |
$Expired{$end}=$section; |
Line 4515 sub get_users_groups {
|
Line 4513 sub get_users_groups {
|
$grouplist = ''; |
$grouplist = ''; |
my $courseurl = &courseid_to_courseurl($courseid); |
my $courseurl = &courseid_to_courseurl($courseid); |
my %roleshash = &dump('roles',$udom,$uname,$courseurl); |
my %roleshash = &dump('roles',$udom,$uname,$courseurl); |
my ($tmp) = keys(%roleshash); |
my $access_end = $env{'course.'.$courseid. |
if ($tmp=~/^error:/) { |
'.default_enrollment_end_date'}; |
&logthis('Error retrieving roles: '.$tmp.' for '.$uname.':'.$udom); |
my $now = time; |
} else { |
foreach my $key (keys(%roleshash)) { |
my $access_end = $env{'course.'.$courseid. |
if ($key =~ /^\Q$courseurl\E\/(\w+)\_gr$/) { |
'.default_enrollment_end_date'}; |
my $group = $1; |
my $now = time; |
if ($roleshash{$key} =~ /_(\d+)_(\d+)$/) { |
foreach my $key (keys(%roleshash)) { |
my $start = $2; |
if ($key =~ /^\Q$courseurl\E\/(\w+)\_gr$/) { |
my $end = $1; |
my $group = $1; |
if ($start == -1) { next; } # deleted from group |
if ($roleshash{$key} =~ /_(\d+)_(\d+)$/) { |
if (($start!=0) && ($start>$now)) { next; } |
my $start = $2; |
if (($end!=0) && ($end<$now)) { |
my $end = $1; |
if ($access_end && $access_end < $now) { |
if ($start == -1) { next; } # deleted from group |
if ($access_end - $end < 86400) { |
if (($start!=0) && ($start>$now)) { next; } |
push(@usersgroups,$group); |
if (($end!=0) && ($end<$now)) { |
|
if ($access_end && $access_end < $now) { |
|
if ($access_end - $end < 86400) { |
|
push(@usersgroups,$group); |
|
} |
|
} |
} |
next; |
|
} |
} |
push(@usersgroups,$group); |
next; |
} |
} |
|
push(@usersgroups,$group); |
} |
} |
} |
} |
@usersgroups = &sort_course_groups($courseid,@usersgroups); |
|
$grouplist = join(':',@usersgroups); |
|
&do_cache_new('getgroups',$hashid,$grouplist,$cachetime); |
|
} |
} |
|
@usersgroups = &sort_course_groups($courseid,@usersgroups); |
|
$grouplist = join(':',@usersgroups); |
|
&do_cache_new('getgroups',$hashid,$grouplist,$cachetime); |
} |
} |
return @usersgroups; |
return @usersgroups; |
} |
} |