# The LearningOnline Network with CAPA
# (Publication Handler
#
# $Id: lonpercentage.pm,v 1.1 2002/08/30 15:35:08 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
###
package Apache::lonpercentage;
use strict;
use Apache::lonhtmlcommon;
use Apache::loncoursedata;
use GDBM_File;
#my $jr;
sub BuildPercentageGraph {
my ($cacheDB, $students, $courseID, $c, $r)=@_;
my %cache;
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
$r->print('Unable to tie database.6');
return;
}
$r->print(&CreateInterface(\%cache));
$r->rflush();
untie(%cache);
my ($result) = &InitializeSelectedStudents($cacheDB, $students,
$courseID, $c, $r);
if($result ne 'OK' || $c->aborted()) {
return;
}
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
$r->print('Unable to tie database.6');
return;
}
my ($Ptr, $percentage) = &GraphData(\%cache, $students);
$r->print($Ptr.'
');
$r->print(&TableData(\%cache, $percentage));
untie(%cache);
return;
}
sub CreateInterface {
my ($cache)=@_;
my $Ptr = '';
$Ptr .= '
Select Map | '."\n"; $Ptr .= ''; $Ptr .= &Apache::lonhtmlcommon::MapOptions($cache, 'Statistics', 'Statistics'); $Ptr .= ' | '."\n"; my $sequence = $cache->{'StatisticsMaps'}; if($sequence ne 'All Maps') { $Ptr .= ''."\n"; $Ptr .= &Apache::lonhtmlcommon::ProblemOptions($cache, 'Statistics', $sequence, 'Statistics'); $Ptr .= ' | '."\n"; my $problem = $cache->{'StatisticsProblemSelect'}; if($problem ne 'All Problems') { my $parts = &GetParts($cache, $sequence, $problem); if(scalar(@$parts) > 0) { $Ptr .= ' | '."\n"; $Ptr .= &Apache::lonhtmlcommon::PartOptions($cache, 'Statistics', $parts, 'Statistics'); $Ptr .= ' | '."\n"; } } } $Ptr .= '
Select Sections'; $Ptr .= ' | '."\n"; $Ptr .= ''."\n"; my @sections = split(':',$cache->{'sectionList'}); my @sectionsSelected = split(':',$cache->{'sectionsSelected'}); $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections, \@sectionsSelected, 'Statistics'); $Ptr .= ' |