version 1.1, 2003/12/05 17:03:05
|
version 1.2, 2003/12/08 16:00:15
|
Line 19 sub fetch_enrollment {
|
Line 19 sub fetch_enrollment {
|
if (defined $dbh) { |
if (defined $dbh) { |
$dbflag = 1; |
$dbflag = 1; |
foreach my $crs (sort keys %{$affiliatesref}) { |
foreach my $crs (sort keys %{$affiliatesref}) { |
my $xmlfile = $$configvars{'lonDaemons'}."/tmp/".$dom."_".$crs."_classlist.xml"; |
my $xmlstem = $$configvars{'lonDaemons'}."/tmp/".$dom."_".$crs."_"; |
$$replyref{$crs} = &write_class_data ($dbh,$xmlfile,\@{$$affiliatesref{$crs}}); |
$$replyref{$crs} = &write_class_data ($dbh,$xmlstem,\@{$$affiliatesref{$crs}}); |
} |
} |
$dbh->disconnect; |
$dbh->disconnect; |
} |
} |
Line 28 sub fetch_enrollment {
|
Line 28 sub fetch_enrollment {
|
} |
} |
|
|
sub write_class_data { |
sub write_class_data { |
my ($dbh,$xmlfile,$coursesref) = @_; |
my ($dbh,$xmlstem,$coursesref) = @_; |
my $stucount = 0; |
my $stucount = 0; |
open(FILE, ">$xmlfile"); |
foreach my $class (@{$coursesref}) { |
print FILE qq|<?xml version="1.0" encoding="UTF-8"?> |
if ($class =~ m/^([suf]s\d{2})(\w{2,3})(\d{3,4}\w?)(\d{3})$/) { |
|
my $xmlfile = $xmlstem.$class."_classlist.xml"; |
|
open(FILE, ">$xmlfile"); |
|
print FILE qq|<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE text> |
<!DOCTYPE text> |
<students> |
<students> |
|; |
|; |
foreach my $class (@{$coursesref}) { |
|
if ($class =~ m/^([suf]s\d{2})(\w{2,3})(\d{3,4}\w?)(\d{3})$/) { |
|
my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name FROM LONCAPA_ClassList WHERE Term_Code = '$1' AND Subj_Code = '$2' AND Crse_Code = '$3' AND Sctn_Code = '$4' ORDER BY Student_Name"); |
my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name FROM LONCAPA_ClassList WHERE Term_Code = '$1' AND Subj_Code = '$2' AND Crse_Code = '$3' AND Sctn_Code = '$4' ORDER BY Student_Name"); |
$sth->execute(); |
$sth->execute(); |
while ( my($pid,$pilot,$name) = $sth->fetchrow_array ) { |
while ( my($pid,$pilot,$name) = $sth->fetchrow_array ) { |
Line 76 sub write_class_data {
|
Line 78 sub write_class_data {
|
# If authentication, password, startdate or enddate are blank, the default for the course is used. These defaults can be modified using the Automated Enrollment Manager. |
# If authentication, password, startdate or enddate are blank, the default for the course is used. These defaults can be modified using the Automated Enrollment Manager. |
} |
} |
$sth->finish; |
$sth->finish; |
|
print FILE qq|</students>|; |
|
close(FILE); |
} |
} |
} |
} |
print FILE qq|</students>|; |
|
close(FILE); |
|
return $stucount; |
return $stucount; |
} |
} |
|
|