--- loncom/interface/statistics/lonstathelpers.pm 2004/02/19 20:17:01 1.4 +++ loncom/interface/statistics/lonstathelpers.pm 2004/03/03 22:57:31 1.5 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstathelpers.pm,v 1.4 2004/02/19 20:17:01 matthew Exp $ +# $Id: lonstathelpers.pm,v 1.5 2004/03/03 22:57:31 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -145,7 +145,7 @@ sub ProblemSelector { $resptype.''. ''.$title.' '; # ''.$resptype.' '.$res->{'title'}.' '; - if ($partdata->{'option'} > 1) { + if (scalar(@{$partdata->{'ResponseIds'}}) > 1) { $seq_str .= &mt('response').' '.$respid; } $seq_str .= "\n"; @@ -654,6 +654,82 @@ sub get_problem_data { } #################################################### +#################################################### + +=pod + +=item &limit_by_time() + +=cut + +#################################################### +#################################################### +sub limit_by_time_form { + my $Starttime_form = ''; + my $starttime = &Apache::lonhtmlcommon::get_date_from_form + ('limitby_startdate'); + my $endtime = &Apache::lonhtmlcommon::get_date_from_form + ('limitby_enddate'); + if (! defined($endtime)) { + $endtime = time; + } + if (! defined($starttime)) { + $starttime = $endtime - 60*60*24*7; + } + my $state; + if (&limit_by_time()) { + $state = ''; + } else { + $state = 'disabled'; + } + my $startdateform = &Apache::lonhtmlcommon::date_setter + ('Statistics','limitby_startdate',$starttime,undef,undef,$state); + my $enddateform = &Apache::lonhtmlcommon::date_setter + ('Statistics','limitby_enddate',$endtime,undef,undef,$state); + my $Str; + $Str .= ''; + $Str .= '
'; + my $timecheckbox = ''; + $Str .= &mt('Start Time: [_1]',$startdateform).'
'; + $Str .= &mt(' End Time: [_1]',$enddateform).'
'; + $Str .= '
'; + return $Str; +} + +sub limit_by_time { + if (exists($ENV{'form.limit_by_time'}) && + $ENV{'form.limit_by_time'} ne '' ) { + return 1; + } else { + return 0; + } +} + +sub get_time_limits { + my $starttime = &Apache::lonhtmlcommon::get_date_from_form + ('limitby_startdate'); + my $endtime = &Apache::lonhtmlcommon::get_date_from_form + ('limitby_enddate'); + return ($starttime,$endtime); +} + +#################################################### #################################################### =pod