version 1.195, 2015/08/15 20:11:57
|
version 1.197, 2015/08/28 22:44:59
|
Line 2621 selection. Defaults to false.
|
Line 2621 selection. Defaults to false.
|
If true, only active students and course personnel will be |
If true, only active students and course personnel will be |
shown. Defaults to false. |
shown. Defaults to false. |
|
|
|
=item * B<sectiononly>: |
|
|
|
If true, and user's role is in a specific section, only course personnel |
|
will be shown if they also have a section-specific role in the same section. |
|
Defaults to false. |
|
|
=item * B<emptyallowed>: |
=item * B<emptyallowed>: |
|
|
If true, the selection of no users is allowed. Defaults to false. |
If true, the selection of no users is allowed. Defaults to false. |
Line 2656 sub start_student {
|
Line 2662 sub start_student {
|
$helper->declareVar($paramHash->{'variable'}); |
$helper->declareVar($paramHash->{'variable'}); |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'coursepersonnel'} = $token->[2]{'coursepersonnel'}; |
$paramHash->{'coursepersonnel'} = $token->[2]{'coursepersonnel'}; |
|
$paramHash->{'sectiononly'} = $token->[2]{'sectiononly'}; |
$paramHash->{'activeonly'} = $token->[2]{'activeonly'}; |
$paramHash->{'activeonly'} = $token->[2]{'activeonly'}; |
if (defined($token->[2]{'nextstate'})) { |
if (defined($token->[2]{'nextstate'})) { |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
Line 2697 sub render {
|
Line 2704 sub render {
|
delete($defaultUsers{''}); |
delete($defaultUsers{''}); |
} |
} |
|
|
|
my $personnel_section; |
|
if ($self->{'sectiononly'}) { |
|
$personnel_section = $env{'request.course.sec'}; |
|
} |
|
|
my ($course_personnel, |
my ($course_personnel, |
$current_members, |
$current_members, |
$expired_members, |
$expired_members, |
$future_members) = |
$future_members) = |
&Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); |
&Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}, |
|
$personnel_section); |
|
|
# Load up the non-students, if necessary |
# Load up the non-students, if necessary |
|
|
Line 2709 sub render {
|
Line 2722 sub render {
|
unshift @$current_members, (@$course_personnel); |
unshift @$current_members, (@$course_personnel); |
} |
} |
|
|
|
my %titles = &Apache::lonlocal::texthash( |
|
'active' => 'Select Currently Enrolled Students and Active Course Personnel', |
|
'future' => 'Select Future Enrolled Students', |
|
'expired' => 'Select Previously Enrolled Students', |
|
); |
|
|
|
if ($env{'request.course.sec'}) { |
|
if ($self->{'sectiononly'}) { |
|
$titles{'active'} = &mt('Select Currently Enrolled Students and Active Course Personnel in Section: [_1]', |
|
$env{'request.course.sec'}); |
|
} else { |
|
$titles{'active'} = &mt('Select Currently Enrolled Students in Section: [_1], and Active Course Personnel', |
|
$env{'request.course.sec'}); |
|
} |
|
$titles{'future'} = &mt('Select Future Enrolled Students in Section: [_1]', |
|
$env{'request.course.sec'}); |
|
$titles{'expired'} = &mt('Select Previously Enrolled Students in Section: [_1]', |
|
$env{'request.course.sec'}); |
|
} |
|
|
# Current personel |
# Current personnel |
|
|
$result .= '<h4>'.&mt('Select Currently Enrolled Students and Active Course Personnel').'</h4>'; |
$result .= '<h4>'.$titles{'active'}.'</h4>'; |
$result .= &Apache::lonselstudent::render_student_list( $current_members, |
$result .= &Apache::lonselstudent::render_student_list( $current_members, |
"helpform", |
"helpform", |
"current", |
"current", |
\%defaultUsers, |
\%defaultUsers, |
$self->{'multichoice'}, |
$self->{'multichoice'}, |
$self->{'variable'}, |
$self->{'variable'}, |
1); |
1); |
|
|
|
|
# If activeonly is not set then we can also give the expired students: |
# If activeonly is not set then we can also give the expired students: |
# |
# |
if (!$self->{'activeonly'} && ((scalar(@$future_members)) > 0)) { |
if (!$self->{'activeonly'} && ((scalar(@$future_members)) > 0)) { |
|
|
# And future. |
# And future. |
|
|
$result .= '<h4>'.&mt('Select Future Enrolled Students and Future Course Personnel').'</h4>'; |
$result .= '<h4>'.$titles{'future'}.'</h4>'; |
|
|
$result .= &Apache::lonselstudent::render_student_list( $future_members, |
$result .= &Apache::lonselstudent::render_student_list( $future_members, |
"helpform", |
"helpform", |
Line 2741 sub render {
|
Line 2772 sub render {
|
if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) { |
if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) { |
# Past |
# Past |
|
|
$result .= '<h4>'.&mt('Select Previously Enrolled Students and Inactive Course Personnel').'</h4>'; |
$result .= '<h4>'.$titles{'expired'}.'</h4>'; |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
"helpform", |
"helpform", |
"past", |
"past", |
Line 3152 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 3246 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 3275 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 3282 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]); |
} |
} |