--- loncom/interface/lonnavmaps.pm 2003/06/18 15:49:24 1.208 +++ 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.208 2003/06/18 15:49:24 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.211 2003/06/25 18:27:18 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1040,6 +1040,8 @@ sub render_long_status { if ($resource->is_map() && advancedUser() && $resource->randompick()) { $result .= '(randomly select ' . $resource->randompick() .')'; } + + $result .= "\n"; return $result; } @@ -1564,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 @@ -1575,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): @@ -1596,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. @@ -1733,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; @@ -2226,11 +2238,6 @@ sub min { if ($a < $b) { return $a; } else { return $b; } } -# In the CVS repository, documentation of this algorithm is included -# in /doc/lonnavdocs, as a PDF and .tex source. Markers like **1** -# will reference the same location in the text as the part of the -# algorithm is running through. - sub new { # magic invocation to create a class instance my $proto = shift; @@ -2286,6 +2293,9 @@ sub new { # that isn't just a redirector. my $resource; my $resourceCount = 0; + # Documentation on this algorithm can be found in the CVS repository at + # /docs/lonnavdocs; these "**#**" markers correspond to documentation + # in that file. # **1** foreach my $pass (@iterations) { @@ -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