Diff for /loncom/interface/lonstatistics.pm between versions 1.19 and 1.20

version 1.19, 2002/05/16 01:27:05 version 1.20, 2002/05/19 15:44:40
Line 31 Line 31
 # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei  # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
 # YEAR=2002  # YEAR=2002
 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei  # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
 # 5/12, 5/14, 5/15 Behrouz Minaei  # 5/12,5/14,5/15,5/19 Behrouz Minaei
 #  #
 ###  ###
   
Line 174  sub ShowOpGraph { Line 174  sub ShowOpGraph {
     for (my $k=0; $k<$Int_No; $k++ ) {      for (my $k=0; $k<$Int_No; $k++ ) {
  &DrawGraph($k,$Src);   &DrawGraph($k,$Src);
     }      }
       for (my $k=0; $k<$Int_No; $k++ ) {
    &DrawTable($k);
       }
 #$Apache::lonxml::debug=1;  #$Apache::lonxml::debug=1;
 #&Apache::lonhomework::showhash(%ConceptData);  #&Apache::lonhomework::showhash(%ConceptData);
 #$Apache::lonxml::debug=0;  #$Apache::lonxml::debug=0;
Line 182  sub ShowOpGraph { Line 185  sub ShowOpGraph {
 }  }
   
   
 sub DrawGraph {  sub DrawTable {
     my ($k,$Src)=@_;      my $k=shift;
     my $Max=0;      my $Max=0;
     my @data1;      my @data1;
     my @data2;      my @data2;
     my $Correct=0;      my $Correct=0;
     my $Wrong=0;      my $Wrong=0;
     # Adjust Data and find the Max   
     for (my $n=0; $n<=$#Concepts; $n++ ) {      for (my $n=0; $n<=$#Concepts; $n++ ) {
  my $tmp=$Concepts[$n];   my $tmp=$Concepts[$n];
  $data1[$n]=$ConceptData{"$tmp.$k.true"};   $data1[$n]=$ConceptData{"$tmp.$k.true"};
Line 223  sub DrawGraph { Line 225  sub DrawGraph {
                 "\n"."<td bgcolor=#FFDDDD> ".$data2[$n]." </td>".                  "\n"."<td bgcolor=#FFDDDD> ".$data2[$n]." </td>".
                 "\n"."</tr>";                  "\n"."</tr>";
     }      }
       $Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.'.$k}).
             '] To: ['.localtime($ConceptData{'Int.'.($k+1)}-1).
             "]</b></td><td>$Correct</td><td>$Wrong</td>";
   
       $Str .= "\n".'</table>';
   
       $r->print($Str);
 #$Apache::lonxml::debug=1;  #$Apache::lonxml::debug=1;
 #&Apache::lonhomework::showhash(%ConceptData);  #&Apache::lonhomework::showhash(%ConceptData);
 #$Apache::lonxml::debug=0;  #$Apache::lonxml::debug=0;
   }
   
 #    $Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.$k'}).  
 #          '] To: ['.localtime($ConceptData{'Int.'.($k+1)}).  
 #          "]</b></td><td>$Correct</td><td>$Wrong</td>";#  
   
     $Str .= "\n".'</table>';  sub DrawGraph {
       my ($k,$Src)=@_;
       my $Max=0;
       my @data1;
       my @data2;
   
 #    $r->print($Str);      # Adjust Data and find the Max 
       for (my $n=0; $n<=$#Concepts; $n++ ) {
    my $tmp=$Concepts[$n];
    $data1[$n]=$ConceptData{"$tmp.$k.true"};
    $data2[$n]=$ConceptData{"$tmp.$k.false"};
    my $Sum=$data1[$n]+$data2[$n];
    if ( $Max<$Sum ) {$Max=$Sum;}
       }
       for (my $n=0; $n<=$#Concepts; $n++ ) {
    if ($data1[$n]+$data2[$n]<$Max) {
       $data2[$n]+=$Max-($data1[$n]+$data2[$n]);
    }
       }
       my $P_No = $#data1+1;
   
     if ( $Max > 1 ) {       if ( $Max > 1 ) { 
  $Max += (10 - $Max % 10);   $Max += (10 - $Max % 10);
Line 547  sub StudentReport { Line 571  sub StudentReport {
   
 sub CreateTable {  sub CreateTable {
     my ($Hd, $Hid)=@_;      my ($Hd, $Hid)=@_;
     if ($ENV{'form.showcsv'}) {      if ($ENV{'form.showcsv'}) { 
  if ( $Hd == 1 ) {   if ( $Hd == 1 ) {
     $r->print('<br>"'.$hash{'title_'.$Hid}.'","'.$hash{'src_'.$Hid}.'"');      $r->print('<br>"'.$hash{'title_'.$Hid}.'","'.$hash{'src_'.$Hid}.'"');
  }   }
Line 1144  sub Cache_Statistics { Line 1168  sub Cache_Statistics {
     my @list = ();      my @list = ();
     my $Useful;      my $Useful;
     my $UnUseful;      my $UnUseful;
   #    $r->print('<input type="hidden" name="show" value="excel" />'."\n"); 
     my %myHeader = reverse( %Header );      my %myHeader = reverse( %Header );
     #&Apache::lonnet::delenv('form_');  
     #&Apache::lonnet::delenv('test');   
     $Pos = $myHeader{$ENV{'form.sort'}};      $Pos = $myHeader{$ENV{'form.sort'}};
     if ($Pos > 0) {$Pos++;}      if ($Pos > 0) {$Pos++;}
     $p_count = 0;      $p_count = 0;
Line 1347  sub ClassList { Line 1370  sub ClassList {
 # my ($temp)=keys(%students);  # my ($temp)=keys(%students);
 # unless ($temp=~/^error\:/) {  # unless ($temp=~/^error\:/) {
 #    foreach my $KeyPoint(sort keys(%students)) {  #    foreach my $KeyPoint(sort keys(%students)) {
   
   
  my $classlst=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':classlist',$chome);   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\:/) {   unless ($classlst=~/^error\:/) {
Line 1408  sub ClassList { Line 1434  sub ClassList {
 }  }
   
   
 sub ClassListnew {  
   
     &GetStatus();  
   
     $cid=$ENV{'request.course.id'};  
     my $chome=$ENV{'course.'.$cid.'.home'};  
     my ($cdom,$cnum)=split(/\_/,$cid);  
 # ----------------------- Get first and last resource, see if there is anything  
     $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};  
     $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}};  
     if (($firstres) && ($lastres)) {  
   
  my %students = &Apache::lonnet::dump('classlist',$cdom,$cnum);  
  my $StudNo = 0;  
  my $now=time;  
  my ($temp)=keys(%students);  
  unless ($temp=~/^error\:/) {  
     foreach (sort keys(%students)) {  
  my ($name,$value)=split(/\=/,$_);  
  my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));  
  $name=&Apache::lonnet::unescape($name);  
  my ($sname,$sdom)=split(/\:/,$name);  
  my $active=1;  
  my $Status=$ENV{'form.status'};  
  $Status = ($Status) ? $Status : 'Active';  
  if ( ( ($end) && $now > $end ) &&   
                      ( ($Status eq 'Active') ) ) { $active=0; }  
  if ( ($Status eq 'Expired') &&   
                      ($end == 0 || $now < $end) ) { $active=0; }  
  if ($active) {  
     my $thisindex=$#students+1;  
     $name=&Apache::lonnet::unescape($name);  
     $students[$thisindex]=$name;  
     my ($sname,$sdom)=split(/\:/,$name);  
     #my %reply=&Apache::lonnet::idrget($sdom,$sname);  
     #my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname.  
     #         ':environment:lastname&generation&firstname&middlename',  
     #         &Apache::lonnet::homeserver($sname,$sdom));  
     my $ssec=&usection($sdom,$sname,$cid,$Status);  
 #    if ($ssec==-1 ) {next;}  
     if ($ssec==-1 || $ssec eq 'adm' ) {next;}  
     $ssec=($ssec) ? $ssec : '(none)';  
     #$ssec=(int($ssec)) ? int($ssec) : $ssec;  
     $section{$ssec}=$ssec;  
     if ($CurSec eq 'All Sections' || $ssec eq $CurSec) {  
  $students[$StudNo]=$name;  
  $StuBox{$sname}=$sdom;  
     }  
     $StudNo++;  
         }  
     }  
  }  
  else {  
     $r->print('<h1>Could not access course data</h1>');  
  }   
         $r->print("Total number of students : ".($#students+1));  
         $r->rflush();  
 # --------------- Find all assessments and put them into some linear-like order  
  &tracetable($firstres,'&'.$lastres.'&');  
     }  
   
 # ------------------------------------------------------------- End render page   
     else {  
  $r->print('<h3>Undefined course sequence</h3>');  
     }  
 }  
   
   
 sub Title {  sub Title {
     $r->print('<html><head><title>LON-CAPA Statistics</title></head>');      $r->print('<html><head><title>LON-CAPA Statistics</title></head>');
     $r->print('<body bgcolor="#FFFFFF">'.      $r->print('<body bgcolor="#FFFFFF">'.
Line 1493  sub Title { Line 1451  sub Title {
 sub CreateForm {  sub CreateForm {
     $r->print("\n".'<form name=stat method=post action="/adm/statistics" >');      $r->print("\n".'<form name=stat method=post action="/adm/statistics" >');
     my $content = $ENV{'form.sort'};      my $content = $ENV{'form.sort'};
     if (!($ENV{'form.showcsv'}) && #|| !($ENV{'csv'})) &&       if (!($ENV{'form.showcsv'}) && 
          ($content eq '' || $content eq 'Return to Menu')) {          ($content eq '' || $content eq 'Return to Menu')) {
  my $Ptr = '<h3>';   my $Ptr = '<h3>';
  $Ptr .= '<input type=submit name=sort value="Problem Stats"/>';   $Ptr .= '<input type=submit name=sort value="Problem Stats"/>';
  $Ptr .= '<br><br>';   $Ptr .= '<br><br>';

Removed from v.1.19  
changed lines
  Added in v.1.20


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