version 1.24, 2007/03/01 18:58:42
|
version 1.25, 2007/03/02 21:38:18
|
Line 126
|
Line 126
|
|
|
# Now go through classes and perform required enrollment changes. |
# Now go through classes and perform required enrollment changes. |
open (my $fh,">>$logfile"); |
open (my $fh,">>$logfile"); |
print $fh "********************\n".localtime(time)." Enrollment messages start --\n"; |
print $fh "********************\n".localtime(time).' '.&mt('Enrollment messages start').' --'."\n"; |
print $fh "Response from fetch_enrollment_query was $outcome\n"; |
print $fh &mt("Response from [_1] was [_2]",'fetch_enrollment_query',$outcome)."\n"; |
foreach my $crs (sort keys %enrollvar) { |
foreach my $crs (sort keys %enrollvar) { |
my $logmsg = ''; |
my $logmsg = ''; |
my $newusermsg = ''; |
my $newusermsg = ''; |
Line 135
|
Line 135
|
if ( ($enrollvar{$crs}{autostart} < $timenow) && ( ($enrollvar{$crs}{autoend} > $timenow) || ($enrollvar{$crs}{autoend} == 0) ) ) { |
if ( ($enrollvar{$crs}{autostart} < $timenow) && ( ($enrollvar{$crs}{autoend} > $timenow) || ($enrollvar{$crs}{autoend} == 0) ) ) { |
if (($enrollvar{$crs}{autoadds} == 1) || ($enrollvar{$crs}{autodrops} == 1)) { |
if (($enrollvar{$crs}{autoadds} == 1) || ($enrollvar{$crs}{autodrops} == 1)) { |
my ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$enrollvar{$crs}{autoadds},$enrollvar{$crs}{autodrops},$enrollvar{$crs}{startdate},$enrollvar{$crs}{enddate},$enrollvar{$crs}{authtype},$enrollvar{$crs}{autharg},\@{$affiliates{$crs}},\%{$LC_code{$crs}},\$logmsg,\$newusermsg,'automated'); |
my ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$enrollvar{$crs}{autoadds},$enrollvar{$crs}{autodrops},$enrollvar{$crs}{startdate},$enrollvar{$crs}{enddate},$enrollvar{$crs}{authtype},$enrollvar{$crs}{autharg},\@{$affiliates{$crs}},\%{$LC_code{$crs}},\$logmsg,\$newusermsg,'automated'); |
print $fh "Messages start for $crs\n"; |
print $fh &mt('Messages start for [_1]',$crs)."\n"; |
print $fh "$logmsg\n"; |
print $fh "$logmsg\n"; |
print $fh "Messages end for $crs\n"; |
print $fh &mt('Messages end for [_1]',$crs)."\n"; |
if ($changecount > 0) { |
if ($changecount > 0) { |
unless ($enrollvar{$crs}{notifylist} eq '') { |
unless ($enrollvar{$crs}{notifylist} eq '') { |
# Send message about enrollment changes to notifylist. |
# Send message about enrollment changes to notifylist. |
Line 152
|
Line 152
|
} |
} |
$env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$env{'user.domain'}); |
$env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$env{'user.domain'}); |
|
|
my $subject = "Student enrollment changes in $enrollvar{$crs}{coursecode}"; |
my $subject = &mt('Student enrollment changes in [_1]',$enrollvar{$crs}{coursecode}); |
my $message = "The following $changecount change(s) occurred in $enrollvar{$crs}{description} - $enrollvar{$crs}{coursecode} as a result of the automated classlist update:\n\n".$response; |
my $message = &mt('The following [quant,_1,change] occurred in [_2] - [_3] as a result of the automated classlist update:',$changecount,$enrollvar{$crs}{description},$enrollvar{$crs}{coursecode})."\n\n".$response; |
unless ($newusermsg eq '') { |
unless ($newusermsg eq '') { |
$message .= "\n".$newusermsg; |
$message .= "\n".$newusermsg; |
} |
} |
Line 173
|
Line 173
|
my $status = &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message); |
my $status = &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message); |
} |
} |
if ( ($enrollvar{$crs}{notifylist} eq '') && ($newusermsg ne '') ) { |
if ( ($enrollvar{$crs}{notifylist} eq '') && ($newusermsg ne '') ) { |
my $subject = "New user accounts in $enrollvar{$crs}{'coursecode'}"; |
my $subject = &mt('New user accounts in [_1]',$enrollvar{$crs}{'coursecode'}); |
my $status = &Apache::lonmsg::user_normal_msg($env{'user.name'},$env{'user.domain'},$subject,$newusermsg); |
my $status = &Apache::lonmsg::user_normal_msg($env{'user.name'},$env{'user.domain'},$subject,$newusermsg); |
} |
} |
delete($env{'user.name'}); |
delete($env{'user.name'}); |
Line 187
|
Line 187
|
} else { |
} else { |
if ( ($enrollvar{$crs}{autoadds} == 1) || ($enrollvar{$crs}{autodrops} == 1) ) { |
if ( ($enrollvar{$crs}{autoadds} == 1) || ($enrollvar{$crs}{autodrops} == 1) ) { |
if ( ($enrollvar{$crs}{autostart} < $timenow) && ( ($enrollvar{$crs}{autoend} > $timenow) || ($enrollvar{$crs}{autoend} == 0) ) ) { |
if ( ($enrollvar{$crs}{autostart} < $timenow) && ( ($enrollvar{$crs}{autoend} > $timenow) || ($enrollvar{$crs}{autoend} == 0) ) ) { |
print $fh "No institutional classlist data could be retrieved for $crs\n"; |
print $fh &mt('No institutional classlist data could be retrieved for [_1]',$crs)."\n"; |
} else { |
} else { |
print $fh "Not within time window for auto-enrollment in $crs\n"; |
print $fh ('Not within time window for auto-enrollment in [_1]',$crs)."\n"; |
} |
} |
} else { |
} else { |
print $fh "Auto-enrollment not currently enabled for $crs\n"; |
print $fh &mt('Auto-enrollment not currently enabled for [_1]',$crs)."\n"; |
} |
} |
} |
} |
} |
} |
print $fh "-- ".localtime(time)." Enrollment messages end\n*******************\n\n"; |
print $fh "-- ".localtime(time).' '.&mt('Enrollment messages end')."\n*******************\n\n"; |
close($fh); |
close($fh); |
delete($env{'user.domain'}); |
delete($env{'user.domain'}); |
# Check for photos |
|
} |
} |
|
|
1; |
1; |