#!/usr/local/bin/webwork-perl #################################################################### # Copyright @ 1995-1999 University of Rochester # All Rights Reserved #################################################################### use lib '.'; use webworkInit; # WeBWorKInitLine use Global; use Auth; use strict; if (@ARGV != 2) { print "\nSyntax is export_webwork-database.pl courseID outputTextFile\n"; print " (e.g. export_webwork-database.pl demoCourse textDatabase)\n\n"; exit(0); } my $course = $ARGV[0]; my $outFileName = $ARGV[1]; # Give caller options # establish environment for this script &Global::getCourseEnvironment($course); # Directory paths my $databaseDirectory = getCourseDatabaseDirectory(); my $courseScriptsDirectory = getWebworkScriptDirectory(); # File names require "${courseScriptsDirectory}$Global::HTMLglue_pl"; require "${courseScriptsDirectory}$Global::classlist_DBglue_pl"; #require "${courseScriptsDirectory}$Global::classlist_DBglue_pl"; require "${courseScriptsDirectory}$Global::FILE_pl"; my $CL_Database = $Global::CL_Database; my $CL_status = get_CL_database_status(); wwerror("Classlist Database is unlocked", "You must lock the classlist database before you can export it to an ascii file.") unless $CL_status eq 'locked'; my ($studentID, $lastName, $firstName, $status, $comment, $section, $recitation, $email_address, $login_name); my @login_names = @{&getAllLoginNamesSortedBySectionThenByName()}; open(OUTFILE,">$outFileName") or wwerror("$0","can't open $outFileName for writing"); foreach $login_name (@login_names) { attachCLRecord($login_name); $studentID = &CL_getStudentID ($login_name); $lastName = &CL_getStudentLastName ($login_name); $firstName = &CL_getStudentFirstName ($login_name); $status = &CL_getStudentStatus ($login_name); $comment = &CL_getComment ($login_name); $section = &CL_getClassSection ($login_name); $recitation = &CL_getClassRecitation ($login_name); $email_address = &CL_getStudentEmailAddress ($login_name); print OUTFILE "$studentID\, $lastName\, $firstName\, $status\, $comment\, $section\, $recitation\, $email_address\, $login_name \n"; } close(OUTFILE); &columnPrint("$outFileName","$outFileName");