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

version 1.24, 2002/05/30 13:36:18 version 1.26, 2002/05/31 16:02:11
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/activity.log";
     my $userid='billskat';      my $userid='adamsde1';
     $r->print("<br>Using $file");      $r->print("<br>Using $file");
     $r->rflush();      $r->rflush();
     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 (($res =~ /\.(problem|htm|html)/)) {
    $Count++;
    $r->print("<br>$Count) ".localtime($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 269  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 313  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 354  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 1294  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 1359  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'}".
Line 1398  sub initial { Line 1421  sub initial {
 #        }  #        }
 #        untie(%students);  #        untie(%students);
   
   
 sub ClassList {  sub ClassList {
   
     &GetStatus();      &GetStatus();
Line 1409  sub ClassList { Line 1431  sub ClassList {
     $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};      $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};
     $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}};      $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}};
     if (($firstres) && ($lastres)) {      if (($firstres) && ($lastres)) {
 # my %students = &Apache::lonnet::dump('classlist',$cdom,$cnum);  
 #    $Apache::lonxml::debug=1;  
 #    &Apache::lonhomework::showhash(%students);  
 #    $Apache::lonxml::debug=0;  
 # my $StudNo = 0;  
 # my $now=time;  
 # my ($temp)=keys(%students);  
 # unless ($temp=~/^error\:/) {  
 #    foreach my $KeyPoint(sort keys(%students)) {  
   
   
  my $StudNo = 0;   my $StudNo = 0;
  my $now=time;   my $now=time;
   
  my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum);   my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum);
   
  my ($checkForError)=keys(%classlist);   my ($checkForError)=keys(%classlist);
  if($checkForError=~/^(con_lost|error|no_such_host)/i) {   if($checkForError=~/^(con_lost|error|no_such_host)/i) {
     $r->print('<h1>Could not access course data</h1>');      $r->print('<h1>Could not access course data</h1>');
  } else {   } else {
     foreach my $name (keys (%classlist)) {      foreach my $name (sort keys (%classlist)) {
  my $value=$classlist{$name};   my $value=$classlist{$name};
  my ($end,$start)=split(/\:/,$value);   my ($end,$start)=split(/\:/,$value);
  my $active=1;   my $active=1;
Line 1508  sub CreateForm { Line 1519  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 {
Line 1532  sub CreateForm { Line 1542  sub CreateForm {
   
 sub Menu {  sub Menu {
     &initial();      &initial();
   #    my $fn=$ENV{'request.course.fn'};
   #    $r->print( '<br>'.$fn.'<br>' );
   
 #    $Apache::lonxml::debug=1;  #    $Apache::lonxml::debug=1;
 #    &Apache::lonhomework::showhash(%ENV);  #    &Apache::lonhomework::showhash(%ENV);
 #    $Apache::lonxml::debug=0;  #    $Apache::lonxml::debug=0;
   
     &Title();      &Title();
     my $InpStr = $ENV{'form.sort'};      my $InpStr = $ENV{'form.sort'};
     if ($InpStr eq 'Activity Log') {      if ($InpStr eq 'Activity Log') {

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


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