--- loncom/interface/slotrequest.pm 2005/06/04 08:17:06 1.4 +++ loncom/interface/slotrequest.pm 2005/08/09 07:34:51 1.5 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for requesting to have slots added to a students record # -# $Id: slotrequest.pm,v 1.4 2005/06/04 08:17:06 albertel Exp $ +# $Id: slotrequest.pm,v 1.5 2005/08/09 07:34:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -134,8 +134,32 @@ sub check_for_reservation { return (undef,undef); } +sub check_for_conflict { + my ($symb,$new_slot_name)=@_; + my $student = &Apache::lonnet::EXT("resource.0.availablestudent", $symb, + $env{'user.domain'}, $env{'user.name'}); + my $course = &Apache::lonnet::EXT("resource.0.available", $symb, + $env{'user.domain'}, $env{'user.name'}); + my @slots = (split(/:/,$student), split(/:/, $course)); + my ($cnum,$cdom)=&get_course(); + my %slots=&Apache::lonnet::get('slots', [@slots], $cdom, $cnum); + foreach my $slot_name (@slots) { + next if (!defined($slots{$slot_name}) || + !ref($slots{$slot_name})); + + next if (!defined($slots{$slot_name}->{'uniqueperiod'}) || + !ref($slots{$slot_name}->{'uniqueperiod'})); + my ($start,$end)=@{$slots{$slot_name}->{'uniqueperiod'}}; + if ($start