version 1.34, 2016/09/14 20:58:27
|
version 1.35, 2021/06/15 20:52:27
|
Line 74
|
Line 74
|
# Determine the courses |
# Determine the courses |
my %courses = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@hostids,'Course'); |
my %courses = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@hostids,'Course'); |
my %affiliates = (); |
my %affiliates = (); |
|
my %unclutteredsec = (); |
|
my %unclutteredlcsec = (); |
my %enrollvar = (); |
my %enrollvar = (); |
my %reply = (); |
my %reply = (); |
my %LC_code = (); |
my %LC_code = (); |
Line 120
|
Line 122
|
$sections[0] = $enrollvar{$crs}{sectionnums}; |
$sections[0] = $enrollvar{$crs}{sectionnums}; |
} |
} |
if ($enrollvar{$crs}{crosslistings} =~ m/,/) { |
if ($enrollvar{$crs}{crosslistings} =~ m/,/) { |
@crosslistings = split/,/,$enrollvar{$crs}{crosslistings} |
@crosslistings = split/,/,$enrollvar{$crs}{crosslistings}; |
} else { |
} else { |
@crosslistings = $enrollvar{$crs}{crosslistings}; |
@crosslistings = $enrollvar{$crs}{crosslistings}; |
} |
} |
|
my $crscode = $enrollvar{$crs}{coursecode}; |
|
my $crskey = $crs.':'.$crscode; |
|
@{$unclutteredsec{$crskey}} = (); |
|
@{$unclutteredlcsec{$crskey}} = (); |
foreach my $sec (@sections) { |
foreach my $sec (@sections) { |
if ($sec =~ m/^(\w+):(\w*)$/ ) { |
if ($sec =~ m/^(\w+):(\w*)$/ ) { |
my $course_id = $enrollvar{$crs}{coursecode}.$1; |
my $instsec = $1; |
my $gp = $2; |
my $gp = $2; |
if (!grep/^\Q$course_id\E$/,@{$affiliates{$crs}}) { |
unless (grep/^\Q$instsec\E$/,@{$unclutteredsec{$crskey}}) { |
push @{$affiliates{$crs}}, $course_id; |
push(@{$unclutteredsec{$crskey}},$instsec); |
$LC_code{$crs}{$course_id} = $gp; |
push(@{$unclutteredlcsec{$crskey}},$gp); |
} |
} |
} |
} |
} |
} |
Line 146
|
Line 152
|
} |
} |
} |
} |
} |
} |
|
} |
|
my %formattedsec = &Apache::lonnet::auto_instsec_reformat($dom,'clutter',\%unclutteredsec); |
|
foreach my $crskey (keys(%formattedsec)) { |
|
my ($crs,$instcode) = split(/:/,$crskey); |
|
if ((ref($formattedsec{$crskey}) eq 'ARRAY') && (ref($unclutteredlcsec{$crskey}) eq 'ARRAY')) { |
|
for (my $i=0; $i<@{$formattedsec{$crskey}}; $i++) { |
|
my $course_id = $instcode.$formattedsec{$crskey}[$i]; |
|
unless (grep/^\Q$course_id\E$/,@{$affiliates{$crs}}) { |
|
push(@{$affiliates{$crs}},$course_id); |
|
$LC_code{$crs}{$course_id} = $unclutteredlcsec{$crskey}[$i]; |
|
} |
|
} |
|
} |
} |
} |
my $outcome = &Apache::lonnet::fetch_enrollment_query('automated',\%affiliates,\%reply,$dom); |
my $outcome = &Apache::lonnet::fetch_enrollment_query('automated',\%affiliates,\%reply,$dom); |
|
|