version 1.1, 2003/12/05 17:03:05
|
version 1.3, 2003/12/09 20:06:37
|
Line 1
|
Line 1
|
|
# local bits for automated enrollment |
|
# $Id$ |
|
# |
|
# Copyright Michigan State University Board of Trustees |
|
# |
|
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
|
# |
|
# LON-CAPA is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; either version 2 of the License, or |
|
# (at your option) any later version. |
|
# |
|
# LON-CAPA is distributed in the hope that it will be useful, |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
# GNU General Public License for more details. |
|
# |
|
# You should have received a copy of the GNU General Public License |
|
# along with LON-CAPA; if not, write to the Free Software |
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
|
# /home/httpd/html/adm/gpl.txt |
|
# |
|
# http://www.lon-capa.org/ |
|
# |
package localenroll; |
package localenroll; |
|
|
use strict; |
use strict; |
Line 19 sub fetch_enrollment {
|
Line 44 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 53 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 103 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; |
} |
} |
|
|