version 1.122.2.2, 2013/12/30 14:05:21
|
version 1.125, 2014/02/03 18:52:30
|
Line 52 package Apache::lonproblemstatistics;
|
Line 52 package Apache::lonproblemstatistics;
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon(); |
use Apache::loncommon(); |
|
use Apache::lonquickgrades(); |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonstatistics; |
use Apache::lonstatistics; |
Line 586 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 618 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 644 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 .= (' 'x10); |
$Str .= (' 'x10); |
Line 706 sub BuildProblemStatisticsPage {
|
Line 705 sub BuildProblemStatisticsPage {
|
# Finally let the user know we are here |
# Finally let the user know we are here |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Overall Problem Statistics', |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Overall Problem Statistics', |
'Statistics_Overall_Key')); |
'Statistics_Overall_Key')); |
|
&Apache::lonquickgrades::startGradeScreen($r,'statistics'); |
|
|
my $interface = &CreateInterface($r); |
my $interface = &CreateInterface($r); |
$r->print($interface); |
$r->print($interface); |
Line 801 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 825 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 929 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 953 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 967 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 982 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 1344 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 1362 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; |