[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 70 - (download) (as text) (annotate)
Mon Jun 25 18:20:05 2001 UTC (18 years, 5 months ago) by sam
File size: 2527 byte(s)
Removed unneeded scripts (as per discussion with gage, apizer). Added
BEGIN-block method for library inclusion to command-line scripts.

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9