version 1.38, 2002/08/01 20:49:06
|
version 1.44, 2002/08/14 16:18:55
|
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 82 sub ProcessFormData{
|
Line 82 sub ProcessFormData{
|
&CheckFormElement($cache, 'DownloadAll', 'DownloadAll', 'false'); |
&CheckFormElement($cache, 'DownloadAll', 'DownloadAll', 'false'); |
&CheckFormElement($cache, 'sort', 'sort', 'fullname'); |
&CheckFormElement($cache, 'sort', 'sort', 'fullname'); |
&CheckFormElement($cache, 'download', 'download', 'false'); |
&CheckFormElement($cache, 'download', 'download', 'false'); |
|
&CheckFormElement($cache, 'StatisticsMaps', |
|
'StatisticsMaps', 'All Maps'); |
|
if(defined($ENV{'form.Section'})) { |
|
my @sectionsSelected = (ref($ENV{'form.Section'}) ? |
|
@{$ENV{'form.Section'}} : |
|
($ENV{'form.Section'})); |
|
$cache->{'sectionsSelected'} = join(':', @sectionsSelected); |
|
} elsif(!defined($cache->{'sectionsSelected'})) { |
|
$cache->{'sectionsSelected'} = $cache->{'sectionList'}; |
|
} |
|
|
# student assessment |
# student assessment |
if(defined($ENV{'form.CreateStudentAssessment'}) || |
if(defined($ENV{'form.CreateStudentAssessment'}) || |
Line 102 sub ProcessFormData{
|
Line 112 sub ProcessFormData{
|
&Apache::lonnet::unescape($cache->{'StudentAssessmentStudent'}); |
&Apache::lonnet::unescape($cache->{'StudentAssessmentStudent'}); |
&CheckFormElement($cache, 'DefaultColumns', 'DefaultColumns', 'false'); |
&CheckFormElement($cache, 'DefaultColumns', 'DefaultColumns', 'false'); |
|
|
if(defined($ENV{'form.Section'})) { |
|
my @sectionsSelected = (ref($ENV{'form.Section'}) ? |
|
@{$ENV{'form.Section'}} : |
|
($ENV{'form.Section'})); |
|
$cache->{'sectionsSelected'} = join(':', @sectionsSelected); |
|
} elsif(!defined($cache->{'sectionsSelected'})) { |
|
$cache->{'sectionsSelected'} = $cache->{'sectionList'}; |
|
} |
|
|
|
# Problem analysis |
# Problem analysis |
&CheckFormElement($cache, 'Interval', 'Interval', '1'); |
&CheckFormElement($cache, 'Interval', 'Interval', '1'); |
|
|
Line 119 sub ProcessFormData{
|
Line 120 sub ProcessFormData{
|
'DisplayFormat', 'Display Table Format'); |
'DisplayFormat', 'Display Table Format'); |
&CheckFormElement($cache, 'ProblemStatisticsAscend', |
&CheckFormElement($cache, 'ProblemStatisticsAscend', |
'ProblemStatisticsAscend', 'Ascending'); |
'ProblemStatisticsAscend', 'Ascending'); |
&CheckFormElement($cache, 'ProblemStatisticsMaps', |
&CheckFormElement($cache, 'ProblemStatisticsSort', |
'ProblemStatisticsMaps', 'All Maps'); |
'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 358 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 395 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 409 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 448 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 506 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 514 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 544 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 562 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') { |
my $courseDescription = $ENV{'course.'.$courseID.'.description'}; |
&Apache::lonproblemstatistics::BuildDiffGraph($r); |
$courseDescription =~ s/\ /"_"/eg; |
} elsif($GoToPage eq 'PercentWrongGraph') { |
&Apache::lonproblemstatistics::BuildGraphicChart($GoToPage, $cacheDB, |
&Apache::lonproblemstatistics::BuildWrongGraph($r); |
$courseDescription, |
|
$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"); |