version 1.142, 2006/05/09 14:38:10
|
version 1.144, 2006/05/09 21:39:47
|
Line 2291 use Apache::lonnet;
|
Line 2291 use Apache::lonnet;
|
# set of students won't collide. |
# set of students won't collide. |
# $defaultusers - reference to a hash containng |
# $defaultusers - reference to a hash containng |
# the set of users that should be on or off. |
# the set of users that should be on or off. |
|
# $multiselect - True if multiselect allowed. |
|
# $resultname - Name of result variable. |
# Returns: |
# Returns: |
# HTML text to add to the rendering of the helper. |
# HTML text to add to the rendering of the helper. |
# |
# |
sub render_student_list { |
sub render_student_list { |
my ($self, |
my ( |
$sections, $students, $formprefix, $defaultusers) = @_; |
$sections, $students, $formprefix, $defaultusers, |
|
$multiselect, $resultname) = @_; |
|
|
my $multiselect = $self->{'multichoice'}; |
|
my $result = ""; |
my $result = ""; |
|
|
# If multiple selections are allowed, we have a listbox |
# If multiple selections are allowed, we have a listbox |
Line 2352 sub render_student_list {
|
Line 2354 sub render_student_list {
|
my $checked = 0; |
my $checked = 0; |
for my $student (@$students) { |
for my $student (@$students) { |
$result .= '<tr><td><input type="'.$input_type.'" name="'. |
$result .= '<tr><td><input type="'.$input_type.'" name="'. |
$self->{'variable'}.".forminput".'"'; |
$resultname.".forminput".'"'; |
my $user = $student->[0]; |
my $user = $student->[0]; |
|
|
# Figure out which students are checked by default... |
# Figure out which students are checked by default... |
Line 2362 sub render_student_list {
|
Line 2364 sub render_student_list {
|
$result .= ' checked ="checked" '; |
$result .= ' checked ="checked" '; |
$checked = 1; |
$checked = 1; |
} |
} |
} elsif (!$self->{'multichoice'} && !$checked) { |
} elsif (!$multiselect && !$checked) { |
$result .= ' checked="checked" '; |
$result .= ' checked="checked" '; |
$checked = 1; # First one for radio if no default specified. |
$checked = 1; # First one for radio if no default specified. |
} |
} |
Line 2697 BUTTONS
|
Line 2699 BUTTONS
|
|
|
# Current personel |
# Current personel |
|
|
$result .= $self->render_student_list(\%sections, |
$result .= &render_student_list(\%sections, |
$current_members, |
$current_members, |
"current", |
"current", |
\%defaultUsers); |
\%defaultUsers, |
|
$self->{'multichoice'}, |
|
$self->{'variable'}); |
|
|
|
|
# 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: |
Line 2709 BUTTONS
|
Line 2713 BUTTONS
|
|
|
# And future. |
# And future. |
|
|
$result .= $self->render_student_list(\%sections, |
$result .= &render_student_list(\%sections, |
$future_members, |
$future_members, |
"future", |
"future", |
\%defaultUsers); |
\%defaultUsers, |
|
$self->{'multichoice'}, |
|
$self->{'variable'}); |
# Past |
# Past |
|
|
$result .= $self->render_student_list(\%sections, |
$result .= &render_student_list(\%sections, |
$expired_members, |
$expired_members, |
"past", |
"past", |
\%defaultUsers); |
\%defaultUsers, |
|
$self->{'multichoice'}, |
|
$self->{'variable'}); |
} |
} |
|
|
|
|
Line 3162 sub start_section {
|
Line 3170 sub start_section {
|
|
|
my $section = Apache::loncoursedata::CL_SECTION(); |
my $section = Apache::loncoursedata::CL_SECTION(); |
my $classlist = Apache::loncoursedata::get_classlist(); |
my $classlist = Apache::loncoursedata::get_classlist(); |
foreach (keys %$classlist) { |
foreach my $user (keys(%$classlist)) { |
my $sectionName = $classlist->{$_}->[$section]; |
my $section_name = $classlist->{$user}[$section]; |
if (!$sectionName) { |
if (!$section_name) { |
$choices{"No section assigned"} = ""; |
$choices{"No section assigned"} = ""; |
} else { |
} else { |
$choices{$sectionName} = $sectionName; |
$choices{$section_name} = $section_name; |
} |
} |
} |
} |
|
|
for my $sectionName (sort(keys(%choices))) { |
if (exists($choices{"No section assigned"})) { |
push @{$paramHash->{CHOICES}}, [$sectionName, $sectionName]; |
push(@{$paramHash->{CHOICES}}, |
|
['No section assigned','No section assigned']); |
|
delete($choices{"No section assigned"}); |
|
} |
|
for my $section_name (sort {lc($a) cmp lc($b) } (keys(%choices))) { |
|
push @{$paramHash->{CHOICES}}, [$section_name, $section_name]; |
} |
} |
return if ($token->[2]{'onlysections'}); |
return if ($token->[2]{'onlysections'}); |
|
|
Line 3242 sub start_group {
|
Line 3255 sub start_group {
|
my %choices; |
my %choices; |
|
|
my %curr_groups = &Apache::loncommon::coursegroups(); |
my %curr_groups = &Apache::loncommon::coursegroups(); |
foreach my $group_name (sort(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]); |
} |
} |
} |
} |