[system] / trunk / webwork / system / scripts / getData.pl Repository:
ViewVC logotype

Annotation of /trunk/webwork/system/scripts/getData.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (view) (download) (as text)

1 : sam 11 #!/usr/local/bin/webwork-perl
2 : sam 2
3 :     ## $Id$
4 :    
5 :     # This file is getAllProbSetKeysForSet.pl
6 :     #
7 :     # It is called from a form with inputs 'course' and 'set number'
8 :     # #############################################################
9 :     # Copyright @1996 by Michael E. Gage and WeBWorK. All rights reserved.
10 :     # #############################################################
11 :    
12 : gage 8 use lib '.'; use webworkInit; # WeBWorKInitLine
13 : sam 2 use Global;
14 :     use Auth;
15 :    
16 :    
17 :     # get information from command line arguments
18 :     $Option = shift(@ARGV);
19 :     $Course = shift(@ARGV);
20 :    
21 :     unless ($Option && $Course && @ARGV > 0) {
22 :     die "Syntax: getData.pl -[s][l][ls] courseID [setNumber][LoginName][loginName and setNumber] (returns list of psvn)\n",
23 :     " The option must be specified.";
24 :    
25 :     }
26 :    
27 :     # establish environment for this script
28 :     &Global::getCourseEnvironment($Course);
29 :    
30 :     # Directory paths
31 :     $databaseDirectory = $Global::databaseDirectory;
32 :     $htmlURL = $Global::htmlURL;
33 :     $scriptDirectory = $Global::scriptDirectory;
34 :     $templateDirectory = $Global::templateDirectory;
35 :    
36 :     # File names
37 :    
38 :    
39 :     require "${scriptDirectory}$Global::DBglue_pl";
40 :     require "${scriptDirectory}$Global::HTMLglue_pl";
41 :     require "${scriptDirectory}$Global::FILE_pl";
42 :     if ($Option eq '-s') {
43 :     $setNumber = shift(@ARGV);
44 :     my @out = &getAllProbSetKeysForSet($setNumber);
45 :     print "@out";
46 :     }
47 :     elsif ($Option eq '-l'){
48 :     $studentLogin = shift(@ARGV);
49 :     %psvnHash =&getAllSetNumbersForStudentLoginHash($studentLogin);
50 :     @setNumbers = keys %psvnHash;
51 :     for $i (sort {$a<=>$b} @setNumbers) {
52 :     print $psvnHash{$i}," ";
53 :     }
54 :     }
55 :     elsif ($Option eq '-ls'){
56 :     $studentLogin = shift(@ARGV);
57 :     $setNumber = shift(@ARGV);
58 :     %psvnHash =&getAllSetNumbersForStudentLoginHash($studentLogin);
59 :     print $psvnHash{$setNumber}," ";
60 :    
61 :     }
62 :     else {
63 :     print "Unknown option $Option\n",
64 :     "Legal options: \n" ,
65 :     "-s courseID setNumber prints all psvns for setNumber\n",
66 :     "-l courseID studentLogin prints all psvns for studentLogin\n",
67 :     "-ls courseID studentLogin setNumber prints psvn for setNumber for studentLogin\n";
68 :     }
69 :    
70 :     exit(0);
71 :    
72 :    
73 :    
74 :    
75 :    

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9