version 1.115, 2005/02/25 02:37:49
|
version 1.119, 2005/03/14 20:28:21
|
Line 50 use vars qw(
|
Line 50 use vars qw(
|
@FullClasslist |
@FullClasslist |
@Students |
@Students |
@Sections |
@Sections |
@SelectedSections |
|
%StudentData |
%StudentData |
@StudentDataOrder |
@StudentDataOrder |
@SelectedStudentData |
@SelectedStudentData |
Line 124 undef the following package variables:
|
Line 123 undef the following package variables:
|
|
|
=item @Sections |
=item @Sections |
|
|
=item @SelectedSections |
|
|
|
=item %StudentData |
=item %StudentData |
|
|
=item @StudentDataOrder |
=item @StudentDataOrder |
Line 148 sub clear_classlist_variables {
|
Line 145 sub clear_classlist_variables {
|
undef(@FullClasslist); |
undef(@FullClasslist); |
undef(@Students); |
undef(@Students); |
undef(@Sections); |
undef(@Sections); |
undef(@SelectedSections); |
|
undef(%StudentData); |
undef(%StudentData); |
undef(@SelectedStudentData); |
undef(@SelectedStudentData); |
undef($curr_student); |
undef($curr_student); |
Line 174 the following package variables:
|
Line 170 the following package variables:
|
|
|
=item @Sections |
=item @Sections |
|
|
=item @SelectedSections |
|
|
|
=item %StudentData |
=item %StudentData |
|
|
=item @SelectedStudentData |
=item @SelectedStudentData |
Line 205 sub PrepareClasslist {
|
Line 199 sub PrepareClasslist {
|
my $cnum = $ENV{'course.'.$cid.'.num'}; |
my $cnum = $ENV{'course.'.$cid.'.num'}; |
my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist($cid, |
my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist($cid, |
$cdom,$cnum); |
$cdom,$cnum); |
if (exists($ENV{'form.Section'})) { |
my @selected_sections = &get_selected_sections(); |
if (ref($ENV{'form.Section'})) { |
|
@SelectedSections = @{$ENV{'form.Section'}}; |
|
} elsif ($ENV{'form.Section'} !~ /^\s*$/) { |
|
@SelectedSections = ($ENV{'form.Section'}); |
|
} |
|
} |
|
@SelectedSections = ('all') if (! @SelectedSections); |
|
foreach (@SelectedSections) { |
|
if ($_ eq 'all') { |
|
@SelectedSections = ('all'); |
|
} |
|
} |
|
# |
# |
# Deal with instructors with restricted section access |
# Deal with instructors with restricted section access |
if ($ENV{'request.course.sec'} !~ /^\s*$/) { |
if ($ENV{'request.course.sec'} !~ /^\s*$/) { |
@SelectedSections = ($ENV{'request.course.sec'}); |
@selected_sections = ($ENV{'request.course.sec'}); |
} |
} |
# |
# |
# Set up %StudentData |
# Set up %StudentData |
Line 262 sub PrepareClasslist {
|
Line 244 sub PrepareClasslist {
|
$Sections{$section}++; |
$Sections{$section}++; |
# |
# |
# Only put in the list those students we are interested in |
# Only put in the list those students we are interested in |
foreach my $sect (@SelectedSections) { |
foreach my $sect (@selected_sections) { |
if ( (($sect eq 'all') || |
if ( (($sect eq 'all') || |
($section eq $sect)) && |
($section eq $sect)) && |
(($studenthash->{'status'} eq $enrollment_status) || |
(($studenthash->{'status'} eq $enrollment_status) || |
Line 334 sub PrepareClasslist {
|
Line 316 sub PrepareClasslist {
|
return; |
return; |
} |
} |
|
|
|
####################################################### |
|
####################################################### |
|
|
|
=pod |
|
|
|
=item get_selected_sections |
|
|
|
Returns an array of the selected sections |
|
|
|
=cut |
|
|
|
####################################################### |
|
####################################################### |
|
sub get_selected_sections { |
|
my @selected_sections; |
|
if (exists($ENV{'form.Section'})) { |
|
if (ref($ENV{'form.Section'})) { |
|
@selected_sections = @{$ENV{'form.Section'}}; |
|
} elsif ($ENV{'form.Section'} !~ /^\s*$/) { |
|
@selected_sections = ($ENV{'form.Section'}); |
|
} |
|
} |
|
@selected_sections = ('all') if (! @selected_sections); |
|
foreach (@selected_sections) { |
|
if ($_ eq 'all') { |
|
@selected_sections = ('all'); |
|
} |
|
} |
|
# |
|
# Deal with instructors with restricted section access |
|
if ($ENV{'request.course.sec'} !~ /^\s*$/) { |
|
@selected_sections = ($ENV{'request.course.sec'}); |
|
} |
|
return @selected_sections; |
|
} |
|
|
|
####################################################### |
|
####################################################### |
|
|
|
=pod |
|
|
|
=item §ion_and_enrollment_description |
|
|
|
=cut |
|
|
|
####################################################### |
|
####################################################### |
|
sub section_and_enrollment_description { |
|
my @sections = &Apache::lonstatistics::get_selected_sections(); |
|
my $description = &mt('Unable to determine section and enrollment'); |
|
if (scalar(@sections) == 1 && $sections[0] ne 'all') { |
|
$description = &mt('Section [_1]. [_2] enrollment status', |
|
$sections[0],$ENV{'form.Status'}); |
|
} elsif (scalar(@sections) && $sections[0] eq 'all') { |
|
$description = &mt('All sections. [_1] enrollment status', |
|
$ENV{'form.Status'}); |
|
} elsif (scalar(@sections)) { |
|
my $lastsection = pop(@sections); |
|
$description = &mt('Sections [_1] and [_2]. [_3] enrollment status', |
|
join(', ',@sections),$lastsection, |
|
$ENV{'form.Status'}); |
|
} |
|
return $description; |
|
} |
|
|
####################################################### |
####################################################### |
####################################################### |
####################################################### |
Line 500 sub get_selected_maps {
|
Line 546 sub get_selected_maps {
|
} else { |
} else { |
@selected_maps = ('all'); |
@selected_maps = ('all'); |
} |
} |
|
foreach my $map (@selected_maps) { |
|
if ($map eq 'all') { |
|
@selected_maps = ('all'); |
|
last; |
|
} |
|
} |
return @selected_maps; |
return @selected_maps; |
} |
} |
|
|
Line 509 sub get_selected_maps {
|
Line 561 sub get_selected_maps {
|
|
|
=pod |
=pod |
|
|
=item &sequences_with_assessments |
=item &selected_sequences_with_assessments |
|
|
Retrieve the sequences which were selected by the user to show. |
Retrieve the sequences which were selected by the user to show. |
|
|
Line 523 Returns: an array containing a navmap ob
|
Line 575 Returns: an array containing a navmap ob
|
|
|
####################################################### |
####################################################### |
####################################################### |
####################################################### |
sub sequences_with_assessments { |
sub selected_sequences_with_assessments { |
my ($mode) = @_; |
my ($mode) = @_; |
$mode = 'selected' if (! defined($mode)); |
$mode = 'selected' if (! defined($mode)); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
Line 545 sub sequences_with_assessments {
|
Line 597 sub sequences_with_assessments {
|
if ($mode eq 'all') { |
if ($mode eq 'all') { |
push (@sequences_to_show,$sequence); |
push (@sequences_to_show,$sequence); |
} elsif ($mode eq 'selected') { |
} elsif ($mode eq 'selected') { |
foreach my $map_symb (&get_selected_maps()) { |
foreach my $map_symb (&get_selected_maps('Maps')) { |
if ($sequence->symb eq $map_symb || $map_symb eq 'all'){ |
if ($sequence->symb eq $map_symb || $map_symb eq 'all'){ |
push (@sequences_to_show,$sequence); |
push (@sequences_to_show,$sequence); |
last; # Only put it in once |
last; # Only put it in once |
Line 599 sub map_select {
|
Line 651 sub map_select {
|
} |
} |
$form .= 'size="'.$numvisible.'" >'."\n"; |
$form .= 'size="'.$numvisible.'" >'."\n"; |
# |
# |
# Deal with 'all' |
|
foreach (@selected_maps) { |
|
if ($_ eq 'all') { |
|
@selected_maps = ('all'); |
|
last; |
|
} |
|
} |
|
# |
|
# Put in option for 'all' |
# Put in option for 'all' |
$form .= ' <option value="all" '; |
$form .= ' <option value="all" '; |
foreach (@selected_maps) { |
if ($selected_maps[0] eq 'all') { |
if ($_ eq 'all') { |
$form .= 'selected '; |
$form .= 'selected '; |
|
last; |
|
} |
|
} |
} |
$form .= ">all</option>\n"; |
$form .= ">all</option>\n"; |
# |
# |
# Loop through the sequences |
# Loop through the sequences |
my @sequences = &sequences_with_assessments(); |
my @sequences = &selected_sequences_with_assessments('all'); |
my $navmap; |
my $navmap; |
if (!ref($sequences[0])) { |
if (!ref($sequences[0])) { |
return $sequences[0]; |
return $sequences[0]; |
Line 649 sub map_select {
|
Line 690 sub map_select {
|
Returns html for a selection box allowing the user to choose one (or more) |
Returns html for a selection box allowing the user to choose one (or more) |
of the sections in the course. |
of the sections in the course. |
|
|
Uses the package variables @Sections and @SelectedSections |
Uses the package variables @Sections |
=over 4 |
=over 4 |
|
|
=item $elementname The name of the HTML form element |
=item $elementname The name of the HTML form element |
Line 686 sub SectionSelect {
|
Line 727 sub SectionSelect {
|
# Loop through the sequences |
# Loop through the sequences |
foreach my $s (@Sections) { |
foreach my $s (@Sections) { |
$Str .= ' <option value="'.$s.'" '; |
$Str .= ' <option value="'.$s.'" '; |
foreach (@SelectedSections) { |
foreach (&get_selected_sections()) { |
if ($s eq $_) { |
if ($s eq $_) { |
$Str .= 'selected '; |
$Str .= 'selected '; |
last; |
last; |
Line 731 sub DisplayClasslist {
|
Line 772 sub DisplayClasslist {
|
my @Fields = ('fullname','username','domain','id','section','status'); |
my @Fields = ('fullname','username','domain','id','section','status'); |
# |
# |
$Str = ''; |
$Str = ''; |
|
my @selected_sections = &get_selected_sections(); |
if (! @Students) { |
if (! @Students) { |
if ($SelectedSections[0] eq 'all') { |
if ($selected_sections[0] eq 'all') { |
if (lc($ENV{'form.Status'}) eq 'any') { |
if (lc($ENV{'form.Status'}) eq 'any') { |
$Str .= '<h2>'. |
$Str .= '<h2>'. |
&mt('There are no students in the course.'). |
&mt('There are no students in the course.'). |