# | '. - "\n".'Concept | '. - "\n".'Correct | '. - "\n".'Wrong | '. - "\n".'
---|---|---|---|
".($n+1)." | ". - "\n".''.$Concepts[$n]." | ". - "\n".''.$data1[$n]." | ". - "\n".''.$data2[$n]." | ". - "\n"."From:['.localtime($ConceptData{'Int.'.$k}). - '] To: ['.localtime($ConceptData{'Int.'.($k+1)}-1). - "] | $Correct | $Wrong | "; - - $Str .= "\n".'
P# | '."\n"; - for(my $nIndex=0; $nIndex < (scalar (keys %$headings)); $nIndex++) { - $Result .= ''.''.' | '."\n"; +sub get_selected_maps { + my ($elementname) = @_; + my @selected_maps = + &Apache::loncommon::get_env_multiple('form.'.$elementname); + @selected_maps = ('all') if (! @selected_maps); + foreach my $map (@selected_maps) { + if ($map eq 'all') { + @selected_maps = ('all'); + last; + } } - $Result .= "\n".'
---|
\# | Problem Title | "; - $Str .= 'Resource | Analysis |
---|---|---|---|
'.$number.' | '; - $Str .= ''.$Temp.' | '; - $Str .= ''.$uri.' | '; - $Str .= '
\# | Set Title | "; - $Str .= 'Results | Tries | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
'.$sequence.' | '; - $Str .= ''.$cache->{$sequence.':title'}.' | '; - - $codes = ''; - $attempts = ''; - foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { - my $problem = $cache->{$problemID.':problem'}; - my $LatestVersion = $cache->{$name.':version:'.$problem}; - - # Output dashes for all the parts of this problem if there - # is no version information about the current problem. - if(!$LatestVersion) { - foreach my $part (split(/\:/,$cache->{$sequence.':'. - $problemID. - ':parts'})) { - $codes .= "-,"; - $attempts .= "0,"; - } - next; +sub DisplayClasslist { + my ($r)=@_; + &Apache::lonhtmlcommon::add_breadcrumb + ({text=>'Select One Student'}); + # + # Output some of the standard interface components + my $Str; + $Str .= &Apache::lonhtmlcommon::breadcrumbs('Select One Student'); + $Str .= '
'.&mt('Sections').' | '; + $Str .= ''.&mt('Groups').' | '; + $Str .= ''.&mt('Access Status').' | '; + $Str .= '
---|---|---|
'. + &Apache::lonstatistics::SectionSelect('Section','multiple',5). + ' | '; + $Str .= ''. + &Apache::lonstatistics::GroupSelect('Group','multiple',5). + ' | '; + $Str .= ''. + &Apache::lonhtmlcommon::StatusOptions(undef,undef,5). + ' | '; + + $Str .= '
'. + &mt('There are no currently enrolled students in the course.'). + '
'; + } elsif (lc($env{'form.Status'}) eq 'expired') { + $Str .= ''. + &mt('There are no previously enrolled students in the course.'). + '
'; + } elsif (lc($env{'form.Status'}) eq 'future') { + $Str .= ''. + &mt('There are no students with future access in the course.'). + '
'; + } else { # 'any' and any others + $Str .= ''. + &mt('There are no students in the course.'). + '
'; } - - my %partData=undef; - # Initialize part data, display skips correctly - # Skip refers to when a student made no submissions on that - # part/problem. - foreach my $part (split(/\:/,$cache->{$sequence.':'. - $problemID. - ':parts'})) { - $partData{$part.':tries'}=0; - $partData{$part.':code'}='-'; + } else { + if (lc($env{'form.Status'}) eq 'active') { + $Str .= ''. + &mt('There are no currently enrolled students in the selected sections.'). + '
'; + } elsif (lc($env{'form.Status'}) eq 'expired') { + $Str .= ''. + &mt('There are no previously enrolled students in the selected sections.'). + '
'; + } elsif (lc($env{'form.Status'}) eq 'future') { + $Str .= ''. + &mt('There are no students with future access in the selected sections.'). + '
'; + } else { # 'any' and any others + $Str .= ''. + &mt('There are no students in the selected sections.'). + '
'; } + } + $Str.= '' + .'' + .&mt('Return to the chart').'' + .'
'; + $r->print($Str); + $r->rflush(); + return; + } - # Looping through all the versions of each part, starting with the - # oldest version. Basically, it gets the most recent - # set of grade data for each part. - for(my $Version=1; $Version<=$LatestVersion; $Version++) { - foreach my $part (split(/\:/,$cache->{$sequence.':'. - $problemID. - ':parts'})) { - - if(!defined($cache->{$name.":$Version:$problem". - ":resource.$part.solved"})) { - # No grade for this submission, so skip - next; - } - - my $tries=0; - my $code='U'; - - $tries = $cache->{$name.":$Version:$problem". - ":resource.$part.tries"}; - $partData{$part.':tries'}=($tries) ? $tries : 0; - - my $val = $cache->{$name.":$Version:$problem". - ":resource.$part.solved"}; - if ($val eq 'correct_by_student') {$code = 'Y';} - elsif ($val eq 'correct_by_override') {$code = 'y';} - elsif ($val eq 'incorrect_attempted') {$code = 'N';} - elsif ($val eq 'incorrect_by_override'){$code = 'N';} - elsif ($val eq 'excused') {$code = 'x';} - $partData{$part.':code'}=$code; + $Str .= ''.&mt("Click on a student's name or username to view their chart.").'
' + .&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row(); + foreach my $field (@Fields) { + $Str .= ''. + &mt('Unable to connect to database!'). + '
'); + $r->print('' + .&mt('Please notify the server administrator [_1]', + ,''.$serveradmin.'') + .'
'); + $r->print(''. + &mt('Course Statistics and Charts cannot be '. + 'retrieved until the database is restarted. '. + 'Your data is intact but cannot be displayed '. + 'at this time.').'
'); + $r->print(&Apache::loncommon::end_page()); + return; + } + # + # Clean out the caches + if (exists($env{'form.ClearCache'})) { + &Apache::loncoursedata::delete_caches($env{'requres.course.id'}); + } + # + my $GoToPage = $env{'form.reportSelected'}; + # + # Begin form output + $r->print('\n"); } + &Apache::lonquickgrades::endGradeScreen($r); + $r->print(&Apache::loncommon::end_page()); + $r->rflush(); + # + return OK; +} - return; +1; - # Select page to display - if(defined($ENV{'form.ProblemStatistics'}) || - defined($ENV{'form.ProblemStatisticsRecalculate'}) || - defined($ENV{'form.DisplayCSVFormat'})) { - $cache->{'GoToPage'} = 'ProblemStatistics'; - &CheckFormElement($cache, 'DisplayCSVFormat', - 'DisplayFormat', 'Display Table Format'); - &CheckFormElement($cache, 'Ascend','ProblemStatisticsAscend', - 'Ascending'); - &CheckFormElement($cache, 'Maps', 'ProblemStatisticsMap', - 'All Maps'); - } elsif(defined($ENV{'form.ProblemAnalysis'})) { - $cache->{'GoToPage'} = 'ProblemAnalysis'; - &CheckFormElement($cache, 'Interval', 'Interval', '1'); - } elsif(defined($ENV{'form.DoDiffGraph'})) { - $cache->{'GoToPage'} = 'DoDiffGraph'; - } elsif(defined($ENV{'form.PercentWrongGraph'})) { - $cache->{'GoToPage'} = 'PercentWrongGraph'; - } elsif(defined($ENV{'form.ActivityLog'})) { - $cache->{'GoToPage'} = 'ActivityLog'; - } else { - $cache->{'GoToPage'} = 'Menu'; - } +__END__ - &CheckFormElement($cache, 'Status', 'Status', 'Active'); +=pod - return; -} +=head1 NAME -=pod +lonstatistics -=item &SortStudents() +=head1 SYNOPSIS -Determines which students to display and in which order. Which are -displayed are determined by their status(active/expired). The order -is determined by the sort button pressed (default to username). The -type of sorting is username, lastname, or section. +Main handler for statistics and chart. -=over 4 +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. -Input: $students, $CacheData -$students: A array pointer to a list of students (username:domain) +=head1 PACKAGE VARIABLES -$CacheData: A pointer to the hash tied to the cached data +=over -Output: \@order +=item @FullClasslist The full classlist -@order: An ordered list of students (username:domain) +=item @Students The students we are concerned with for this invocation -=back +=item @Sections The sections available in this class -=cut +=item @Groups The groups available in the class -sub SortStudents { - my ($cache)=@_; +=item $curr_student The student currently being examined - my @students = split(':::',$cache->{'NamesOfStudents'}); - my @sorted1Students=(); - foreach (@students) { - if($cache->{'Status'} eq 'Any' || - $cache->{$_.':Status'} eq $cache->{'Status'}) { - push(@sorted1Students, $_); - } - } +=item $prev_student The student previous in the classlist - my $sortBy = ''; - if(defined($cache->{'sort'})) { - $sortBy = ':'.$cache->{'sort'}; - } - my @order = sort { $cache->{$a.$sortBy} cmp $cache->{$b.$sortBy} || - $cache->{$a.':fullname'} cmp $cache->{$b.':fullname'} } - @sorted1Students; +=item $next_student The student next in the classlist - return \@order; -} +=back -sub PrepareData { - my ($c, $cacheDB)=@_; +=head1 SUBROUTINES - # Test for access to the cache data - my $courseID=$ENV{'request.course.id'}; - my $isRecalculate=0; - if(defined($ENV{'form.Recalculate'})) { - $isRecalculate=1; - } +=over - my $isCached = &Apache::loncoursedata::TestCacheData($cacheDB, - $isRecalculate); - if($isCached < 0) { - return "Unable to tie hash to db file."; - } +=item &clear_classlist_variables() - # Download class list information if not using cached data - my %cache; - unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { - return "Unable to tie hash to db file."; - } +undef the following package variables: - if(!$isCached) { - my $processTopResourceMapReturn= - &Apache::loncoursedata::ProcessTopResourceMap(\%cache, $c); - if($processTopResourceMapReturn ne 'OK') { - untie(%cache); - return $processTopResourceMapReturn; - } - } +=over 4 - if($c->aborted()) { - untie(%cache); - return 'aborted'; - } +=item * @FullClasslist - my $classlist=&Apache::loncoursedata::DownloadClasslist($courseID, - $cache{'ClasslistTimestamp'}, - $c); - foreach (keys(%$classlist)) { - if(/^(con_lost|error|no_such_host)/i) { - untie(%cache); - return "Error getting student data."; - } - } +=item * @Students - if($c->aborted()) { - untie(%cache); - return 'aborted'; - } +=item * @Sections - # Active is a temporary solution, remember to change - Apache::loncoursedata::ProcessClasslist(\%cache,$classlist,$courseID,$c); - if($c->aborted()) { - untie(%cache); - return 'aborted'; - } +=item * @Groups - &ProcessFormData(\%cache); - my $students = &SortStudents(\%cache); +=item * %StudentData - if($cache{'download'} ne 'false') { - my $who = $cache{'download'}; - my $courseData = - &Apache::loncoursedata::DownloadStudentCourseInformation( - $who, $courseID, - $cache{$who.':lastDownloadTime'}); - &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who); - $cache{'download'} = 'false'; - } elsif($cache{'DownloadAll'} ne 'false') { - my @allStudents; - if($cache{'DownloadAll'} eq 'sorted') { - @allStudents = @$students; - } else { - @allStudents = split(':::', $cache{'NamesOfStudents'}); - } - foreach (@allStudents) { - my $courseData = - &Apache::loncoursedata::DownloadStudentCourseInformation( - $_, $courseID, - $cache{$_.':lastDownloadTime'}); - &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, - $_); - if($c->aborted()) { - untie(%cache); - return 'aborted'; - } - } - $cache{'DownloadAll'} = 'false'; - } +=item * @StudentDataOrder - if($c->aborted()) { - untie(%cache); - return 'aborted'; - } +=item * @SelectedStudentData - if($c->aborted()) { - untie(%cache); - return 'aborted'; - } +=item * $curr_student - untie(%cache); +=item * $prev_student - return ('OK', $students); -} +=item * $next_student -# Create progress -sub Create_PrgWin { - $r->print(<Select Map | '."\n"; - $Ptr .= ''; - $Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'ProblemStatistics'); - $Ptr .= ' |
Select Map | '."\n"; - $Ptr .= ''; - $Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'StudentAssessment'); - $Ptr .= ' |
Select Student | '."\n"; - $Ptr .= ''."\n"; - $Ptr .= &Apache::lonhtmlcommon::StudentOptions(\%cache, $students, - $selectedName, - 'StudentAssessment'); - $Ptr .= ' |
';
- $Ptr .= 'print($Ptr);
-
- if($selectedName eq 'No Student Selected') {
- $r->print('WARNING: '); - $r->print('Please select a student'); - return; - } +=back - my $selected=0; - foreach (@$students) { - next if ($_ ne $selectedName && - $selectedName ne 'All Students'); - $selected = 1; - my $courseData = - &Apache::loncoursedata::DownloadStudentCourseInformation($_, - $courseID); - last if ($c->aborted()); - if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { - &Apache::loncoursedata::ProcessStudentData(\%cache, - $courseData, $_); - if(!$c->aborted()) { $r->print(&StudentReport(\%cache, $_)); } - untie(%cache); - } - } - if($selected == 0) { - $r->print('WARNING: '); - $r->print('Please select a student'); - return; - } +=item &get_selected_maps($elementname) - return; -} +Input: Name of the |