[system] / trunk / webwork / system / scripts / export_classlist-database.pl Repository:
ViewVC logotype

View of /trunk/webwork/system/scripts/export_classlist-database.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (download) (as text) (annotate)
Fri Jun 15 14:29:57 2001 UTC (12 years ago) by gage
File size: 2353 byte(s)
development version dev-1-7-01 from /ww/webwork/development 15-June-2001

    1 #!/usr/local/bin/perl
    2 
    3 ####################################################################
    4 # Copyright @ 1995-1999 University of Rochester
    5 # All Rights Reserved
    6 ####################################################################
    7 
    8 use lib '/ww/webwork/gage_system/webwork/system/lib/'; # mainWeBWorKDirectory
    9 
   10 use Global;
   11 use Auth;
   12 use strict;
   13 
   14 
   15 if (@ARGV != 2)
   16   {
   17    print "\nSyntax is export_webwork-database.pl courseID outputTextFile\n";
   18    print "      (e.g. export_webwork-database.pl  demoCourse textDatabase)\n\n";
   19    exit(0);
   20   }
   21 
   22 my $course = $ARGV[0];
   23 my $outFileName = $ARGV[1];
   24 
   25 # Give caller options
   26 
   27 
   28 # establish environment for this script
   29 
   30   &Global::getCourseEnvironment($course);
   31 
   32 # Directory paths
   33 
   34 my $databaseDirectory = getCourseDatabaseDirectory();
   35 my $courseScriptsDirectory = getWebworkScriptDirectory();
   36 
   37 # File names
   38 
   39 require "${courseScriptsDirectory}$Global::HTMLglue_pl";
   40 require "${courseScriptsDirectory}$Global::classlist_DBglue_pl";
   41 #require "${courseScriptsDirectory}$Global::classlist_DBglue_pl";
   42 require "${courseScriptsDirectory}$Global::FILE_pl";
   43 
   44 my $CL_Database = $Global::CL_Database;
   45 
   46 my $CL_status = get_CL_database_status();
   47 wwerror("Classlist Database is unlocked", "You must lock the classlist database
   48 before you can export it to an ascii file.") unless $CL_status eq 'locked';
   49 
   50 
   51 my ($studentID, $lastName, $firstName, $status, $comment,  $section, $recitation, $email_address, $login_name);
   52 my @login_names = @{&getAllLoginNamesSortedBySectionThenByName()};
   53 
   54 open(OUTFILE,">$outFileName") or wwerror("$0","can't open $outFileName for writing");
   55 
   56 foreach $login_name (@login_names) {
   57 
   58   attachCLRecord($login_name);
   59 
   60   $studentID =     &CL_getStudentID           ($login_name);
   61   $lastName =      &CL_getStudentLastName     ($login_name);
   62   $firstName =     &CL_getStudentFirstName    ($login_name);
   63   $status =        &CL_getStudentStatus       ($login_name);
   64   $comment =       &CL_getComment             ($login_name);
   65   $section =       &CL_getClassSection        ($login_name);
   66   $recitation =    &CL_getClassRecitation     ($login_name);
   67   $email_address = &CL_getStudentEmailAddress ($login_name);
   68 
   69 
   70     print OUTFILE "$studentID\, $lastName\, $firstName\, $status\, $comment\, $section\, $recitation\,  $email_address\, $login_name \n";
   71 
   72 
   73 }
   74 
   75 close(OUTFILE);
   76 
   77 &columnPrint("$outFileName","$outFileName");

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9