Diff for /loncom/interface/lonstatistics.pm between versions 1.24 and 1.25

version 1.24, 2002/05/30 13:36:18 version 1.25, 2002/05/31 13:47:01
Line 78  my $lastres; Line 78  my $lastres;
 my $DiscFlag;  my $DiscFlag;
 my $HWN;  my $HWN;
 my $P_Order;  my $P_Order;
   my %color;
 my %foil_to_concept;  my %foil_to_concept;
 my @Concepts;  my @Concepts;
 my %ConceptData;  my %ConceptData;
Line 87  my %Header = (0,"Homework Sets Order",1, Line 88  my %Header = (0,"Homework Sets Order",1,
 my %Answer = ();  my %Answer = ();
   
   
 sub unescape {  
     my $str=shift;  
     $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;  
     return $str;  
 }  
   
 sub Activity {  sub Activity {
     my $file="/home/minaeibi/minaei";      my $file="/home/minaeibi/minaei";
     my $userid='billskat';      my $userid='billskat';
Line 101  sub Activity { Line 96  sub Activity {
     open(FILEID, "<$file");      open(FILEID, "<$file");
     my $line;      my $line;
     my @allaccess;      my @allaccess;
       my $Count=0;
     while ($line=<FILEID>) {      while ($line=<FILEID>) {
  my ($time,$machine,$what)=split(':',$line);   my ($time,$machine,$what)=split(':',$line);
  #$r->print("time=$time machine=$machine:-> $what\n");   $what=&Apache::lonnet::unescape($what);
  #$r->rflush();  
  $what=&unescape($what);  
  my @accesses=split('&',$what);   my @accesses=split('&',$what);
  foreach my $access (@accesses) {   foreach my $access (@accesses) {
     my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);      my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
     if ($who ne $userid) { next; }      if ($who ne $userid) { next; }
     #if (!$resource) { next; }      if (!$resource) { next; }
     push (@allaccess,unescape($access));      my $res=&Apache::lonnet::unescape($resource);
    #if (($key=~/\.(\w+)\.(\w+)\.submission$/)) {
          #if ($meta=~/\.(problem|exam|quiz|assess|survey|form)$/) {
    #   foreach my $Key(split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {
    #       if ($Key=~/^stores\_(\w+)\_tries$/) {
   
      # if (($res =~ /^\/res\/adm/)) {
    $Count++;
    $r->print("<br>$Count) $date: $who --> $res");
           if ($post) { 
       $Count++;
       $r->print("<br><b>$Count) Sent data ".join(':',
                                 &Apache::lonnet::unescape(@posts)).'</b>');
    }
    $r->rflush();
    #    }
    ##    push (@allaccess,unescape($access));
     #print $machine;      #print $machine;
  }   }
     }      }
     @allaccess=sort(@allaccess);  #    @allaccess=sort(@allaccess);
     my $Count=0;  #    $Count=0;
     foreach my $access (@allaccess) {  #    foreach my $access (@allaccess) {
  my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);  # my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
  $Count++;  # $Count++;
 # $r->print("$Count ".localtime($date)." $who $resource\n");  # $r->print("<br>$Count) $date: $who --> $resource");
  $r->print("<br>$Count) $date: $who --> $resource");  # $r->rflush();
  $r->rflush();  # if ($post) { 
  if ($post) {   #    $r->print("<br><b>Sent data ".join(':',unescape(@posts)).'</b>');
     $r->print("<br><b>Sent data ".join(':',unescape(@posts)).'</b>');  # }
  }  #    }
     }  
 }  }
   
   
Line 265  sub DrawTable { Line 274  sub DrawTable {
     for (my $n=0; $n<=$#Concepts; $n++ ) {      for (my $n=0; $n<=$#Concepts; $n++ ) {
  $Str .= "\n"."<tr>".   $Str .= "\n"."<tr>".
         "\n"."<td>".($n+1)."</td>".          "\n"."<td>".($n+1)."</td>".
                 "\n"."<td bgcolor=#FFFFDD> ".$Concepts[$n]." </td>".                  "\n".'<td bgcolor='.$color{"yellow"}.'> '.$Concepts[$n]." </td>".
                 "\n"."<td bgcolor=#DDFFDD> ".$data1[$n]." </td>".                  "\n".'<td bgcolor='.$color{"green"}.'> '.$data1[$n]." </td>".
                 "\n"."<td bgcolor=#FFDDDD> ".$data2[$n]." </td>".                  "\n".'<td bgcolor='.$color{"red"}.'> '.$data2[$n]." </td>".
                 "\n"."</tr>";                  "\n"."</tr>";
     }      }
     $Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.'.$k}).      $Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.'.$k}).
Line 309  sub DrawGraph { Line 318  sub DrawGraph {
  $Max = int($Max);   $Max = int($Max);
     } else { $Max = 1; }      } else { $Max = 1; }
   
       
     my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.($k+1) : $Src;      my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.($k+1) : $Src;
 #    $GData=$Titr.'&Concepts'.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2;  #    $GData=$Titr.'&Concepts'.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2;
     $GData="$Titr&Concepts&Answers&$Max&$P_No&".      $GData="$Titr&Concepts&Answers&$Max&$P_No&".
Line 351  sub AnalyzeProblem { Line 359  sub AnalyzeProblem {
                     '" target="_blank">'.$hash{'title_'.$rid}.'</a>';                      '" target="_blank">'.$hash{'title_'.$rid}.'</a>';
  $Str .= "\n"."<tr>".   $Str .= "\n"."<tr>".
          "\n"."<td> $P_No </td>".           "\n"."<td> $P_No </td>".
                  "\n"."<td bgcolor=#DDFFDD> ".$Temp." </td>".                   "\n"."<td bgcolor=".$color{"green"}."> ".$Temp." </td>".
                  "\n"."<td bgcolor=#EEFFCC> ".$hash{'src_'.$rid}." </td>".                   "\n"."<td bgcolor=".$color{"yellow"}."> ".$hash{'src_'.$rid}." </td>".
          "\n"."<td> ".'<input type="submit" name="sort" value="'.'Analyze_'.$rid.'" />'.'</td>'.           "\n"."<td> ".'<input type="submit" name="sort" value="'.'Analyze_'.$rid.'" />'.'</td>'.
                  "\n"."</tr>";                   "\n"."</tr>";
  $P_No++;   $P_No++;
Line 1291  sub TableRow { Line 1299  sub TableRow {
                "\n".'<td>'.($RealIdx+1).'</td>'.                 "\n".'<td>'.($RealIdx+1).'</td>'.
           #     "\n".'<td>'.$PrOrd.$Temp.'</td>'.            #     "\n".'<td>'.$PrOrd.$Temp.'</td>'.
                "\n".'<td>'.$Temp.'</td>'.                 "\n".'<td>'.$Temp.'</td>'.
                "\n".'<td bgcolor="#EEFFCC"> '.$StdNo.'</td>'.                 "\n".'<td bgcolor='.$color{"yellow"}.'> '.$StdNo.'</td>'.
                "\n".'<td bgcolor="#EEFFCC">'.$TotalTries.'</td>'.                 "\n".'<td bgcolor='.$color{"yellow"}.'>'.$TotalTries.'</td>'.
                "\n".'<td bgcolor="#EEFFCC">'.$MxTries.'</td>'.                 "\n".'<td bgcolor='.$color{"yellow"}.'>'.$MxTries.'</td>'.
                "\n".'<td bgcolor="#DDFFFF">'.$Avg.'</td>'.                 "\n".'<td bgcolor='.$color{"gb"}.'>'.$Avg.'</td>'.
                "\n".'<td bgcolor="#DDFFFF"> '.$YES.'</td>'.                 "\n".'<td bgcolor='.$color{"gb"}.'> '.$YES.'</td>'.
                "\n".'<td bgcolor="#DDFFFF"> '.$Override.'</td>'.                 "\n".'<td bgcolor='.$color{"gb"}.'> '.$Override.'</td>'.
                "\n".'<td bgcolor="#FFDDDD"> '.$Wrng.'</td>'.                 "\n".'<td bgcolor='.$color{"red"}.'> '.$Wrng.'</td>'.
                "\n".'<td bgcolor="#FFDDDD">'.$DoD.'</td>'.                 "\n".'<td bgcolor='.$color{"red"}.'> '.$DoD.'</td>'.
                "\n".'<td bgcolor="#DDFFDD"> '.$SD.'</td>'.                 "\n".'<td bgcolor='.$color{"green"}.'> '.$SD.'</td>'.
                "\n".'<td bgcolor="#DDFFDD"> '.$Sk.'</td>'.                 "\n".'<td bgcolor='.$color{"green"}.'> '.$Sk.'</td>'.
                "\n".'<td bgcolor="#FFDDFF"> '.$_D1.'</td>'.                 "\n".'<td bgcolor='.$color{"purple"}.'> '.$_D1.'</td>'.
        "\n".'<td bgcolor="#FFDDFF"> '.$_D2.'</td>';         "\n".'<td bgcolor='.$color{"purple"}.'> '.$_D2.'</td>';
         $r->print("\n".$Ptr.'</tr>' );          $r->print("\n".$Ptr.'</tr>' );
     }      }
     $GraphDat{$RealIdx}=$DoD.':'.$Wrng;      $GraphDat{$RealIdx}=$DoD.':'.$Wrng;
Line 1356  sub GetGraphData { Line 1364  sub GetGraphData {
   
 sub initial {  sub initial {
 # --------------------------------- Initialize the global varaibles  # --------------------------------- Initialize the global varaibles
   undef @students;      undef @students;
   undef @cols;      undef @cols;
   undef %maps;      undef %maps;
   undef %section;      undef %section;
   undef %StuBox;      undef %StuBox;
   undef @list;      undef @list;
   undef %CachData;      undef %CachData;
   undef %GraphDat;      undef %GraphDat;
   undef %DiscFac;      undef %DiscFac;
   undef %OpResp;      undef %OpResp;
   undef %ConceptData;      undef %ConceptData;
   undef $CurMap;      undef $CurMap;
   undef $CurSec;      undef $CurSec;
   undef $CurStu;      undef $CurStu;
   undef $p_count;      undef $p_count;
   undef $Pos;      undef $Pos;
   undef $GData;      undef $GData;
   $DiscFlag=0;       $DiscFlag=0; 
   $P_Order=100000;      $P_Order=100000;
   $HWN=$P_Order;      $HWN=$P_Order;
       &setbgcolor(0);
   }
   
   # For loading the colored table for display or un-colored for print
   sub setbgcolor {
       my $PrintTable=shift;
       undef %color;
       if ($PrintTable){
    $color{"gb"}="#FFFFFF";
    $color{"red"}="#FFFFFF";
    $color{"yellow"}="#FFFFFF";
    $color{"green"}="#FFFFFF";
    $color{"purple"}="#FFFFFF";
       } else {
    $color{"gb"}="#DDFFFF";
    $color{"red"}="#FFDDDD";
    $color{"yellow"}="#EEFFCC";
    $color{"green"}="#DDFFDD";
    $color{"purple"}="#FFDDFF";
       }
 }  }
   
   
   
 # my $CacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".  # my $CacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
 #                  "_$ENV{'user.domain'}_$cid\_classlist.db";  #                  "_$ENV{'user.domain'}_$cid\_classlist.db";
 # if (-e "$CacheDB") {  # if (-e "$CacheDB") {
Line 1398  sub initial { Line 1428  sub initial {
 #        }  #        }
 #        untie(%students);  #        untie(%students);
   
   
 sub ClassList {  sub ClassList {
   
     &GetStatus();      &GetStatus();
Line 1508  sub CreateForm { Line 1537  sub CreateForm {
  $Ptr .= '<input type=submit name=sort value="Student Assessment"/>';   $Ptr .= '<input type=submit name=sort value="Student Assessment"/>';
  $Ptr .= '</h3>';   $Ptr .= '</h3>';
  #$Ptr .= '<input type=submit name=sort value="Activity Log"/>';   #$Ptr .= '<input type=submit name=sort value="Activity Log"/>';
  #$Ptr .= '</h3>';  
  $r->print( $Ptr );   $r->print( $Ptr );
     }      }
     else {      else {

Removed from v.1.24  
changed lines
  Added in v.1.25


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