version 1.132, 2006/03/06 23:32:31
|
version 1.134, 2006/03/07 21:36:49
|
Line 2996 package Apache::lonhelper::section;
|
Line 2996 package Apache::lonhelper::section;
|
<section> allows the user to choose one or more sections from the current |
<section> allows the user to choose one or more sections from the current |
course. |
course. |
|
|
It takes the standard attributes "variable", "multichoice", and |
It takes the standard attributes "variable", "multichoice", |
"nextstate", meaning what they do for most other elements. |
"allowempty" and "nextstate", meaning what they do for most other |
|
elements. |
|
|
|
also takes a boolean 'onlysections' whcih will restrict this to only |
|
have sections and not include groups |
|
|
=cut |
=cut |
|
|
Line 3027 sub start_section {
|
Line 3031 sub start_section {
|
$paramHash->{'variable'} = $token->[2]{'variable'}; |
$paramHash->{'variable'} = $token->[2]{'variable'}; |
$helper->declareVar($paramHash->{'variable'}); |
$helper->declareVar($paramHash->{'variable'}); |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
|
$paramHash->{'allowempty'} = $token->[2]{'allowempty'}; |
if (defined($token->[2]{'nextstate'})) { |
if (defined($token->[2]{'nextstate'})) { |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
} |
} |
Line 3046 sub start_section {
|
Line 3051 sub start_section {
|
} |
} |
|
|
for my $sectionName (sort(keys(%choices))) { |
for my $sectionName (sort(keys(%choices))) { |
|
push @{$paramHash->{CHOICES}}, [$sectionName, $sectionName]; |
push @{$paramHash->{CHOICES}}, [$sectionName, $sectionName]; |
} |
|
return if ($token->[2]{'onlysections'}); |
|
|
|
# add in groups to the end of the list |
|
my %curr_groups; |
|
if (&Apache::loncommon::coursegroups(\%curr_groups)) { |
|
foreach my $group_name (sort(keys(%curr_groups))) { |
|
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); |
|
} |
} |
} |
} |
} |
|
|
Line 3067 package Apache::lonhelper::group;
|
Line 3080 package Apache::lonhelper::group;
|
|
|
=head2 Element: groupX<group, helper element> |
=head2 Element: groupX<group, helper element> |
|
|
<section> allows the user to choose one or more groups from the current course. |
<group> allows the user to choose one or more groups from the current course. |
|
|
|
It takes the standard attributes "variable", "multichoice", |
|
"allowempty" and "nextstate", meaning what they do for most other |
|
elements. |
|
|
It takes the standard attributes "variable", "multichoice", and "nextstate", meaning what they do for most other elements. |
|
|
|
=cut |
=cut |
|
|
no strict; |
no strict; |
Line 3099 sub start_group {
|
Line 3114 sub start_group {
|
$paramHash->{'variable'} = $token->[2]{'variable'}; |
$paramHash->{'variable'} = $token->[2]{'variable'}; |
$helper->declareVar($paramHash->{'variable'}); |
$helper->declareVar($paramHash->{'variable'}); |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
|
$paramHash->{'allowempty'} = $token->[2]{'allowempty'}; |
if (defined($token->[2]{'nextstate'})) { |
if (defined($token->[2]{'nextstate'})) { |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
} |
} |
Line 3106 sub start_group {
|
Line 3122 sub start_group {
|
# Populate the CHOICES element |
# Populate the CHOICES element |
my %choices; |
my %choices; |
|
|
my $numgroups; |
|
my %curr_groups; |
my %curr_groups; |
if (&Apache::loncommon::coursegroups(\%curr_groups)) { |
if (&Apache::loncommon::coursegroups(\%curr_groups)) { |
foreach my $group_name (keys %curr_groups) { |
foreach my $group_name (sort(keys(%curr_groups))) { |
$choices{$group_name} = $group_name; |
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); |
} |
} |
} |
|
foreach my $group_name (sort(keys(%choices))) { |
|
push @{$paramHash->{CHOICES}}, [$group_name, $group_name]; |
|
} |
} |
} |
} |
|
|
sub end_group { |
sub end_group { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|