[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator / Instructor.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1396 Revision 1397
111 $self->assignProblemToUser($user, $problemRecord); 111 $self->assignProblemToUser($user, $problemRecord);
112 } 112 }
113 } 113 }
114} 114}
115 115
116sub read_dir { # read a directory
117 my $self = shift;
118 my $directory = shift;
119 my $pattern = shift;
120 my @files = grep /$pattern/, WeBWorK::Utils::readDirectory($directory);
121 return sort @files;
122}
123
124sub read_scoring_file { # used in SendMail and ....?
125 my $self = shift;
126 my $fileName = shift;
127 my $delimiter = shift;
128 $delimiter = ',' unless defined($delimiter);
129 my $scoringDirectory= $self->{ce}->{courseDirs}->{scoring};
130 my $filePath = "$scoringDirectory/$fileName";
131 # Takes a delimited file as a parameter and returns an
132 # associative array with the first field as the key.
133 # Blank lines are skipped. White space is removed
134 my(@dbArray,$key,$dbString);
135 my %assocArray = ();
136 local(*FILE);
137 if ($fileName eq 'None') {
138 # do nothing
139 } elsif ( open(FILE, "$filePath") ) {
140 my $index=0;
141 while (<FILE>){
142 unless ($_ =~ /\S/) {next;} ## skip blank lines
143 chomp;
144 @{$dbArray[$index]} =$self->getRecord($_,$delimiter);
145 $key =$dbArray[$index][0];
146 $assocArray{$key}=$dbArray[$index];
147 $index++;
148 }
149 close(FILE);
150 } else {
151 warn "Couldn't read file $filePath";
152 }
153 return \%assocArray;
154}
116## Template Escapes ## 155## Template Escapes ##
117 156
118sub links { 157sub links {
119 my $self = shift; 158 my $self = shift;
120# FIXME these links are being placed in ContentGenerator.pm 159# FIXME these links are being placed in ContentGenerator.pm

Legend:
Removed from v.1396  
changed lines
  Added in v.1397

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9