version 1.19, 2002/05/16 01:27:05
|
version 1.26, 2002/05/31 16:02:11
|
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,5/26 Behrouz Minaei |
# |
# |
### |
### |
|
|
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 86 my %Header = (0,"Homework Sets Order",1,
|
Line 87 my %Header = (0,"Homework Sets Order",1,
|
9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd"); |
9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd"); |
my %Answer = (); |
my %Answer = (); |
|
|
|
|
|
sub Activity { |
|
my $file="/home/minaeibi/activity.log"; |
|
my $userid='adamsde1'; |
|
$r->print("<br>Using $file"); |
|
$r->rflush(); |
|
open(FILEID, "<$file"); |
|
my $line; |
|
my @allaccess; |
|
my $Count=0; |
|
while ($line=<FILEID>) { |
|
my ($time,$machine,$what)=split(':',$line); |
|
$what=&Apache::lonnet::unescape($what); |
|
my @accesses=split('&',$what); |
|
foreach my $access (@accesses) { |
|
my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access); |
|
if ($who ne $userid) { next; } |
|
if (!$resource) { next; } |
|
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; |
|
} |
|
} |
|
# @allaccess=sort(@allaccess); |
|
# $Count=0; |
|
# foreach my $access (@allaccess) { |
|
# my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access); |
|
# $Count++; |
|
# $r->print("<br>$Count) $date: $who --> $resource"); |
|
# $r->rflush(); |
|
# if ($post) { |
|
# $r->print("<br><b>Sent data ".join(':',unescape(@posts)).'</b>'); |
|
# } |
|
# } |
|
} |
|
|
|
|
|
|
sub InitAnalysis { |
sub InitAnalysis { |
my ($rid, $student)=@_; |
my ($rid, $student)=@_; |
my ($uname,$udom)=split(/\:/,$student); |
my ($uname,$udom)=split(/\:/,$student); |
Line 174 sub ShowOpGraph {
|
Line 223 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 234 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 218 sub DrawGraph {
|
Line 269 sub DrawGraph {
|
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}). |
|
'] 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); |
$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 255 sub AnalyzeProblem {
|
Line 327 sub AnalyzeProblem {
|
my $OpSel=''; |
my $OpSel=''; |
my $CurInt = $ENV{'form.interval'}; |
my $CurInt = $ENV{'form.interval'}; |
if ($CurInt eq '') {$CurMap = '1';} |
if ($CurInt eq '') {$CurMap = '1';} |
my $Ptr = '<b>Select number of intervals</b>'."\n". |
my $Ptr = '<br><b>Select number of intervals</b>'."\n". |
'<select name="interval">'."\n"; |
'<select name="interval">'."\n"; |
for (my $n=1;$n<=7;$n++) { |
for (my $n=1;$n<=7;$n++) { |
$Ptr .= '<option'; |
$Ptr .= '<option'; |
Line 271 sub AnalyzeProblem {
|
Line 343 sub AnalyzeProblem {
|
"\n".'<tr>'. |
"\n".'<tr>'. |
"\n".'<th> # </th>'. |
"\n".'<th> # </th>'. |
"\n".'<th> Problem Title </th>'. |
"\n".'<th> Problem Title </th>'. |
"\n".'<th> Resouse </th>'. |
"\n".'<th> Resource </th>'. |
"\n".'<th> Address </th>'. |
"\n".'<th> Address </th>'. |
"\n".'</tr>'; |
"\n".'</tr>'; |
|
|
Line 282 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 454 sub StudentReport {
|
Line 526 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 547 sub StudentReport {
|
Line 619 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 615 sub PreStatTable {
|
Line 687 sub PreStatTable {
|
$Ptr .= '<pre>'. |
$Ptr .= '<pre>'. |
'<b> #Stdnts</b>: Total Number of Students opened the problem.<br>'. |
'<b> #Stdnts</b>: Total Number of Students opened the problem.<br>'. |
'<b> Tries </b>: Total Number of Tries for solving the problem.<br>'. |
'<b> Tries </b>: Total Number of Tries for solving the problem.<br>'. |
'<b> Max </b> : Maximunm Number of Tries for solving the problem.<br>'. |
'<b> Mod </b>: Maximunm Number of Tries for solving the problem.<br>'. |
'<b> Avg. </b>: Average Number of the tries. [ Tries / #Stdnts ]<br>'. |
'<b> Mean </b>: Average Number of the tries. [ Tries / #Stdnts ]<br>'. |
'<b> #YES </b>: Number of students solved the problem correctly.<br>'. |
'<b> #YES </b>: Number of students solved the problem correctly.<br>'. |
'<b> #yes </b>: Number of students solved the problem by override.<br>'. |
'<b> #yes </b>: Number of students solved the problem by override.<br>'. |
'<b> %Wrng </b>: Percentage of students tried to solve the problem but'. |
'<b> %Wrng </b>: Percentage of students tried to solve the problem but'. |
Line 624 sub PreStatTable {
|
Line 696 sub PreStatTable {
|
# ' DoDiff : Degree of Difficulty of the problem. [ Tries/(#YES+#yes+0.1) ]<br>'. Kashy formula |
# ' DoDiff : Degree of Difficulty of the problem. [ Tries/(#YES+#yes+0.1) ]<br>'. Kashy formula |
'<b> DoDiff </b>: Degree of Difficulty of the problem. [ 1 - ((#YES+#yes) / Tries) ]<br>'. #Gerd formula |
'<b> DoDiff </b>: Degree of Difficulty of the problem. [ 1 - ((#YES+#yes) / Tries) ]<br>'. #Gerd formula |
'<b> S.D. </b> : Standard Deviation of the tries.'. |
'<b> S.D. </b> : Standard Deviation of the tries.'. |
'[ sqrt(sum((Xi - Avg.)^2)) / (#Stdnts-1)'. |
'[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1)'. |
' where Xi denotes every student\'s tries ]<br>'. |
' where Xi denotes every student\'s tries ]<br>'. |
'<b> Skew. </b>: Skewness of the students tries.'. |
'<b> Skew. </b>: Skewness of the students tries.'. |
' [ (sqrt( sum((Xi - Avg.)^3) / #Stdnts)) / (S.D.^3) ]<br>'. |
' [ (sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3) ]<br>'. |
'<b> Dis.F. </b>: Discrimination Factor: A Standard for '. |
'<b> Dis.F. </b>: Discrimination Factor: A Standard for '. |
'evaluating the problem according to a Criterion<br>'. |
'evaluating the problem according to a Criterion<br>'. |
'<b> [Applied Criterion in %27 Upper Students - '. |
'<b> [Applied Criterion in %27 Upper Students - '. |
Line 680 sub usection {
|
Line 752 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 735 sub ExtractStudentData {
|
Line 810 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 858 sub ExtractStudentData {
|
Line 933 sub ExtractStudentData {
|
} |
} |
|
|
|
|
|
|
# ------------------------------------------------------------ Build page table |
# ------------------------------------------------------------ Build page table |
sub tracetable { |
sub tracetable { |
my ($rid,$beenhere)=@_; |
my ($rid,$beenhere)=@_; |
Line 1144 sub Cache_Statistics {
|
Line 1220 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 1219 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 1284 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 1326 sub initial {
|
Line 1421 sub initial {
|
# } |
# } |
# untie(%students); |
# untie(%students); |
|
|
|
|
sub ClassList { |
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'}}; |
$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 $classlst=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':classlist',$chome); |
|
my $StudNo = 0; |
my $StudNo = 0; |
my $now=time; |
my $now=time; |
unless ($classlst=~/^error\:/) { |
my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum); |
foreach my $KeyPoint(sort split(/\&/,$classlst)) { |
|
my ($name,$value)=split(/\=/,$KeyPoint); |
my ($checkForError)=keys(%classlist); |
my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value)); |
if($checkForError=~/^(con_lost|error|no_such_host)/i) { |
|
$r->print('<h1>Could not access course data</h1>'); |
|
} else { |
|
foreach my $name (sort 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 1378 sub ClassList {
|
Line 1464 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 |
Line 1408 sub ClassList {
|
Line 1492 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 1509 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>'; |
Line 1502 sub CreateForm {
|
Line 1518 sub CreateForm {
|
$Ptr .= '<br><br>'; |
$Ptr .= '<br><br>'; |
$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"/>'; |
$r->print( $Ptr ); |
$r->print( $Ptr ); |
} |
} |
else { |
else { |
Line 1525 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=~/^Analyze\_/) { |
if ($InpStr eq 'Activity Log') { |
|
&Activity(); |
|
} |
|
elsif ($InpStr=~/^Analyze\_/) { |
&ClassList(); |
&ClassList(); |
&ShowOpGraph($InpStr,$ENV{'form.interval'}); |
&ShowOpGraph($InpStr,$ENV{'form.interval'}); |
} |
} |
Line 1547 sub Menu {
|
Line 1571 sub Menu {
|
$r->rflush(); |
$r->rflush(); |
} |
} |
|
|
|
|
sub StudentOptions { |
sub StudentOptions { |
my $OpSel5=''; |
my $OpSel5=''; |
$CurStu = $ENV{'form.student'}; |
$CurStu = $ENV{'form.student'}; |