Diff for /loncom/interface/lonhelper.pm between versions 1.196 and 1.197

version 1.196, 2015/08/16 00:21:21 version 1.197, 2015/08/28 22:44:59
Line 3183  It takes the standard attributes "variab Line 3183  It takes the standard attributes "variab
 "allowempty" and "nextstate", meaning what they do for most other  "allowempty" and "nextstate", meaning what they do for most other
 elements.  elements.
   
 also takes a boolean 'onlysections' whcih will restrict this to only  also takes a boolean 'onlysections' which will restrict this to only
 have sections and not include groups  have sections and not include groups
   
 =cut  =cut
Line 3277  It takes the standard attributes "variab Line 3277  It takes the standard attributes "variab
  "allowempty" and "nextstate", meaning what they do for most other   "allowempty" and "nextstate", meaning what they do for most other
  elements.   elements.
   
   also takes a boolean grouponly, which if true, will restrict choice to
   groups in which user is a member, unless user has the mdg priv in the course,
   in which case all groups will be possible choices. Defaults to false.
   
 =cut  =cut
   
 no strict;  no strict;
Line 3306  sub start_group { Line 3310  sub start_group {
     $helper->declareVar($paramHash->{'variable'});      $helper->declareVar($paramHash->{'variable'});
     $paramHash->{'multichoice'} = $token->[2]{'multichoice'};      $paramHash->{'multichoice'} = $token->[2]{'multichoice'};
     $paramHash->{'allowempty'} = $token->[2]{'allowempty'};      $paramHash->{'allowempty'} = $token->[2]{'allowempty'};
       $paramHash->{'grouponly'} = $token->[2]{'grouponly'};
     if (defined($token->[2]{'nextstate'})) {      if (defined($token->[2]{'nextstate'})) {
         $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};          $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};
     }      }
Line 3313  sub start_group { Line 3318  sub start_group {
     # Populate the CHOICES element      # Populate the CHOICES element
     my %choices;      my %choices;
   
     my %curr_groups = &Apache::longroup::coursegroups();      my %curr_groups;
       if ((!$paramHash->{'grouponly'}) || (&Apache::lonnet::allowed('mdg',$Apache::lonnet::env{'request.course.id'}))) {
           %curr_groups = &Apache::longroup::coursegroups();
       } elsif ($Apache::lonnet::env{'request.course.groups'} ne '') {
           map { $curr_groups{$_} = 1; } split(/,/,$Apache::lonnet::env{'request.course.groups'});
       }
     foreach my $group_name (sort {lc($a) cmp lc($b)} (keys(%curr_groups))) {      foreach my $group_name (sort {lc($a) cmp lc($b)} (keys(%curr_groups))) {
  push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]);   push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]);
     }      }

Removed from v.1.196  
changed lines
  Added in v.1.197


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>