--- loncom/homework/grades.pm 2007/10/09 10:31:21 1.448
+++ loncom/homework/grades.pm 2007/10/09 23:42:49 1.451
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.448 2007/10/09 10:31:21 foxr Exp $
+# $Id: grades.pm,v 1.451 2007/10/09 23:42:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -475,8 +475,9 @@ COMMONJSFUNCTIONS
#--- Dumps the class list with usernames,list of sections,
#--- section, ids and fullnames for each user.
sub getclasslist {
- my ($getsec,$filterlist) = @_;
+ my ($getsec,$filterlist,$getgroup) = @_;
my @getsec;
+ my @getgroup;
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
if (!ref($getsec)) {
if ($getsec ne '' && $getsec ne 'all') {
@@ -486,10 +487,19 @@ sub getclasslist {
@getsec=@{$getsec};
}
if (grep(/^all$/,@getsec)) { undef(@getsec); }
+ if (!ref($getgroup)) {
+ if ($getgroup ne '' && $getgroup ne 'all') {
+ @getgroup=($getgroup);
+ }
+ } else {
+ @getgroup=@{$getgroup};
+ }
+ if (grep(/^all$/,@getgroup)) { undef(@getgroup); }
- my $classlist=&Apache::loncoursedata::get_classlist();
+ my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
return if (! defined($classlist));
+ &Apache::loncoursedata::get_group_memberships($classlist,$keylist);
#
my %sections;
my %fullnames;
@@ -506,18 +516,34 @@ sub getclasslist {
$classlist->{$student}->[&Apache::loncoursedata::CL_FULLNAME()];
my $status =
$classlist->{$student}->[&Apache::loncoursedata::CL_STATUS()];
+ my $group =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_GROUP()];
# filter students according to status selected
if ($filterlist && (!($stu_status =~ /Any/))) {
if (!($stu_status =~ $status)) {
- delete ($classlist->{$student});
+ delete($classlist->{$student});
next;
}
}
+ # filter students according to groups selected
+ if (@getgroup) {
+ my $exclude = 1;
+ foreach my $grp(@getgroup) {
+ if ($group eq $grp) {
+ $exclude = 0;
+ }
+ }
+ if ($exclude) {
+ delete($classlist->{$student});
+ }
+ }
$section = ($section ne '' ? $section : 'none');
if (&canview($section)) {
if (!@getsec || grep(/^\Q$section\E$/,@getsec)) {
$sections{$section}++;
- $fullnames{$student}=$fullname;
+ if ($classlist->{$student}) {
+ $fullnames{$student}=$fullname;
+ }
} else {
delete($classlist->{$student});
}
@@ -768,8 +794,8 @@ sub listStudents {
my $cdom = $env{"course.$env{'request.course.id'}.domain"};
my $cnum = $env{"course.$env{'request.course.id'}.num"};
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
+ my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'};
my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
-
my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View';
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ?
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};
@@ -869,7 +895,7 @@ LISTJAVASCRIPT
'value="Next->" />
'."\n";
$gradeTable.=&check_buttons();
$gradeTable.='';
- my ($classlist, undef, $fullname) = &getclasslist($getsec,'1');
+ my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup);
$gradeTable.='
'.
' |