Diff for /loncom/interface/statistics/lonproblemstatistics.pm between versions 1.123 and 1.126

version 1.123, 2013/10/01 17:52:03 version 1.126, 2014/02/28 19:20:17
Line 183  my @Fields = ( Line 183  my @Fields = (
              format => '%d',               format => '%d',
              sortable  => 'yes',               sortable  => 'yes',
              graphable => 'yes',               graphable => 'yes',
              long_title => 'Minumum Number of Tries',               long_title => 'Minimum Number of Tries',
              selectable => 'yes',               selectable => 'yes',
              defaultselected => 'yes',               defaultselected => 'yes',
            },             },
Line 283  my @Fields = ( Line 283  my @Fields = (
              sortable  => 'yes',               sortable  => 'yes',
              graphable => 'yes',               graphable => 'yes',
              long_title => 'Degree of Difficulty'.               long_title => 'Degree of Difficulty'.
                            ' { 1 - ((#YES+#yes) / Tries) }',                             ' ~[ 1 - ((#YES+#yes) / Tries) ~]',
              selectable => 'yes',               selectable => 'yes',
              defaultselected => 'yes',               defaultselected => 'yes',
            },             },
Line 439  my @SeqFields = ( Line 439  my @SeqFields = (
              format => '%4.2f',               format => '%4.2f',
              sortable  => 'no',               sortable  => 'no',
              graphable => 'no',               graphable => 'no',
              long_title => 'Minumum Sequence Score',               long_title => 'Minimum Sequence Score',
              selectable => 'yes',               selectable => 'yes',
              defaultselected => 'no',               defaultselected => 'no',
            },             },
Line 494  my @SeqFields = ( Line 494  my @SeqFields = (
              format => '%4.2f',               format => '%4.2f',
              sortable  => 'no',               sortable  => 'no',
              graphable => 'no',               graphable => 'no',
              long_title => 'Minumum Number of Correct Problems',               long_title => 'Minimum Number of Correct Problems',
              selectable => 'yes',               selectable => 'yes',
              defaultselected => 'no',               defaultselected => 'no',
            },             },
