[LON-CAPA-cvs] cvs: loncom /interface lonpickstudent.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Thu, 16 Mar 2006 21:15:16 -0000
raeburn Thu Mar 16 16:15:16 2006 EDT
Modified files:
/loncom/interface lonpickstudent.pm
Log:
Include list of each student's active groups.
Index: loncom/interface/lonpickstudent.pm
diff -u loncom/interface/lonpickstudent.pm:1.11 loncom/interface/lonpickstudent.pm:1.12
--- loncom/interface/lonpickstudent.pm:1.11 Wed Mar 15 17:11:04 2006
+++ loncom/interface/lonpickstudent.pm Thu Mar 16 16:15:16 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a student from the classlist
#
-# $Id: lonpickstudent.pm,v 1.11 2006/03/15 22:11:04 albertel Exp $
+# $Id: lonpickstudent.pm,v 1.12 2006/03/16 21:15:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -70,8 +70,17 @@
$filter=~s/\W//g;
unless ($filter) { $filter='.'; }
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $classlist=&Apache::loncoursedata::get_classlist();
-
+ my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum);
+ my $now = time;
+ my %allgroups;
+ my @coursegroups = ();
+ if (&Apache::loncommon::coursegroups(\%allgroups,$cdom,$cnum)) {
+ @coursegroups = keys(%allgroups);
+ }
+
# --------------------------------------- There is such a user, get environment
$r->print(<<ENDSCRIPT);
@@ -111,7 +120,7 @@
if ($filter ne '.') {
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />');
}
- $r->print('</p><p><table>');
+ $r->print('</p><p><table><tr><th> </th><th>username</th><th>domain</th><th>Name</th><th>ID</th><th>section</th><th>active group(s)</th>');
# ------------------------------------------------------------------ Students
foreach (sort keys %$classlist) {
# the following undefs are for 'domain', and 'username' respectively.
@@ -124,6 +133,16 @@
my ($uname,$udom)=($1,$2);
if (($uname=~/^$filter/) ||
($fullname=~/^$filter/i)) {
+ my $grouplist = '';
+ foreach my $group (@coursegroups) {
+ if (exists($grouplist{$group.':'.$uname.':'.$udom})) {
+ my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom});
+ if (($end!=0) && ($end<$now)) { next; }
+ if (($start!=0) && ($start>$now)) {next; }
+ $grouplist .= " $group,";
+ }
+ }
+ $grouplist =~ s/,$//;
$r->print('<tr><td>'.
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('.
"'".$uname."','".$udom."')".'" /></td>'.
@@ -132,7 +151,7 @@
&Apache::loncommon::aboutmewrapper(
$fullname,
$uname,$udom).'</td><td>'.$id.'</td><td>'.$section.
- '</td></tr>');
+ '</td><td>'.$grouplist.'</td></tr>');
}
}
}