Diff for /loncom/interface/loncoursedata.pm between versions 1.190 and 1.196

version 1.190, 2008/11/20 21:22:21 version 1.196, 2015/03/10 02:45:56
Line 56  use Apache::lonmysql(); Line 56  use Apache::lonmysql();
 use LONCAPA;  use LONCAPA;
 use Digest::MD5();  use Digest::MD5();
   
   =pod 
   
   =head2 make_into_hash
   
   Turn a colon separated string into a hash and return a reference
   to it.  Numbering from 0 even elements are keys and odd elements
   are values e.g. a:b:c:d creates a hash like
     a => b, c =>d
   
   =cut
   
 sub make_into_hash {  sub make_into_hash {
     my $values = shift;      my $values = shift;
     my %tmp = map { &unescape($_); } split(':',$values);      my %tmp = map { &unescape($_); } split(':',$values);
Line 436  sub init_dbs { Line 447  sub init_dbs {
     return 0;      return 0;
 }  }
   
   =pod
   
   =head2 delete_caches
   
   Drops all of the tables in the local mysql cache associated with the
   specified course id.
   
   TODO:  The drops should be pushed into lonmysql to further isolate 
   mysql code from other modules.
   
   =cut
 sub delete_caches {  sub delete_caches {
     my $courseid = shift;      my $courseid = shift;
     $courseid = $env{'request.course.id'} if (! defined($courseid));      $courseid = $env{'request.course.id'} if (! defined($courseid));
Line 1231  sub ensure_current_data { Line 1251  sub ensure_current_data {
     }      }
   
     my $student_id = &get_student_id($sname,$sdom);      my $student_id = &get_student_id($sname,$sdom);
       &get_students_groupids($student_id);
     my @Result = &Apache::lonmysql::get_rows($student_table,      my @Result = &Apache::lonmysql::get_rows($student_table,
                                              "student_id ='$student_id'");                                               "student_id ='$student_id'");
     my $data = undef;      my $data = undef;
Line 1257  sub ensure_current_full_data { Line 1278  sub ensure_current_full_data {
         ($sdom,$sname,$courseid.'.db',$getuserdir);          ($sdom,$sname,$courseid.'.db',$getuserdir);
     #      #
     my $student_id = &get_student_id($sname,$sdom);      my $student_id = &get_student_id($sname,$sdom);
       &get_students_groupids($student_id);
     my @Result = &Apache::lonmysql::get_rows($student_table,      my @Result = &Apache::lonmysql::get_rows($student_table,
                                              "student_id ='$student_id'");                                               "student_id ='$student_id'");
     my $updatetime;      my $updatetime;
Line 2271  sub CL_FULLNAME { return 6; } Line 2293  sub CL_FULLNAME { return 6; }
 sub CL_STATUS   { return 7; }  sub CL_STATUS   { return 7; }
 sub CL_TYPE     { return 8; }  sub CL_TYPE     { return 8; }
 sub CL_LOCKEDTYPE   { return 9; }  sub CL_LOCKEDTYPE   { return 9; }
 sub CL_GROUP    { return 10; }  sub CL_CREDITS  { return 10; }
 sub CL_PERMANENTEMAIL { return 11; }  sub CL_GROUP    { return 11; }
 sub CL_ROLE     { return 12; }  sub CL_PERMANENTEMAIL { return 12; }
 sub CL_EXTENT   { return 13; }  sub CL_ROLE     { return 13; }
 sub CL_PHOTO   { return 14; }  sub CL_EXTENT   { return 14; }
 sub CL_THUMBNAIL { return 15; }  sub CL_PHOTO   { return 15; }
   sub CL_THUMBNAIL { return 16; }
   sub CL_AUTHORQUOTA { return 17; }
   sub CL_AUTHORUSAGE { return 18; }
   
 sub get_classlist {  sub get_classlist {
     my ($cdom,$cnum) = @_;      my ($cdom,$cnum) = @_;
Line 2296  sub get_classlist { Line 2321  sub get_classlist {
         }          }
         my ($sname,$sdom) = split(/:/,$student);          my ($sname,$sdom) = split(/:/,$student);
         my @Values = split(/:/,$info);          my @Values = split(/:/,$info);
         my ($end,$start,$id,$section,$fullname,$type,$lockedtype);          my ($end,$start,$id,$section,$fullname,$type,$lockedtype,$credits);
         if (@Values > 2) {          if (@Values > 2) {
             ($end,$start,$id,$section,$fullname,$type,$lockedtype) = @Values;              ($end,$start,$id,$section,$fullname,$type,$lockedtype,$credits) = @Values;
         } else { # We have to get the data ourselves          } else { # We have to get the data ourselves
             ($end,$start) = @Values;              ($end,$start) = @Values;
             $section = &Apache::lonnet::getsection($sdom,$sname,$cid);              $section = &Apache::lonnet::getsection($sdom,$sname,$cid);
Line 2337  sub get_classlist { Line 2362  sub get_classlist {
             $status='Future';              $status='Future';
         }          }
         $classlist{$student} =           $classlist{$student} = 
             [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,$lockedtype];              [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,
                $lockedtype,$credits];
     }      }
     if (wantarray()) {      if (wantarray()) {
         return (\%classlist,['domain','username','end','start','id',          return (\%classlist,['domain','username','end','start','id',
                              'section','fullname','status','type','lockedtype']);                               'section','fullname','status','type',
                                'lockedtype','credits']);
     } else {      } else {
         return \%classlist;          return \%classlist;
     }      }
Line 3071  $env{'course.'.$cid.'.domain'}, and $env Line 3098  $env{'course.'.$cid.'.domain'}, and $env
   
 Returns a reference to a hash which contains:  Returns a reference to a hash which contains:
  keys    '$sname:$sdom'   keys    '$sname:$sdom'
  values  [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,$lockedtype]   values  [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,
             $lockedtype,$credits]
   
 The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used  The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used
 as indices into the returned list to future-proof clients against  as indices into the returned list to future-proof clients against

Removed from v.1.190  
changed lines
  Added in v.1.196


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>