Diff for /loncom/interface/lonstatistics.pm between versions 1.41 and 1.50

version 1.41, 2002/08/13 00:37:18 version 1.50, 2002/09/01 06:23:19
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::lonpercentage;
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
   
Line 82  sub ProcessFormData{ Line 83  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');
       &CheckFormElement($cache, 'StatisticsProblemSelect',
         'StatisticsProblemSelect', 'All Problems');
       &CheckFormElement($cache, 'StatisticsPartSelect',
         'StatisticsPartSelect', 'All Parts');
       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 117  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 125  sub ProcessFormData{
                       'DisplayFormat', 'Display Table Format');                        'DisplayFormat', 'Display Table Format');
     &CheckFormElement($cache, 'ProblemStatisticsAscend',      &CheckFormElement($cache, 'ProblemStatisticsAscend',
                       'ProblemStatisticsAscend', 'Ascending');                        'ProblemStatisticsAscend', 'Ascending');
     &CheckFormElement($cache, 'ProblemStatisticsMaps',   
                       'ProblemStatisticsMaps', 'All Maps');  
     &CheckFormElement($cache, 'ProblemStatisticsSort',      &CheckFormElement($cache, 'ProblemStatisticsSort',
                       'ProblemStatisticsSort', 'Homework Sets Order');                        'ProblemStatisticsSort', 'Homework Sets Order');
       &CheckFormElement($cache, 'DisplayLegend', 'DisplayLegend', 
         'Hide Legend');
       &CheckFormElement($cache, 'SortProblems', 'SortProblems', 
                         'Sort Within Sequence');
   
     # Search only form elements      # Search only form elements
     my @headingColumns=();      my @headingColumns=();
Line 316  sub PrepareData { Line 324  sub PrepareData {
         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, $r);              &Apache::loncoursedata::ProcessTopResourceMap(\%cache, $c);
         if($processTopResourceMapReturn ne 'OK') {          if($processTopResourceMapReturn ne 'OK') {
             untie(%cache);              untie(%cache);
             return $processTopResourceMapReturn;              return $processTopResourceMapReturn;
         }          }
     }   #   }
   
     if($c->aborted()) {      if($c->aborted()) {
         untie(%cache);          untie(%cache);
Line 357  sub PrepareData { Line 365  sub PrepareData {
     &SpaceColumns($students, $studentInformation, $headings, \%cache);      &SpaceColumns($students, $studentInformation, $headings, \%cache);
     $cache{'updateTime:columnWidth'}=24;      $cache{'updateTime:columnWidth'}=24;
   
     if($cache{'download'} ne 'false') {      my $download = $cache{'download'};
         my @who = ($cache{'download'});      my $downloadAll = $cache{'DownloadAll'};
       my @allStudents=();
       if($download ne 'false') {
         $cache{'download'} = 'false';          $cache{'download'} = 'false';
       } elsif($downloadAll ne 'false') {
           $cache{'DownloadAll'} = 'false';
           if($downloadAll eq 'sorted') {
               @allStudents = @$students;
           } else {
               @allStudents = split(':::', $cache{'NamesOfStudents'});
           }
       }
   
       untie(%cache);
   
       if($download ne 'false') {
           my @who = ($download);
         if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'false',           if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'false', 
                                                              $cacheDB, 'true',                                                                $cacheDB, 'true', 
                                                              'false', $courseID,                                                               'false', $courseID,
                                                              $r, $c) ne 'OK') {                                                               $r, $c) ne 'OK') {
             untie(%cache);  
             return 'Stop at download individual';              return 'Stop at download individual';
         }          }
     } elsif($cache{'DownloadAll'} ne 'false') {      } elsif($downloadAll ne 'false') {
         $cache{'DownloadAll'} = 'false';  
         my @allStudents;  
         if($cache{'DownloadAll'} eq 'sorted') {  
             @allStudents = @$students;  
         } else {  
             @allStudents = split(':::', $cache{'NamesOfStudents'});  
         }  
         if(&Apache::loncoursedata::DownloadStudentCourseData(\@allStudents,           if(&Apache::loncoursedata::DownloadStudentCourseData(\@allStudents, 
                                                              'false',                                                                'false', 
                                                              $cacheDB, 'true',                                                                $cacheDB, 'true', 
                                                              'true', $courseID,                                                               'true', $courseID,
                                                              $r, $c) ne 'OK') {                                                               $r, $c) ne 'OK') {
             untie(%cache);  
             return 'Stop at download all';              return 'Stop at download all';
         }          }
     }      }
   
     if($c->aborted()) {  
         untie(%cache);  
         return 'aborted';   
     }  
   
     untie(%cache);  
   
     return ('OK', $students);      return ('OK', $students);
 }  }
   
