Diff for /loncom/interface/lonstatistics.pm between versions 1.35 and 1.39

version 1.35, 2002/07/29 21:00:53 version 1.39, 2002/08/05 20:53:38
Line 83  sub ProcessFormData{ Line 83  sub ProcessFormData{
     &CheckFormElement($cache, 'sort', 'sort', 'fullname');      &CheckFormElement($cache, 'sort', 'sort', 'fullname');
     &CheckFormElement($cache, 'download', 'download', 'false');      &CheckFormElement($cache, 'download', 'download', 'false');
   
       # student assessment
     if(defined($ENV{'form.CreateStudentAssessment'}) ||      if(defined($ENV{'form.CreateStudentAssessment'}) ||
        defined($ENV{'form.NextStudent'}) ||         defined($ENV{'form.NextStudent'}) ||
        defined($ENV{'form.PreviousStudent'})) {         defined($ENV{'form.PreviousStudent'})) {
Line 110  sub ProcessFormData{ Line 111  sub ProcessFormData{
         $cache->{'sectionsSelected'} = $cache->{'sectionList'};          $cache->{'sectionsSelected'} = $cache->{'sectionList'};
     }      }
   
       # Problem analysis
       &CheckFormElement($cache, 'Interval', 'Interval', '1');
   
       # ProblemStatistcs
       &CheckFormElement($cache, 'DisplayCSVFormat',
                         'DisplayFormat', 'Display Table Format');
       &CheckFormElement($cache, 'ProblemStatisticsAscend',
                         'ProblemStatisticsAscend', 'Ascending');
       &CheckFormElement($cache, 'ProblemStatisticsMaps', 
                         'ProblemStatisticsMaps', 'All Maps');
   
       # Search only form elements
     my @headingColumns=();      my @headingColumns=();
     my @sequenceColumns=();      my @sequenceColumns=();
     my $foundColumn = 0;      my $foundColumn = 0;
Line 128  sub ProcessFormData{ Line 141  sub ProcessFormData{
         }          }
     }      }
   
       $cache->{'reportKey'} = 'false';
       if($cache->{'reportSelected'} eq 'Analyze') {
           $cache->{'reportKey'} = 'Analyze';
       } elsif($cache->{'reportSelected'} eq 'DoDiffGraph') {
           $cache->{'reportKey'} = 'DoDiffGraph';
       } elsif($cache->{'reportSelected'} eq 'PercentWrongGraph') {
           $cache->{'reportKey'} = 'PercentWrongGraph';
       }
   
       if(defined($ENV{'form.DoDiffGraph'})) {
           $cache->{'reportSelected'} = 'DoDiffGraph';
           $cache->{'reportKey'} = 'DoDiffGraph';
       } elsif(defined($ENV{'form.PercentWrongGraph'})) {
           $cache->{'reportSelected'} = 'PercentWrongGraph';
           $cache->{'reportKey'} = 'PercentWrongGraph';
       }
   
     foreach (keys(%ENV)) {      foreach (keys(%ENV)) {
         if(/form\.Analyze:::/) {          if(/form\.Analyze/) {
 #            $cache->{'reportSelected'} = 'Analyze';              $cache->{'reportSelected'} = 'Analyze';
 #            $cache->{'reportKey'} = 'Problem Analysis';              $cache->{'reportKey'} = 'Analyze';
             my ($uri, $title, $part, $problem);              my $data;
             (undef, $uri, $title, $part, $problem)=split(':::', $_);              (undef, $data)=split(':::', $_);
             $cache->{'AnalyzeURI'}     = $uri;              $cache->{'AnalyzeInfo'}=$data;
             $cache->{'AnalyzeTitle'}   = $title;  
             $cache->{'AnalyzePart'}    = $part;  
             $cache->{'AnalyzeProblem'} = $problem;  
               
             &CheckFormElement($cache, 'Interval', 'Interval', '1');  
         } elsif(/form\.HeadingColumn/) {          } elsif(/form\.HeadingColumn/) {
             my $value = $_;              my $value = $_;
             $value =~ s/form\.//;              $value =~ s/form\.//;
Line 168  sub ProcessFormData{ Line 193  sub ProcessFormData{
     $cache->{'DefaultColumns'} = 'false';      $cache->{'DefaultColumns'} = 'false';
   
     return;      return;
   
     # Select page to display  
     if(defined($ENV{'form.ProblemStatistics'}) ||  
        defined($ENV{'form.ProblemStatisticsRecalculate'}) ||   
        defined($ENV{'form.DisplayCSVFormat'})) {  
         $cache->{'GoToPage'} = 'ProblemStatistics';  
         &CheckFormElement($cache, 'DisplayCSVFormat',  
                           'DisplayFormat', 'Display Table Format');  
         &CheckFormElement($cache, 'Ascend','ProblemStatisticsAscend',  
                           'Ascending');  
         &CheckFormElement($cache, 'Maps', 'ProblemStatisticsMap',   
                           'All Maps');  
     } elsif(defined($ENV{'form.ProblemAnalysis'})) {  
         $cache->{'GoToPage'} = 'ProblemAnalysis';  
         &CheckFormElement($cache, 'Interval', 'Interval', '1');  
     } elsif(defined($ENV{'form.DoDiffGraph'})) {  
         $cache->{'GoToPage'} = 'DoDiffGraph';  
     } elsif(defined($ENV{'form.PercentWrongGraph'})) {  
         $cache->{'GoToPage'} = 'PercentWrongGraph';  
     } elsif(defined($ENV{'form.ActivityLog'})) {  
         $cache->{'GoToPage'} = 'ActivityLog';  
     } else {  
         $cache->{'GoToPage'} = 'Menu';  
     }  
   
     &CheckFormElement($cache, 'Status', 'Status', 'Active');  
   
     return;  
 }  }
   
 =pod  =pod
Line 296  sub SpaceColumns { Line 293  sub SpaceColumns {
 }  }
   
 sub PrepareData {  sub PrepareData {
     my ($c, $cacheDB, $studentInformation, $headings)=@_;      my ($c, $cacheDB, $studentInformation, $headings,$r)=@_;
   
     # Test for access to the cache data      # Test for access to the cache data
     my $courseID=$ENV{'request.course.id'};      my $courseID=$ENV{'request.course.id'};
Line 313  sub PrepareData { Line 310  sub PrepareData {
   
     # Download class list information if not using cached data      # Download class list information if not using cached data
     my %cache;      my %cache;
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) {      unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) {
         return "Unable to tie hash to db file.";          return "Unable to tie hash to db file.";
     }      }
   
     if(!$isCached) {      if(!$isCached) {
         my $processTopResourceMapReturn=          my $processTopResourceMapReturn=
             &Apache::loncoursedata::ProcessTopResourceMap(\%cache, $c);              &Apache::loncoursedata::ProcessTopResourceMap(\%cache, $c, $r);
         if($processTopResourceMapReturn ne 'OK') {          if($processTopResourceMapReturn ne 'OK') {
             untie(%cache);              untie(%cache);
             return $processTopResourceMapReturn;              return $processTopResourceMapReturn;
Line 367  sub PrepareData { Line 364  sub PrepareData {
         &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who);          &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who);
         $cache{'download'} = 'false';          $cache{'download'} = 'false';
     } 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'});
         }          }
           &Create_PrgWin($r);
           my $count=1;
         foreach (@allStudents) {          foreach (@allStudents) {
               &Update_PrgWin(scalar(@allStudents),$count,$_,$r);
             my $courseData =               my $courseData = 
                 &Apache::loncoursedata::DownloadCourseInformation(                  &Apache::loncoursedata::DownloadCourseInformation(
                                              $_, $courseID,                                                $_, $courseID, 
Line 384  sub PrepareData { Line 385  sub PrepareData {
                 untie(%cache);                  untie(%cache);
                 return 'aborted';                   return 'aborted'; 
             }              }
               $count++;
         }          }
         $cache{'DownloadAll'} = 'false';          &Close_PrgWin($r);
     }      }
   
     if($c->aborted()) {      if($c->aborted()) {
Line 436  sub Close_PrgWin { Line 438  sub Close_PrgWin {
   
   
 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)) {
         return '<html><body>Unable to tie database.</body></html>';          return '<html><body>Unable to tie database.</body></html>';
     }      }
   
Line 449  sub BuildClasslist { Line 451  sub BuildClasslist {
   
     my $displayString = '<td align="left"><a href="/adm/statistics?';      my $displayString = '<td align="left"><a href="/adm/statistics?';
     $displayString .= 'sort=LINKDATA">DISPLAYDATA&nbsp</a></td>'."\n";      $displayString .= 'sort=LINKDATA">DISPLAYDATA&nbsp</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 486  sub BuildClasslist { Line 490  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 542  sub BuildStatistics { Line 548  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',
                    'reportSelected'     => 'Class list');                     'reportSelected'     => 'Class list');
   
     my %cache;      my %cache;
Line 551  sub BuildStatistics { Line 558  sub BuildStatistics {
   
     my ($returnValue, $students) = &PrepareData($c, $cacheDB,       my ($returnValue, $students) = &PrepareData($c, $cacheDB, 
                                                 \@studentInformation,                                                   \@studentInformation, 
                                                 \@headings);                                                  \@headings,$r);
     if($returnValue ne 'OK') {      if($returnValue ne 'OK') {
         $r->print('<html><body>'.$returnValue."\n".'</body></html>');          $r->print('<html><body>'.$returnValue."\n".'</body></html>');
         return OK;          return OK;
     }      }
   
     my $GoToPage;      my $GoToPage;
     if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {      if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
         $GoToPage = $cache{'reportSelected'};          $GoToPage = $cache{'reportSelected'};
         $reports{'reportSelected'} = $cache{'reportSelected'};          $reports{'reportSelected'} = $cache{'reportSelected'};
 #        if(defined($cache{'reportKey'}) && $cache{'reportKey'} ne 'false') {          if(defined($cache{'reportKey'}) && 
 #            $reports{$cache{'reportKey'}} = $cache{'reportSelected'};             !exists($reports{$cache{'reportKey'}}) && 
 #        }             $cache{'reportKey'} ne 'false') {
               $reports{$cache{'reportKey'}} = $cache{'reportSelected'};
           }
   
         if(defined($cache{'OptionResponses'})) {          if(defined($cache{'OptionResponses'})) {
             $reports{'problem_analysis'} = 'Problem Analysis';              $reports{'problem_analysis'} = 'Problem Analysis';
Line 573  sub BuildStatistics { Line 582  sub BuildStatistics {
         $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 582  sub BuildStatistics { Line 592  sub BuildStatistics {
     if($GoToPage eq 'Activity Log') {      if($GoToPage eq 'Activity Log') {
         &Apache::lonproblemstatistics::Activity();          &Apache::lonproblemstatistics::Activity();
     } elsif($GoToPage eq 'Problem Statistics') {      } elsif($GoToPage eq 'Problem Statistics') {
         $r->print(  
         &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB,           &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB, 
                                                                   $students,                                                                     $students, 
                                                                   $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));  
     } elsif($GoToPage eq 'DoDiffGraph') {      } elsif($GoToPage eq 'DoDiffGraph') {
         &Apache::lonproblemstatistics::BuildDiffGraph($r);          &Apache::lonproblemstatistics::BuildDiffGraph($r);
     } elsif($GoToPage eq 'PercentWrongGraph') {      } elsif($GoToPage eq 'PercentWrongGraph') {
         &Apache::lonproblemstatistics::BuildWrongGraph($r);          &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");

Removed from v.1.35  
changed lines
  Added in v.1.39


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