[LON-CAPA-cvs] cvs: loncom(version_1_0_X) /interface loncoursedata.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 01 Oct 2003 21:41:47 -0000


albertel		Wed Oct  1 17:41:47 2003 EDT

  Modified files:              (Branch: version_1_0_X)
    /loncom/interface	loncoursedata.pm 
  Log:
  - backport 1.97
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.81 loncom/interface/loncoursedata.pm:1.81.2.1
--- loncom/interface/loncoursedata.pm:1.81	Mon Jul 14 09:10:39 2003
+++ loncom/interface/loncoursedata.pm	Wed Oct  1 17:41:47 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.81 2003/07/14 13:10:39 matthew Exp $
+# $Id: loncoursedata.pm,v 1.81.2.1 2003/10/01 21:41:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1165,6 +1165,33 @@
         $studentdata->{$symb}->{$base.'.awarddetail'} = $awarddetail;
         $studentdata->{$symb}->{'timestamp'} = $time if (defined($time) && $time ne '');
     }
+    ## Get misc parameters
+    $request = 'SELECT c.symb,a.parameter,a.value '.
+        "FROM $student_table AS b ".
+        "LEFT JOIN $parameters_table AS a ON b.student_id=a.student_id ".
+        "LEFT JOIN $symb_table AS c ON c.symb_id = a.symb_id ".
+        "WHERE student='$student'";
+    if (defined($symb) && $symb ne '') {
+        $request .= " AND c.symb=".$dbh->quote($symb);
+    }
+    $sth = $dbh->prepare($request);
+    $sth->execute();
+    if ($sth->err()) {
+        &Apache::lonnet::logthis("Unable to execute MySQL request:");
+        &Apache::lonnet::logthis("\n".$request."\n");
+        &Apache::lonnet::logthis("error is:".$sth->errstr());
+        if (defined($symb) && $symb ne '') {
+            $studentdata = $studentdata->{$symb};
+        }
+        return $studentdata;
+    }
+    #
+    foreach my $row (@{$sth->fetchall_arrayref}) {
+        $rows_retrieved++;
+        my ($symb,$parameter,$value) = (@$row);
+        $studentdata->{$symb}->{$parameter}  = $value;
+    }
+    #
     if (defined($symb) && $symb ne '') {
         $studentdata = $studentdata->{$symb};
     }