--- loncom/interface/lonselstudent.pm 2009/01/15 18:23:27 1.14 +++ loncom/interface/lonselstudent.pm 2016/10/22 02:03:31 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # lonselstudent.pm : Reusable subs for student selection. # -# $Id: lonselstudent.pm,v 1.14 2009/01/15 18:23:27 raeburn Exp $ +# $Id: lonselstudent.pm,v 1.17 2016/10/22 02:03:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,7 +61,7 @@ use HTML::Entities(); # Course personnel elements include: # [0] Last, First of the user. # [1] Role held by the user. -# [2] Empty. +# [2] Section associated with role. # [3] Empty # [4] username:domain of the user. # @@ -74,25 +74,30 @@ use HTML::Entities(); # [4] username:domain of the user. # sub get_people_in_class { - my ($section_restriction) = @_; - my %coursepersonnel = &Apache::lonnet::get_course_adv_roles(); + my ($section_restriction,$personnel_section) = @_; + my %coursepersonnel = &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); + my $crstype = &Apache::loncommon::course_type(); # # Enumerate the course_personnel. # my @course_personnel; - for my $role (sort(keys(%coursepersonnel))) { + foreach my $key (sort(keys(%coursepersonnel))) { + my ($role,$section) = split(/:/,$key); # extract the names so we can sort them + next if (($personnel_section ne '') && ($personnel_section ne $section)); my @people; - for my $person (split(/,/, $coursepersonnel{$role})) { + + foreach my $person (split(/,/, $coursepersonnel{$key})) { my ($uname,$domain) = split(/:/, $person); push(@people, [&Apache::loncommon::plainname($uname,$domain), $uname,$domain]); } @people = sort { $a->[0] cmp $b->[0] } (@people); - for my $person (@people) { + foreach my $person (@people) { push(@course_personnel, [join(':', $person->[1],$person->[2]), - $person->[0], '', '', $role]); + $person->[0], $section, 'Active', + &Apache::lonnet::plaintext($role)]); } } # Students must be split into the three categories: @@ -179,7 +184,7 @@ sub get_people_in_class { # and false for all other calls... only matters if # multiselect is true. # $context - If email, do not include

tags at the end -# of the data table. +# of the data table. # Returns: # HTML text to add to the rendering of the helper. # @@ -319,18 +324,24 @@ SCRIPT $result .= '
'; my $size = scalar(keys(%sections)); - $size += 3; # We have allstudents allpersonel nosection too. - if ($size > 5) { + if ($context eq 'accesstimes') { + $size += 2; + } else { + $size += 3; # We have allstudents allpersonel nosection too. + } + if ($size > 5) { $size = 5; } $result .= ''; $result .= '