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

Diff of /trunk/webwork-modperl/lib/WeBWorK/DB.pm

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

Revision 808 Revision 814
20################################################################################ 20################################################################################
21# constructor 21# constructor
22################################################################################ 22################################################################################
23 23
24sub new($$) { 24sub new($$) {
25 my $invocant = shift; 25 my ($invocant, $ce) = @_;
26 my $class = ref($invocant) || $invocant; 26 my $class = ref($invocant) || $invocant;
27 my $ce = shift;
28 my $self = {}; 27 my $self = {};
29 28
30 # load the modules required to handle each table, and create driver 29 # load the modules required to handle each table, and create driver
31 foreach my $table (TABLES) { 30 foreach my $table (TABLES) {
32 unless (defined $ce->{dbLayout}->{$table}) { 31 unless (defined $ce->{dbLayout}->{$table}) {
325# set+set_user functions 324# set+set_user functions
326################################################################################ 325################################################################################
327 326
328sub getGlobalUserSet($$$) { 327sub getGlobalUserSet($$$) {
329 my ($self, $userID, $setID) = @_; 328 my ($self, $userID, $setID) = @_;
330 # *** 329 my $UserSet = $self->getUserSet($userID, $setID);
330 return unless $UserSet;
331 my $GlobalSet = $self->getGlobalSet($setID);
332 if ($GlobalSet) {
333 foreach ($UserSet->FIELDS()) {
334 next unless $GlobalSet->can($_);
335 next if $UserSet->$_();
336 $UserSet->$_($GlobalSet->$_());
337 }
338 }
339 return $UserSet;
331} 340}
332 341
333################################################################################ 342################################################################################
334# problem+problem_user functions 343# problem+problem_user functions
335################################################################################ 344################################################################################
336 345
337sub getGlobalUserProblem($$$$) { 346sub getGlobalUserProblem($$$$) {
338 my ($self, $userID, $setID, $problemID) = @_; 347 my ($self, $userID, $setID, $problemID) = @_;
339 # *** 348 my $UserProblem = $self->getUserProblem($userID, $setID, $problemID);
349 return unless $UserProblem;
350 my $GlobalProblem = $self->getGlobalProblem($setID, $problemID);
351 if ($GlobalProblem) {
352 foreach ($UserProblem->FIELDS()) {
353 next unless $GlobalProblem->can($_);
354 next if $UserProblem->$_();
355 $UserProblem->$_($GlobalProblem->$_());
356 }
357 }
358 return $UserProblem;
340} 359}
341 360
342################################################################################ 361################################################################################
343# debugging 362# debugging
344################################################################################ 363################################################################################

Legend:
Removed from v.808  
changed lines
  Added in v.814

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9