- popwin=open('','popwin','width=400,height=100');
- popwin.document.writeln(''+
- 'LON-CAPA Statistics '+
- 'Computation Progress '+
- ''+
- '');
- popwin.document.close();
-
-ENDPOP
- $r->rflush();
-}
-# update progress
-sub Update_PrgWin {
- my ($totalStudents,$index,$name,$r)=@_;
- $r->print('');
+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 .= ''."\n";
+ $Str .= '';
+ $Str .= ''.&mt('Sections').' ';
+ $Str .= ''.&mt('Groups').' ';
+ $Str .= ''.&mt('Access Status').' ';
+ $Str .= ' '.$/;
+ $Str .= '';
+ $Str .= ''.
+ &Apache::lonstatistics::SectionSelect('Section','multiple',5).
+ ' ';
+ $Str .= ''.
+ &Apache::lonstatistics::GroupSelect('Group','multiple',5).
+ ' ';
+ $Str .= ''.
+ &Apache::lonhtmlcommon::StatusOptions(undef,undef,5).
+ ' ';
+
+ $Str .= ' '.$/;
+ $Str .= '
';
+ $Str .= ' ';
+ $r->print($Str);
$r->rflush();
+ #
+ my @Fields = ('fullname','username','domain','id','section','status','groups');
+ #
+ $Str = '';
+ my @selected_sections = &get_selected_sections();
+ if (! @Students) {
+ if ($selected_sections[0] eq 'all') {
+ if (lc($env{'form.Status'}) eq 'active') {
+ $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.').
+ '
';
+ }
+ } 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;
+ }
+
+ $Str .= ''.&mt('Select One Student').' '
+ .''.&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($field).
+ ' ';
+ }
+ $Str .= &Apache::loncommon::end_data_table_header_row();
+ #
+ foreach my $student (@Students) { # @Students is a package variable
+ my $sname = $student->{'username'}.':'.$student->{'domain'};
+ $Str .= &Apache::loncommon::start_data_table_row();
+ #
+ foreach my $field (@Fields) {
+ $Str .= '';
+ if ($field eq 'fullname' || $field eq 'username') {
+ $Str .= '';
+ $Str .= $student->{$field};
+ $Str .= ' ';
+ } elsif ($field eq 'status') {
+ $Str .= &mt($student->{$field});
+ } else {
+ if ($student->{$field} eq 'none') {
+ $Str .= &mt('none')
+ } else {
+ $Str .= $student->{$field};
+ }
+ }
+ $Str .= ' ';
+ }
+ $Str .= &Apache::loncommon::end_data_table_row();
+ }
+ $Str .= &Apache::loncommon::end_data_table();
+ #
+ $r->print($Str);
+ $r->rflush();
+ #
+ return;
}
-# close Progress Line
-sub Close_PrgWin {
- my ($r)=@_;
- $r->print('');
- $r->rflush();
+
+
+sub CreateMainMenu {
+ #
+ # Define menu data
+ my @reports = (
+ {categorytitle => 'Statistics and Analyses',
+ items => [
+ {url => '/adm/statistics?reportSelected=problem_statistics',
+ permission => 'F',
+ icon => 'document-open.png',
+ linktext => ('Overall Problem Statistics'),
+ linktitle => ('Student performance statistics on all problems.')},
+
+ {url => '/adm/statistics?reportSelected=problem_analysis',
+ permission => 'F',
+ icon => 'prob_ana.png',
+ linktext => ('Detailed Problem Analysis'),
+ linktitle => ('Detailed statistics and graphs of student performance on problems.')},
+ ]},
+ {categorytitle => 'Plots',
+ items => [
+ {url => '/adm/statistics?reportSelected=submissiontime_analysis',
+ permission => 'F',
+ icon => 'subtimpl.png',
+ linktext => ('Submission Time Plots'),
+ linktitle => ('Display and analysis of submission times on assessments.')},
+
+ {url => '/adm/statistics?reportSelected=correct_problems_plot',
+ permission => 'F',
+ icon => 'coprplot.png',
+ linktext => ('Correct Problems Plot'),
+ linktitle => ('Display a histogram of student performance in the course.')},
+ ]},
+ {categorytitle => 'Reports',
+ items => [
+ {url => '/adm/statistics?reportSelected=student_submission_reports',
+ permission => 'F',
+ icon => 'edit-copy.png',
+ linktext => ('Student Submission Reports'),
+ linktitle => ('Prepare reports of student submissions.')},
+
+ {url => '/adm/statistics?reportSelected=survey_reports',
+ permission => 'F',
+ icon => 'survey_rep.png',
+ linktext => ('Survey Reports'),
+ linktitle => ('Prepare reports on survey results.')},
+ ]});
+
+return &Apache::lonhtmlcommon::generate_menu(@reports);
+
}
-# For loading the colored table for display or un-colored for print
-sub setbgcolor {
- my $PrintTable=shift;
- my %color;
- if ($PrintTable){
- $color{"gb"}="#FFFFFF";
- $color{"red"}="#FFFFFF";
- $color{"yellow"}="#FFFFFF";
- $color{"green"}="#FFFFFF";
- $color{"purple"}="#FFFFFF";
+
+
+sub handler {
+ my $r=shift;
+ my $c = $r->connection();
+ #
+ # Check for access
+ if (! &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
+ $env{'user.error.msg'}=
+ $r->uri.":vgr:0:0:Cannot view grades for complete course";
+ if (! &Apache::lonnet::allowed('vgr',
+ $env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
+ $env{'user.error.msg'}=
+ $r->uri.":vgr:0:0:Cannot view grades with given role";
+ return HTTP_NOT_ACCEPTABLE;
+ }
+ }
+ #
+ # Send the header
+ &Apache::loncommon::no_cache($r);
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ if ($r->header_only) { return OK; }
+ #
+ # Extract form elements from query string
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['sort','reportSelected',
+ 'SelectedStudent']);
+ #
+ # Give the LON-CAPA page header
+ my $style = <
+ ul.sub_studentans { list-style-type: none }
+ ul.sub_correctans { list-style-type: none }
+ tr.even { background-color: \#CCCCCC }
+ td.essay { border: 1px solid gray; }
+
+ENDSTYLE
+
+ $r->print(&Apache::loncommon::start_page('Course Statistics and Charts',
+ $style));
+ $r->rflush();
+ #
+ # Either print out a menu for them or send them to a report
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/statistics',
+ title=>'Statistics',
+ text =>'Statistics',
+ faq=>139,
+ bug=>'Statistics and Charts'});
+ if (! exists($env{'form.reportSelected'}) ||
+ $env{'form.reportSelected'} eq '') {
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Statistics Main Page'));
+ &Apache::lonquickgrades::startGradeScreen($r,'statistics');
+ $r->print(&CreateMainMenu());
} else {
- $color{"gb"}="#DDFFFF";
- $color{"red"}="#FFDDDD";
- $color{"yellow"}="#EEFFCC";
- $color{"green"}="#DDFFDD";
- $color{"purple"}="#FFDDFF";
- }
-
- return \%color;
-}
-
-sub BuildClasslist {
- my ($cacheDB,$students,$studentInformation,$headings,$spacePadding)=@_;
-
- my %cache;
- unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
- return 'Unable to tie database.';
- }
-
- my $Str='';
- $Str .= ''."\n";
+=head1 SYNOPSIS
- untie(%cache);
+Main handler for statistics and chart.
- return $Str;
-}
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
-sub BuildStatistics {
- my ($r)=@_;
- my $c = $r->connection;
- my @studentInformation=('fullname','section','id','domain','username');
- my @headings=('Full Name', 'Section', 'PID', 'Domain', 'User Name');
- my $spacePadding = ' ';
- my %reports = ('classlist' => 'Class list',
- 'problem_statistics' => 'Problem Statistics',
- 'student_assessment' => 'Student Assessment',
- 'reportSelected' => 'Class list');
-
- my %cache;
- my $courseID=$ENV{'request.course.id'};
- my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
- "_$ENV{'user.domain'}_$courseID\_statistics.db";
-
- my %color=&setbgcolor(0);
- my ($returnValue, $students) = &PrepareData($c, $cacheDB);
- if($returnValue ne 'OK') {
- $r->print(''.$returnValue."\n".'');
- return OK;
- }
-
- my $GoToPage;
- if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
- $GoToPage = $cache{'reportSelected'};
- $reports{'reportSelected'} = $cache{'reportSelected'};
-# if(defined($cache{'reportKey'}) && $cache{'reportKey'} ne 'false') {
-# $reports{$cache{'reportKey'}} = $cache{'reportSelected'};
-# }
+=head1 PACKAGE VARIABLES
- if(defined($cache{'OptionResponses'})) {
- $reports{'problem_analysis'} = 'Problem Analysis';
- }
+=over
- $r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics'));
- $r->print(''."\n");
- $r->print("\n".'