Line 587  sub parse_field_selection { Line 587  sub parse_field_selection {
   
 sub field_selection_input {  sub field_selection_input {
     my $Str = '<select name="fieldselections" multiple="multiple" size="5">'."\n";      my $Str = '<select name="fieldselections" multiple="multiple" size="5">'."\n";
     $Str .= '<option value="all">all</option>'."\n";      $Str .= '<option value="all">'.&mt('all').'</option>'."\n";
     foreach my $field (@Fields) {      foreach my $field (@Fields) {
         next if ($field->{'selectable'} ne 'yes');          next if ($field->{'selectable'} ne 'yes');
         $Str .= '    <option value="'.$field->{'name'}.'" ';          $Str .= '    <option value="'.$field->{'name'}.'" ';
         if ($field->{'selected'} eq 'yes') {          if ($field->{'selected'} eq 'yes') {
             $Str .= 'selected ';              $Str .= 'selected="selected" ';
         }          }
         $Str .= '>'.$field->{'title'}.'</option>'."\n";          $Str .= '>'.&mt($field->{'title'}).'</option>'."\n";
     }      }
     $Str .= "</select>\n";      $Str .= "</select>\n";
 }  }
Line 619  sub CreateInterface { Line 619  sub CreateInterface {
     &parse_field_selection();      &parse_field_selection();
     #      #
     my $Str = '';      my $Str = '';
     $Str .= '<p>';  
     $Str .= &Apache::loncommon::start_data_table();      $Str .= &Apache::loncommon::start_data_table();
     $Str .= &Apache::loncommon::start_data_table_header_row();      $Str .= &Apache::loncommon::start_data_table_header_row();
     $Str .= '<th>'.&mt('Sections').'</th>';      $Str .= '<th>'.&mt('Sections').'</th>';
Line 645  sub CreateInterface { Line 644  sub CreateInterface {
     $Str .= &field_selection_input();      $Str .= &field_selection_input();
     $Str .= '</td><td align="center" valign="top">';      $Str .= '</td><td align="center" valign="top">';
     $Str .= &plot_dropdown();      $Str .= &plot_dropdown();
     $Str .= '</td>'."\n";      $Str .= "\n";
     $Str .= '</td><td align="center" valign="top">';      $Str .= '</td><td align="center" valign="top">';
     $Str .= &Apache::lonstathelpers::limit_by_time_form();      $Str .= &Apache::lonstathelpers::limit_by_time_form();
     $Str .= '</td>'."\n";      $Str .= '</td>'."\n";
     $Str .=  &Apache::loncommon::end_data_table_row();      $Str .=  &Apache::loncommon::end_data_table_row();
     $Str .= &Apache::loncommon::end_data_table();      $Str .= &Apache::loncommon::end_data_table();
     #      #
     $Str .= '</p>';  
     $Str .= '<input type="submit" name="GenerateStatistics" value="'.      $Str .= '<input type="submit" name="GenerateStatistics" value="'.
         &mt('Generate Statistics').'" />';          &mt('Generate Statistics').'" />';
     $Str .= ('&nbsp;'x10);      $Str .= ('&nbsp;'x10);
Line 803  sub output_sequence_statistics { Line 801  sub output_sequence_statistics {
     $r->print('<h2>'.&mt('Sequence Statistics').      $r->print('<h2>'.&mt('Sequence Statistics').
       &Apache::loncommon::help_open_topic('Statistics_Sequence').        &Apache::loncommon::help_open_topic('Statistics_Sequence').
       '</h2>');        '</h2>');
     $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row());      $r->print(&Apache::loncommon::start_data_table());
     $r->print(&sequence_html_header());      $r->print(&sequence_html_header());
     $r->print(&Apache::loncommon::end_data_table_header_row());  
     foreach my $seq (@sequences) {      foreach my $seq (@sequences) {
         last if ($c->aborted);          last if ($c->aborted);
         &compute_sequence_statistics($seq);          &compute_sequence_statistics($seq);
Line 827  sub output_sequence_statistics { Line 824  sub output_sequence_statistics {
 sub output_html_by_sequence {  sub output_html_by_sequence {
     my ($r) = @_;      my ($r) = @_;
     my $c = $r->connection();      my $c = $r->connection();
     $r->print('<br>'.&html_preamble());      $r->print('<br />'.&html_preamble());
     #      #
     foreach my $seq (@sequences) {      foreach my $seq (@sequences) {
         last if ($c->aborted);          last if ($c->aborted);
Line 931  sub statistics_table_header { Line 928  sub statistics_table_header {
         next if ($options =~ /no $field->{'name'}/);          next if ($options =~ /no $field->{'name'}/);
         next if ($field->{'selected'} ne 'yes');          next if ($field->{'selected'} ne 'yes');
         $header_row .= '<th>';          $header_row .= '<th>';
           my $header_row_text = &mt($field->{'title'});
         if (exists($field->{'sortable'}) && $field->{'sortable'} eq 'yes') {          if (exists($field->{'sortable'}) && $field->{'sortable'} eq 'yes') {
             $header_row .= '<a href="javascript:'.              $header_row .=
                   '<a href="javascript:'.
                 'document.Statistics.sortby.value='."'".$field->{'name'}."'".                  'document.Statistics.sortby.value='."'".$field->{'name'}."'".
                     ';document.Statistics.submit();">';                  ';document.Statistics.submit();">'.
         }                  $header_row_text.
         $header_row .= &mt($field->{'title'});                  '</a>';
         if ($options =~ /sortable/) {          } else {
             $header_row.= '</a>';              $header_row .= $header_row_text;
         }          }
         if ($options !~ /no plots/        &&           if ($options !~ /no plots/        && 
             exists($field->{'graphable'}) &&               exists($field->{'graphable'}) && 
Line 955  sub statistics_table_header { Line 954  sub statistics_table_header {
 }  }
   
 sub sequence_html_header {  sub sequence_html_header {
     my $Str .= '<tr>';      my $Str .= &Apache::loncommon::start_data_table_header_row();
     foreach my $field (@SeqFields) {      foreach my $field (@SeqFields) {
 #        next if ($field->{'selected'} ne 'yes');  #        next if ($field->{'selected'} ne 'yes');
         $Str .= '<th bgcolor="'.$field->{'color'}.'"';          $Str .= '<th bgcolor="'.$field->{'color'}.'"';
         $Str .= '>'.$field->{'title'}.'</th>';          $Str .= '>'.&mt($field->{'title'}).'</th>';
     }      }
     $Str .= '</tr>';      $Str .= &Apache::loncommon::end_data_table_header_row();
     return $Str;      return $Str;
 }  }
   
Line 969  sub sequence_html_header { Line 968  sub sequence_html_header {
 sub sequence_html_output {  sub sequence_html_output {
     my ($seq) = @_;      my ($seq) = @_;
     my $data = $SeqStat{$seq->symb};      my $data = $SeqStat{$seq->symb};
     my $row = '<tr>';      my $row = &Apache::loncommon::start_data_table_row();
     foreach my $field (@SeqFields) {      foreach my $field (@SeqFields) {
         next if ($field->{'selected'} ne 'yes');          next if ($field->{'selected'} ne 'yes');
         $row .= '<td bgcolor="'.$field->{'color'}.'"';          $row .= '<td bgcolor="'.$field->{'color'}.'"';
Line 984  sub sequence_html_output { Line 983  sub sequence_html_output {
         }          }
         $row .= '</td>';          $row .= '</td>';
     }      }
     $row .= '</tr>'."\n";      $row .= &Apache::loncommon::end_data_table_row()."\n";
     return $row;      return $row;
 }  }
   
Line 1346  sub Excel_output { Line 1345  sub Excel_output {
     # Time restrictions      # Time restrictions
     my $time_string;      my $time_string;
     if (defined($starttime)) {      if (defined($starttime)) {
         # call localtime but not lonlocal:locallocaltime because excel probably  
         # cannot handle localized text.  Probably.  
         $time_string .= 'Data collected from '.localtime($time_string);  
         if (defined($endtime)) {          if (defined($endtime)) {
             $time_string .= ' to '.localtime($endtime);              $time_string .=  &mt('Data collected from [_1] to [_2]',
                                    &Apache::lonlocal::locallocaltime($starttime),
                                    &Apache::lonlocal::locallocaltime($endtime));
           } else {
               $time_string .=  &mt('Data collected from [_1]',
                                    &Apache::lonlocal::locallocaltime($starttime));
         }          }
         $time_string .= '.';  
     } elsif (defined($endtime)) {      } elsif (defined($endtime)) {
         # See note above about lonlocal:locallocaltime          $time_string .=  &mt('Data collected before [_1]',
         $time_string .= 'Data collected before '.localtime($endtime).'.';                               &Apache::lonlocal::locallocaltime($endtime));
     }      }
     if (defined($time_string)) {      if (defined($time_string)) {
         $excel_sheet->write($rows_output,$cols_output++,$time_string);          $excel_sheet->write($rows_output,$cols_output++,$time_string);
Line 1364  sub Excel_output { Line 1364  sub Excel_output {
     #      #
     # Put the date in there too      # Put the date in there too
     $excel_sheet->write($rows_output,$cols_output++,      $excel_sheet->write($rows_output,$cols_output++,
                         'Compiled on '.localtime(time));                          &mt('Compiled on [_1]',&Apache::lonlocal::locallocaltime(time)));
     #      #
     $rows_output++;      $rows_output++;
     $cols_output=0;      $cols_output=0;

Removed from v.1.123  
changed lines
  Added in v.1.126


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