'."\n";
- $Str .= ''."\n";
-
- my $displayString = 'DISPLAYDATA  | '."\n";
- $Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache,
- $studentInformation,
- $headings, $displayString);
- $Str .= ' '."\n";
-
- my $alternate=0;
- foreach (@$students) {
-# if ($mySections{$cache{$_.':'.'section'}} ne 'True') {next;}
- my ($username, $domain) = split(':', $_);
- if($alternate) {
- $Str .= '';
- } else {
- $Str .= ' ';
+#######################################################
+#######################################################
+
+=pod
+
+=item &selected_sequences_with_assessments
+
+Retrieve the sequences which were selected by the user to show.
+
+Input: $mode: scalar. Either 'selected' or 'all'. If not specified,
+ 'selected' is used.
+
+Returns: an array containing a navmap object and navmap resources,
+ or an array containing a scalar with an error message.
+
+=cut
+
+#######################################################
+#######################################################
+sub selected_sequences_with_assessments {
+ my ($mode) = @_;
+ $mode = 'selected' if (! defined($mode));
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (!defined($navmap)) {
+ return ('Can not open Coursemap');
+ }
+ #
+ my @sequences = $navmap->retrieveResources(undef,
+ sub { shift->is_map(); },1,0,1);
+ my $toplevelseq = $navmap->getById('0.0');
+ if (!grep(/^\Q$toplevelseq\E$/,@sequences)) {
+ unshift(@sequences,$toplevelseq);
+ }
+
+ my @sequences_with_assessments;
+ foreach my $sequence (@sequences) {
+ if ($navmap->hasResource($sequence,sub { shift->is_problem(); },0,1)){
+ push(@sequences_with_assessments,$sequence);
}
- $alternate = ($alternate + 1) % 2;
- foreach my $data (@$studentInformation) {
- $Str .= '';
- if($data eq 'fullname') {
- $Str .= '';
- $Str .= $cache{$_.':'.$data}.' ';
- $Str .= '';
- } elsif($data eq 'updateTime') {
- $Str .= '';
- $Str .= $cache{$_.':'.$data}.' ';
- $Str .= ' ';
- } else {
- $Str .= $cache{$_.':'.$data}.' ';
+ }
+ #
+ my @sequences_to_show;
+ foreach my $sequence (@sequences_with_assessments) {
+ if ($mode eq 'all') {
+ push (@sequences_to_show,$sequence);
+ } elsif ($mode eq 'selected') {
+ foreach my $map_symb (&get_selected_maps('Maps')) {
+ if ($sequence->symb eq $map_symb || $map_symb eq 'all'){
+ push (@sequences_to_show,$sequence);
+ last; # Only put it in once
+ }
}
-
- $Str .= ' | '."\n";
}
+
}
+ return $navmap,@sequences_to_show;
+}
- $Str .= ' '."\n";
- $Str .= '
|