Line 506  sub BuildStatistics { Line 513  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',
      'percentage'         => 'Percentage Graphs',
 #                   'activitylog'        => 'Activity Log',  #                   'activitylog'        => 'Activity Log',
                    'reportSelected'     => 'Class list');                     'reportSelected'     => 'Class list');
   
Line 514  sub BuildStatistics { Line 522  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'));      $r->print(&Apache::lonhtmlcommon::Title('Course Statistics and Charts'));
   
     my ($returnValue, $students) = &PrepareData($c, $cacheDB,       my ($returnValue, $students) = &PrepareData($c, $cacheDB, 
                                                 \@studentInformation,                                                   \@studentInformation, 
Line 541  sub BuildStatistics { Line 549  sub BuildStatistics {
         }          }
   
         if(defined($cache{'OptionResponses'})) {          if(defined($cache{'OptionResponses'})) {
             $reports{'problem_analysis'} = 'Problem Analysis';              $reports{'problem_analysis'} = 'Option Response Analysis';
         }          }
   
         $r->print('<form name="Statistics" ');          $r->print('<form name="Statistics" ');
Line 561  sub BuildStatistics { Line 569  sub BuildStatistics {
                                                                   $students,                                                                     $students, 
                                                                   $courseID,                                                                     $courseID, 
                                                                   $c,$r);                                                                    $c,$r);
     } elsif($GoToPage eq 'Problem Analysis') {      } elsif($GoToPage eq 'Option Response Analysis') {
         &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB, $r);          &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB, $r);
     } elsif($GoToPage eq 'Student Assessment') {      } elsif($GoToPage eq 'Student Assessment') {
         &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,          &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,
Line 576  sub BuildStatistics { Line 584  sub BuildStatistics {
         &Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, $students,           &Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, $students, 
                                                       $courseID, $r);                                                        $courseID, $r);
     } elsif($GoToPage eq 'DoDiffGraph' || $GoToPage eq 'PercentWrongGraph') {      } elsif($GoToPage eq 'DoDiffGraph' || $GoToPage eq 'PercentWrongGraph') {
         &Apache::lonproblemstatistics::BuildGraphicChart($GoToPage,$r,$cacheDB);          my $courseDescription = $ENV{'course.'.$courseID.'.description'};
           $courseDescription =~ s/\ /"_"/eg;
           &Apache::lonproblemstatistics::BuildGraphicChart($GoToPage, $cacheDB,
                                                            $courseDescription,
                                                            $students, $courseID,
                                                            $r, $c);
     } elsif($GoToPage eq 'Class list') {      } elsif($GoToPage eq 'Class list') {
         &BuildClasslist($cacheDB, $students, \@studentInformation,          &BuildClasslist($cacheDB, $students, \@studentInformation,
                         \@headings, $r);                          \@headings, $r);
       } elsif($GoToPage eq 'Percentage Graphs') {
    &Apache::lonpercentage::BuildPercentageGraph($cacheDB, $students,
        $courseID, $c, $r);
     }      }
   
     $r->print('</form>'."\n");      $r->print('</form>'."\n");

Removed from v.1.41  
changed lines
  Added in v.1.50


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