Diff for /loncom/interface/lonstatistics.pm between versions 1.21 and 1.23

version 1.21, 2002/05/27 00:24:05 version 1.23, 2002/05/30 13:09:13
Line 523  sub StudentReport { Line 523  sub StudentReport {
       "\n".'<th> Tries </th>'.        "\n".'<th> Tries </th>'.
       "\n".'</tr>';        "\n".'</tr>';
     my ($temp)=keys(%result);      my ($temp)=keys(%result);
     unless ($temp=~/^error\:/) {      unless ($temp=~/^(con_lost|error|no_such_host)/i) {
         foreach my $CurCol (@cols) {          foreach my $CurCol (@cols) {
     if (!$CurCol){      if (!$CurCol){
  my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1});   my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1});
Line 749  sub usection { Line 749  sub usection {
     my ($udom,$unam,$courseid,$ActiveFlag)=@_;      my ($udom,$unam,$courseid,$ActiveFlag)=@_;
     $courseid=~s/\_/\//g;      $courseid=~s/\_/\//g;
     $courseid=~s/^(\w)/\/$1/;      $courseid=~s/^(\w)/\/$1/;
     foreach (split(/\&/,&Apache::lonnet::reply('dump:'.  
              $udom.':'.$unam.':roles',      my %result=&Apache::lonnet::dump('roles',$udom,$unam);
              &Apache::lonnet::homeserver($unam,$udom)))){      my ($checkForResult)=keys(%result);
         my ($key,$value)=split(/\=/,$_);      if ($checkForResult=~/^(con_lost|error|no_such_host)/i) {
         $key=&Apache::lonnet::unescape($key);   return -1;
       }
       foreach my $key (keys (%result)) {
    my $value=$result{$key};
         if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) {          if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) {
             my $section=$1;              my $section=$1;
             if ($key eq $courseid.'_st') { $section=''; }              if ($key eq $courseid.'_st') { $section=''; }
     my ($dummy,$end,$start)=split(/\_/,&Apache::lonnet::unescape($value));      my ($dummy,$end,$start)=split(/\_/,$value);
     if ( $ActiveFlag ne 'Any' ) {      if ( $ActiveFlag ne 'Any' ) {
  my $now=time;   my $now=time;
  my $notactive=0;   my $notactive=0;
Line 804  sub ExtractStudentData { Line 807  sub ExtractStudentData {
     my $SecLimit;      my $SecLimit;
     my $MapLimit;      my $MapLimit;
     my ($temp)=keys(%result);      my ($temp)=keys(%result);
     unless ($temp=~/^error\:/) {      unless ($temp=~/^(con_lost|error|no_such_host)/i) {
         foreach my $CurCol(@cols) {          foreach my $CurCol(@cols) {
     ($PrOrd,$ResId)=split(/\:/,$CurCol);      ($PrOrd,$ResId)=split(/\:/,$CurCol);
     if ( !$CurCol ) { next; }      if ( !$CurCol ) { next; }
Line 1401  sub ClassList { Line 1404  sub ClassList {
     &GetStatus();      &GetStatus();
   
     $cid=$ENV{'request.course.id'};      $cid=$ENV{'request.course.id'};
     my $chome=$ENV{'course.'.$cid.'.home'};  
     my ($cdom,$cnum)=split(/\_/,$cid);      my ($cdom,$cnum)=split(/\_/,$cid);
 # ----------------------- Get first and last resource, see if there is anything  # ----------------------- Get first and last resource, see if there is anything
     $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};      $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};
Line 1418  sub ClassList { Line 1420  sub ClassList {
 #    foreach my $KeyPoint(sort keys(%students)) {  #    foreach my $KeyPoint(sort keys(%students)) {
   
   
  my $classlst=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':classlist',$chome);  
   
  my $StudNo = 0;   my $StudNo = 0;
  my $now=time;   my $now=time;
  unless ($classlst=~/^error\:/) {  
     foreach my $KeyPoint(sort split(/\&/,$classlst)) {   my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum);
  my ($name,$value)=split(/\=/,$KeyPoint);  
  my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));   my ($checkForError)=keys(%result);
    if($checkForError=~/^(con_lost|error|no_such_host)/i) {
       $r->print('<h1>Could not access course data</h1>');
    } else {
       foreach my $name (keys (%classlist)) {
    my $value=$classlist{$name};
    my ($end,$start)=split(/\:/,$value);
  my $active=1;   my $active=1;
  my $Status=$ENV{'form.status'};   my $Status=$ENV{'form.status'};
  $Status = ($Status) ? $Status : 'Active';   $Status = ($Status) ? $Status : 'Active';
  if ( ( ($end) && $now > $end ) &&    if ( ( ($end) && $now > $end ) && 
                      ( ($Status eq 'Active') ) ) { $active=0; }       ( ($Status eq 'Active') ) ) { $active=0; }
   
  if ( ($Status eq 'Expired') &&    if ( ($Status eq 'Expired') && 
                      ($end == 0 || $now < $end) ) { $active=0; }       ($end == 0 || $now < $end) ) { $active=0; }
   
  if ($active) {   if ($active) {
     my $thisindex=$#students+1;      my $thisindex=$#students+1;
     $name=&Apache::lonnet::unescape($name);  
     $students[$thisindex]=$name;      $students[$thisindex]=$name;
     my ($sname,$sdom)=split(/\:/,$name);      my ($sname,$sdom)=split(/\:/,$name);
     my $ssec=&usection($sdom,$sname,$cid,$Status);      my $ssec=&usection($sdom,$sname,$cid,$Status);
Line 1450  sub ClassList { Line 1453  sub ClassList {
  $StuBox{$sname}=$sdom;   $StuBox{$sname}=$sdom;
     }      }
     $StudNo++;      $StudNo++;
         }   }
     }      }
  }   }
  else {  
     $r->print('<h1>Could not access course data</h1>');  
  }   
         $r->print("Total number of students : ".($#students+1));          $r->print("Total number of students : ".($#students+1));
         $r->rflush();          $r->rflush();
 # --------------- Find all assessments and put them into some linear-like order  # --------------- Find all assessments and put them into some linear-like order

Removed from v.1.21  
changed lines
  Added in v.1.23


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