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

raeburn raeburn@source.lon-capa.org
Mon, 07 Dec 2009 04:48:04 -0000


raeburn		Mon Dec  7 04:48:04 2009 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	loncoursequeueadmin.pm 
  Log:
  - Customization for GCI_3.
    - Approval of self-enrollment for Concept Inventory course triggers enrollment
      in GCI Submissions course.
  
  
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.12.2.1 loncom/interface/loncoursequeueadmin.pm:1.12.2.2
--- loncom/interface/loncoursequeueadmin.pm:1.12.2.1	Mon Dec  7 02:04:25 2009
+++ loncom/interface/loncoursequeueadmin.pm	Mon Dec  7 04:48:04 2009
@@ -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.1 2009/12/07 02:04:25 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.12.2.2 2009/12/07 04:48:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -456,7 +456,10 @@
             my $uhome = &Apache::lonnet::homeserver($uname,$udom);
             if ($uhome ne 'no_host') {
                 if (exists($requesthash{$uname.':'.$udom})) {
-
+                    if ($cdom eq 'gci' && $cnum eq '9615072b469884921gcil1') {
+                        my $enresult = &enable_gci_submission($uname,$udom,
+                                                   $access_start,$access_end);
+                    }
                     if (exists($classlist->{$uname.':'.$udom})) {
                         if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') {
                             if (($classlist->{$uname.':'.$udom}->[$idx->{'status'}] eq 'Active') ||
@@ -905,6 +908,23 @@
     return $output;
 }
 
+sub enable_gci_submission {
+    my ($udom,$uname,$access_end,$access_start) = @_;
+    my $cdom = 'gci';
+    my $cnum = '1H96711d710194bfegcil1';
+    my ($stucounts,$idx,$classlist) = &get_student_counts($cdom,$cnum);
+    if (exists($classlist->{$uname.':'.$udom})) {
+        if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') {
+            if (($classlist->{$uname.':'.$udom}->[$idx->{'status'}] eq 'Active') ||
+                ($classlist->{$uname.':'.$udom}->[$idx->{'status'}] eq 'Future')) {
+                return;
+            }
+        }
+    }
+    return
+        &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,undef,$access_end,$access_start,'selfenroll',undef,$cdom.'_'.$cnum,1);
+}
+
 sub get_student_counts {
     my ($cdom,$cnum) = @_;
     my (%idx,%stucounts);