version 1.38, 2002/08/01 20:49:06
|
version 1.42, 2002/08/13 12:21:46
|
Line 47 use Apache::lonhtmlcommon;
|
Line 47 use Apache::lonhtmlcommon;
|
use Apache::lonproblemanalysis; |
use Apache::lonproblemanalysis; |
use Apache::lonproblemstatistics; |
use Apache::lonproblemstatistics; |
use Apache::lonstudentassessment; |
use Apache::lonstudentassessment; |
use Apache::lonchart; |
|
use HTML::TokeParser; |
use HTML::TokeParser; |
use GDBM_File; |
use GDBM_File; |
|
|
Line 72 sub ProcessFormData{
|
Line 71 sub ProcessFormData{
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['sort','download', |
['sort','download', |
'reportSelected', |
'reportSelected', |
'StudentAssessmentStudent']); |
'StudentAssessmentStudent', |
|
'ProblemStatisticsSort']); |
&CheckFormElement($cache, 'Status', 'Status', 'Active'); |
&CheckFormElement($cache, 'Status', 'Status', 'Active'); |
&CheckFormElement($cache, 'postdata', 'reportSelected', 'Class list'); |
&CheckFormElement($cache, 'postdata', 'reportSelected', 'Class list'); |
&CheckFormElement($cache, 'reportSelected', 'reportSelected', |
&CheckFormElement($cache, 'reportSelected', 'reportSelected', |
Line 121 sub ProcessFormData{
|
Line 121 sub ProcessFormData{
|
'ProblemStatisticsAscend', 'Ascending'); |
'ProblemStatisticsAscend', 'Ascending'); |
&CheckFormElement($cache, 'ProblemStatisticsMaps', |
&CheckFormElement($cache, 'ProblemStatisticsMaps', |
'ProblemStatisticsMaps', 'All Maps'); |
'ProblemStatisticsMaps', 'All Maps'); |
|
&CheckFormElement($cache, 'ProblemStatisticsSort', |
|
'ProblemStatisticsSort', 'Homework Sets Order'); |
|
&CheckFormElement($cache, 'DisplayLegend', 'DisplayLegend', 'Hide Legend'); |
|
|
# Search only form elements |
# Search only form elements |
my @headingColumns=(); |
my @headingColumns=(); |
Line 356 sub PrepareData {
|
Line 359 sub PrepareData {
|
$cache{'updateTime:columnWidth'}=24; |
$cache{'updateTime:columnWidth'}=24; |
|
|
if($cache{'download'} ne 'false') { |
if($cache{'download'} ne 'false') { |
my $who = $cache{'download'}; |
my @who = ($cache{'download'}); |
my $courseData = |
|
&Apache::loncoursedata::DownloadCourseInformation( |
|
$who, $courseID, |
|
$cache{$who.':lastDownloadTime'}); |
|
&Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who); |
|
$cache{'download'} = 'false'; |
$cache{'download'} = 'false'; |
|
if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'false', |
|
$cacheDB, 'true', |
|
'false', $courseID, |
|
$r, $c) ne 'OK') { |
|
untie(%cache); |
|
return 'Stop at download individual'; |
|
} |
} elsif($cache{'DownloadAll'} ne 'false') { |
} elsif($cache{'DownloadAll'} ne 'false') { |
|
$cache{'DownloadAll'} = 'false'; |
my @allStudents; |
my @allStudents; |
if($cache{'DownloadAll'} eq 'sorted') { |
if($cache{'DownloadAll'} eq 'sorted') { |
@allStudents = @$students; |
@allStudents = @$students; |
} else { |
} else { |
@allStudents = split(':::', $cache{'NamesOfStudents'}); |
@allStudents = split(':::', $cache{'NamesOfStudents'}); |
} |
} |
foreach (@allStudents) { |
if(&Apache::loncoursedata::DownloadStudentCourseData(\@allStudents, |
my $courseData = |
'false', |
&Apache::loncoursedata::DownloadCourseInformation( |
$cacheDB, 'true', |
$_, $courseID, |
'true', $courseID, |
$cache{$_.':lastDownloadTime'}); |
$r, $c) ne 'OK') { |
&Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, |
untie(%cache); |
$_); |
return 'Stop at download all'; |
if($c->aborted()) { |
|
untie(%cache); |
|
return 'aborted'; |
|
} |
|
} |
} |
$cache{'DownloadAll'} = 'false'; |
|
} |
} |
|
|
if($c->aborted()) { |
if($c->aborted()) { |
Line 395 sub PrepareData {
|
Line 396 sub PrepareData {
|
return ('OK', $students); |
return ('OK', $students); |
} |
} |
|
|
|
|
# Create progress |
|
sub Create_PrgWin { |
|
my ($r)=@_; |
|
$r->print(<<ENDPOP); |
|
<script> |
|
popwin=open('','popwin','width=400,height=100'); |
|
popwin.document.writeln('<html><body bgcolor="#88DDFF">'+ |
|
'<title>LON-CAPA Statistics</title>'+ |
|
'<h4>Computation Progress</h4>'+ |
|
'<form name=popremain>'+ |
|
'<input type=text size=35 name=remaining value=Starting></form>'+ |
|
'</body></html>'); |
|
popwin.document.close(); |
|
</script> |
|
ENDPOP |
|
|
|
$r->rflush(); |
|
} |
|
|
|
# update progress |
|
sub Update_PrgWin { |
|
my ($totalStudents,$index,$name,$r)=@_; |
|
$r->print('<script>popwin.document.popremain.remaining.value="'. |
|
'Computing '.$index.'/'.$totalStudents.': '. |
|
$name.'";</script>'); |
|
$r->rflush(); |
|
} |
|
|
|
# close Progress Line |
|
sub Close_PrgWin { |
|
my ($r)=@_; |
|
$r->print('<script>popwin.close()</script>'); |
|
$r->rflush(); |
|
} |
|
|
|
|
|
sub BuildClasslist { |
sub BuildClasslist { |
my ($cacheDB,$students,$studentInformation,$headings)=@_; |
my ($cacheDB,$students,$studentInformation,$headings,$r)=@_; |
|
|
my %cache; |
my %cache; |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
Line 446 sub BuildClasslist {
|
Line 410 sub BuildClasslist {
|
|
|
my $displayString = '<td align="left"><a href="/adm/statistics?'; |
my $displayString = '<td align="left"><a href="/adm/statistics?'; |
$displayString .= 'sort=LINKDATA">DISPLAYDATA </a></td>'."\n"; |
$displayString .= 'sort=LINKDATA">DISPLAYDATA </a></td>'."\n"; |
$Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache, $studentInformation, |
$Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache, |
|
$studentInformation, |
$headings, $displayString); |
$headings, $displayString); |
$Str .= '</tr>'."\n"; |
$Str .= '</tr>'."\n"; |
|
|
my $alternate=0; |
my $alternate=0; |
foreach (@$students) { |
foreach (@$students) { |
my ($username, $domain) = split(':', $_); |
my ($username, $domain) = split(':', $_); |
Line 483 sub BuildClasslist {
|
Line 449 sub BuildClasslist {
|
|
|
$Str .= '</tr>'."\n"; |
$Str .= '</tr>'."\n"; |
$Str .= '</table></td></tr></table>'."\n"; |
$Str .= '</table></td></tr></table>'."\n"; |
|
$r->print($Str); |
|
$r->rflush(); |
|
|
untie(%cache); |
untie(%cache); |
|
|
return $Str; |
return; |
} |
} |
|
|
sub CreateMainMenu { |
sub CreateMainMenu { |
Line 539 sub BuildStatistics {
|
Line 507 sub BuildStatistics {
|
my %reports = ('classlist' => 'Class list', |
my %reports = ('classlist' => 'Class list', |
'problem_statistics' => 'Problem Statistics', |
'problem_statistics' => 'Problem Statistics', |
'student_assessment' => 'Student Assessment', |
'student_assessment' => 'Student Assessment', |
'activitylog' => 'Activity Log', |
# 'activitylog' => 'Activity Log', |
'reportSelected' => 'Class list'); |
'reportSelected' => 'Class list'); |
|
|
my %cache; |
my %cache; |
Line 547 sub BuildStatistics {
|
Line 515 sub BuildStatistics {
|
my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}". |
my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}". |
"_$ENV{'user.domain'}_$courseID\_statistics.db"; |
"_$ENV{'user.domain'}_$courseID\_statistics.db"; |
|
|
|
$r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics')); |
|
|
my ($returnValue, $students) = &PrepareData($c, $cacheDB, |
my ($returnValue, $students) = &PrepareData($c, $cacheDB, |
\@studentInformation, |
\@studentInformation, |
\@headings,$r); |
\@headings,$r); |
if($returnValue ne 'OK') { |
if($returnValue ne 'OK') { |
$r->print('<html><body>'.$returnValue."\n".'</body></html>'); |
$r->print($returnValue."\n".'</body></html>'); |
return OK; |
return OK; |
} |
} |
|
if(!$c->aborted()) { |
|
&Apache::loncoursedata::CheckForResidualDownload($cacheDB, |
|
'true', 'true', |
|
$courseID, |
|
$r, $c); |
|
} |
|
|
my $GoToPage; |
my $GoToPage; |
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
Line 569 sub BuildStatistics {
|
Line 545 sub BuildStatistics {
|
$reports{'problem_analysis'} = 'Problem Analysis'; |
$reports{'problem_analysis'} = 'Problem Analysis'; |
} |
} |
|
|
$r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics')); |
|
$r->print('<form name="Statistics" '); |
$r->print('<form name="Statistics" '); |
$r->print('method="post" action="/adm/statistics">'); |
$r->print('method="post" action="/adm/statistics">'); |
$r->print(&CreateMainMenu($cache{'Status'}, \%reports)); |
$r->print(&CreateMainMenu($cache{'Status'}, \%reports)); |
|
$r->rflush(); |
untie(%cache); |
untie(%cache); |
} else { |
} else { |
$r->print('<html><body>Unable to tie database.</body></html>'); |
$r->print('<html><body>Unable to tie database.</body></html>'); |
Line 587 sub BuildStatistics {
|
Line 563 sub BuildStatistics {
|
$courseID, |
$courseID, |
$c,$r); |
$c,$r); |
} elsif($GoToPage eq 'Problem Analysis') { |
} elsif($GoToPage eq 'Problem Analysis') { |
$r->print( |
&Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB, $r); |
&Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB)); |
|
} elsif($GoToPage eq 'Student Assessment') { |
} elsif($GoToPage eq 'Student Assessment') { |
$r->print( |
&Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB, |
&Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB, |
|
$students, |
$students, |
$courseID, |
$courseID, |
'Statistics', |
'Statistics', |
\@headings, |
\@headings, |
$spacing, |
$spacing, |
\@studentInformation, |
\@studentInformation, |
$r, $c)); |
$r, $c); |
} elsif($GoToPage eq 'Analyze') { |
} elsif($GoToPage eq 'Analyze') { |
$r->print(&Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, |
&Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, $students, |
$students, |
$courseID, $r); |
$courseID,$r)); |
} elsif($GoToPage eq 'DoDiffGraph' || $GoToPage eq 'PercentWrongGraph') { |
} elsif($GoToPage eq 'DoDiffGraph') { |
&Apache::lonproblemstatistics::BuildGraphicChart($GoToPage,$r,$cacheDB); |
&Apache::lonproblemstatistics::BuildDiffGraph($r); |
|
} elsif($GoToPage eq 'PercentWrongGraph') { |
|
&Apache::lonproblemstatistics::BuildWrongGraph($r); |
|
} elsif($GoToPage eq 'Class list') { |
} elsif($GoToPage eq 'Class list') { |
$r->print(&BuildClasslist($cacheDB, $students, \@studentInformation, |
&BuildClasslist($cacheDB, $students, \@studentInformation, |
\@headings)); |
\@headings, $r); |
} |
} |
|
|
$r->print('</form>'."\n"); |
$r->print('</form>'."\n"); |