--- loncom/interface/lonnavmaps.pm 2003/06/25 16:45:54 1.210 +++ loncom/interface/lonnavmaps.pm 2003/06/25 18:27:18 1.211 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.210 2003/06/25 16:45:54 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.211 2003/06/25 18:27:18 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1566,7 +1566,7 @@ You must obtain resource objects through =over 4 =item * B(navHashFile, parmHashFile, genCourseAndUserOptions, - genMailDiscussStatus): + genMailDiscussStatus, getUserData): Binds a new navmap object to the compiled nav map hash and parm hash given as filenames. genCourseAndUserOptions is a flag saying whether @@ -1577,7 +1577,8 @@ documentation. genMailDiscussStatus caus information about the email and discussion status of resources. Returns the navmap object if this is successful, or B if not. You must check for undef; errors will occur when you -try to use the other methods otherwise. +try to use the other methods otherwise. getUserData, if true, will +retreive the user's performance data for various problems. =item * B(first, finish, filter, condition): @@ -1598,6 +1599,7 @@ sub new { $self->{PARM_HASH_FILE} = shift; $self->{GENERATE_COURSE_USER_OPT} = shift; $self->{GENERATE_EMAIL_DISCUSS_STATUS} = shift; + $self->{GET_USER_DATA} = shift; # Resource cache stores navmap resources as we reference them. We generate # them on-demand so we don't pay for creating resources unless we use them. @@ -1735,7 +1737,15 @@ sub init { $self->{DISCUSSION_TIME} = \%discussiontime; $self->{EMAIL_STATUS} = \%emailstatus; - } + } + + if ($self->{GET_USER_DATA}) { + # Retreive performance data on problems + my %student_data = Apache::lonnet::currentdump($ENV{'request.course.id'}, + $ENV{'user.domain'}, + $ENV{'user.name'}); + $self->{STUDENT_DATA} = \%student_data; + } $self->{PARM_CACHE} = {}; $self->{INITED} = 1; @@ -3088,6 +3098,11 @@ Get the Client IP/Name Access Control in Get the answer-reveal date for the problem. +=item * B: + +Gets the awarded value for the problem part. Requires genUserData set to +true when the navmap object was created. + =item * B: Get the due date for the problem. @@ -3141,7 +3156,11 @@ sub answerdate { } return $self->parmval("answerdate", $part); } -sub awarded { my $self = shift; return $self->queryRestoreHash('awarded', shift); } +sub awarded { + my $self = shift; my $part = shift; + if (!defined($part)) { $part = '0'; } + return $self->{NAV_MAP}->{STUDENT_DATA}->{$self->symb()}->{'resource.'.$part.'.awarded'}; +} sub duedate { (my $self, my $part) = @_; return $self->parmval("duedate", $part); @@ -3182,7 +3201,12 @@ sub type { } sub weight { my $self = shift; my $part = shift; - return $self->parmval("weight", $part); + if (!defined($part)) { $part = '0'; } + return &Apache::lonnet::EXT('resource.'.$part.'.weight', + $self->symb(), $ENV{'user.domain'}, + $ENV{'user.name'}, + $ENV{'request.course.sec'}); + } # Multiple things need this