[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface loncoursequeueadmin.pm

raeburn raeburn@source.lon-capa.org
Fri, 15 Jan 2010 05:26:52 -0000


raeburn		Fri Jan 15 05:26:52 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	loncoursequeueadmin.pm 
  Log:
  - Customization for GCI_3.
      - Backport 1.14.
  
  
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.12.2.4 loncom/interface/loncoursequeueadmin.pm:1.12.2.5
--- loncom/interface/loncoursequeueadmin.pm:1.12.2.4	Thu Jan  7 17:07:45 2010
+++ loncom/interface/loncoursequeueadmin.pm	Fri Jan 15 05:26:51 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests 
 #
-# $Id: loncoursequeueadmin.pm,v 1.12.2.4 2010/01/07 17:07:45 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.12.2.5 2010/01/15 05:26:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,7 +33,9 @@
 
 =head1 SYNOPSIS
 
-Adminitsration utilities used by domain coordinators for queued course creation requests, and by course coordinators for queued self-enrollment requests.
+Utilities used by domain coordinators to administer queued course creation requests,
+and by course coordinators for queued self-enrollment requests, and by general
+users to display their queued self-enrollment requests.
 
 This is part of the LearningOnline Network with CAPA project
 described at http://www.lon-capa.org.
@@ -50,6 +52,14 @@
 
 =item get_student_counts()
 
+=item course_creation()
+
+=item build_batchcreatehash()
+
+=item can_clone_course()
+
+=item queued_selfenrollment()
+
 =back
 
 =cut
@@ -1072,4 +1082,50 @@
     return $canclone;
 }
 
+sub queued_selfenrollment {
+    my ($notitle) = @_;
+    my $output;
+    my %selfenrollrequests = &Apache::lonnet::dump('selfenrollrequests');
+    my %reqs_by_date;
+    foreach my $item (keys(%selfenrollrequests)) {
+        if (ref($selfenrollrequests{$item}) eq 'HASH') {
+            if ($selfenrollrequests{$item}{'status'} eq 'request') {
+                if ($selfenrollrequests{$item}{'timestamp'}) {
+                    push(@{$reqs_by_date{$selfenrollrequests{$item}{'timestamp'}}},$item);
+                }
+            }
+        }
+    }
+    if (keys(%reqs_by_date)) {
+        my $rolename = &Apache::lonnet::plaintext('st');
+        unless ($notitle) {
+            $output .= '<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />';
+        }
+        $output .= &Apache::loncommon::start_data_table().
+                   &Apache::loncommon::start_data_table_header_row().
+                   '<th>'.&mt('Date requested').'</th><th>'.&mt('Course title').'</th>'.
+                   '<th>'.&mt('User role').'</th><th>'.&mt('Section').'</th>'.
+                   &Apache::loncommon::end_data_table_header_row();
+        my @sorted = sort { $a <=> $b } (keys(%reqs_by_date));
+        foreach my $item (@sorted) {
+            if (ref($reqs_by_date{$item}) eq 'ARRAY') {
+                foreach my $crs (@{$reqs_by_date{$item}}) {
+                    my %courseinfo = &Apache::lonnet::coursedescription($crs);
+                    my $usec = $selfenrollrequests{$crs}{'section'};
+                    if ($usec eq '') {
+                        $usec = &mt('No section');
+                    }
+                    $output .= &Apache::loncommon::start_data_table_row().
+                               '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'.
+                               '<td>'.$courseinfo{'description'}.'</td>'.
+                               '<td>'.$rolename.'</td><td>'.$usec.'</td>'.
+                               &Apache::loncommon::end_data_table_row();
+                }
+            }
+        }
+        $output .= &Apache::loncommon::end_data_table();
+    }
+    return $output;
+}
+
 1;