--- loncom/homework/grades.pm 2007/10/09 19:33:56 1.449
+++ loncom/homework/grades.pm 2007/10/09 23:03:22 1.450
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.449 2007/10/09 19:33:56 banghart Exp $
+# $Id: grades.pm,v 1.450 2007/10/09 23:03:22 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -477,6 +477,7 @@ COMMONJSFUNCTIONS
sub getclasslist {
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,6 +487,14 @@ 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,$keylist)=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
@@ -512,15 +521,29 @@ sub getclasslist {
# 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});
}
@@ -872,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.='
'.
' |