'."\n";
+=pod
- return $Ptr;
-}
+=item &previous_student()
-sub AscendOrderOptions {
- my ($cache)=@_;
+Returns a pointer to a hash containing data about the student prior
+in the list of students. Or something.
- my $order = $cache->{'Ascend'};
- my $OpSel1 = '';
- my $OpSel2 = '';
+=cut
- if($order eq 'Ascending') {
- $OpSel1 = ' selected';
+#######################################################
+#######################################################
+sub previous_student {
+ if (defined($prev_student)) {
+ return $prev_student;
} else {
- $OpSel2 = ' selected';
+ return 'No Student Selected';
}
+}
- my $Ptr = '';
- $Ptr .= '
Sorting Type:
'."\n";
- $Ptr .= '
'."\n";
+#######################################################
+#######################################################
- return $Ptr;
-}
+=pod
-sub ProblemStatisticsButtons {
- my ($cache)=@_;
+=item &next_student()
+
+Returns a pointer to a hash containing data about the next student
+to be viewed.
+
+=cut
- my $Ptr = '
Total Number of Students opened the problem.';
- $Ptr .= '
';
- $Ptr .= 'Tries:
';
- $Ptr .= '
Total Number of Tries for solving the problem.';
- $Ptr .= '
';
- $Ptr .= 'Mod:
';
- $Ptr .= '
Maximunm Number of Tries for solving the problem.';
- $Ptr .= '
';
- $Ptr .= 'Mean:
';
- $Ptr .= '
Average Number of the tries. [ Tries / #Stdnts ]';
- $Ptr .= '
';
- $Ptr .= '#YES:
';
- $Ptr .= '
Number of students solved the problem correctly.';
- $Ptr .= '
';
- $Ptr .= '#yes:
';
- $Ptr .= '
Number of students solved the problem by override.';
- $Ptr .= '
';
- $Ptr .= '%Wrng:
';
- $Ptr .= '
Percentage of students tried to solve the problem ';
- $Ptr .= 'but still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]';
- $Ptr .= '
';
-# Kashy formula
-# ' DoDiff : Degree of Difficulty of the problem. '.
-# '[ Tries/(#YES+#yes+0.1) ] '.
- #Gerd formula
- $Ptr .= 'DoDiff:
';
- $Ptr .= '
Degree of Difficulty of the problem. ';
- $Ptr .= '[ 1 - ((#YES+#yes) / Tries) ]';
- $Ptr .= '
';
- $Ptr .= 'S.D.:
';
- $Ptr .= '
Standard Deviation of the tries. ';
- $Ptr .= '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1) ';
- $Ptr .= 'where Xi denotes every student\'s tries ]';
- $Ptr .= '
';
- $Ptr .= 'Skew.:
';
- $Ptr .= '
Skewness of the students tries.';
- $Ptr .= '[(sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3)]';
- $Ptr .= '
';
- $Ptr .= 'Dis.F.:
';
- $Ptr .= '
Discrimination Factor: A Standard for evaluating the ';
- $Ptr .= 'problem according to a Criterion ';
- $Ptr .= '[Applied Criterion in %27 Upper Students - ';
- $Ptr .= 'Applied the same Criterion in %27 Lower Students] ';
- $Ptr .= '1st Criterion for Sorting the Students: ';
- $Ptr .= 'Sum of Partial Credit Awarded / Total Number of Tries ';
- $Ptr .= '2nd Criterion for Sorting the Students: ';
- $Ptr .= 'Total number of Correct Answers / Total Number of Tries';
- $Ptr .= '
';
-
- return $Ptr;
-}
-
-#---- END Problem Statistics Web Page ----------------------------------------
-
-#---- Problem Statistics Graph Web Page --------------------------------------
-
-sub GetGraphData {
- my ($whichGraph, $courseID)=@_;
- my $Col=0;
- my $graphTitle='';
- my $data='';
- my $count = 0;
- my $Max = 0;
- my $graphData='Graph data does not exist.';
- my $GraphDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
- "_$ENV{'user.domain'}_$courseID\_graph.db";
- if(-e $GraphDB) {
- if(tie(%GraphDat,'GDBM_File',"$GraphDB",&GDBM_READER,0640)) {
- if($whichGraph eq 'DiffGraph') {
- $graphTitle = 'Degree-of-Difficulty';
- $Col = 0;
- } else {
- $graphTitle = 'Wrong-Percentage';
- $Col = 1;
- }
- foreach (sort NumericSort keys %GraphDat) {
- my @Temp=split(/\:/,$GraphDat{$_});
- my $inf = $Temp[$Col];
- if($Max < $inf) {
- $Max = $inf;
- }
- $data .= $inf.',';
- $count++;
- }
- if($Max > 1) {
- $Max += (10 - $Max % 10);
- $Max = int($Max);
- } else {
- $Max = 1;
- }
- untie(%GraphDat);
- my $Course = $ENV{'course.'.$courseID.'.description'};
- $Course =~ s/\ /"_"/eg;
- $graphData = $Course.'&'.'Problems'.'&'.$graphTitle.'&'.$Max.'&';
- $graphData .= $count.'&'.$data;
- } else {
- $graphData = "Unable to tie hash to db file";
- }
- }
+#######################################################
+#######################################################
+
+=pod
+
+=item &clear_sequence_variables()
- return $graphData;
+=cut
+
+#######################################################
+#######################################################
+sub clear_sequence_variables {
+ undef($top_map);
+ undef(@Sequences);
+ undef(@Assessments);
}
-#---- END Problem Statistics Graph Web Page ----------------------------------
+#######################################################
+#######################################################
-#---- Problem Analysis Web Page ----------------------------------------------
+=pod
-sub IntervalOptions {
- my ($cache)=@_;
+=item &SetSelectedMaps($elementname)
+
+Sets the @SelectedMaps array from $ENV{'form.'.$elementname};
+
+=cut
- my $interval = 1;
- for(my $n=1; $n<=7; $n++) {
- if($cache->{'Interval'} == $n) {
- $interval = $n;
+#######################################################
+#######################################################
+sub SetSelectedMaps {
+ my $elementname = shift;
+ if (exists($ENV{'form.'.$elementname})) {
+ if (ref($ENV{'form.'.$elementname})) {
+ @SelectedMaps = @{$ENV{'form.'.$elementname}};
+ } else {
+ @SelectedMaps = ($ENV{'form.'.$elementname});
}
+ } else {
+ @SelectedMaps = ('all');
}
+}
+
+#######################################################
+#######################################################
+
+=pod
- my $Ptr = ' Select number of intervals'."\n".
- ''."\n";
-
- return $Ptr;
+ return;
}
-sub OptionResponseTable {
- my ($cache)=@_;
- my $Str = '';
- $Str .= ' Option Response Problems in this course:'."\n";
- $Str .= '
'."\n";
- $Str .= "
\#
Problem Title
";
- $Str .= '
Resource
Analysis
'."\n";
-
- my $number=1;
- foreach (split(':::',$cache->{'OptionResponses'})) {
- my ($uri,$title,$part,$problem)=split('::',$_);
- my $Temp = ''.$title.'';
- $Str .= '
';
- $Str .= '
'.$number.'
';
- $Str .= '
'.$Temp.'
';
- $Str .= '
'.$uri.'
';
- $Str .= '
'."\n";
- $number++;
- }
- $Str .= '
'."\n";
+#######################################################
+#######################################################
- return $Str;
-}
+=pod
-#---- END Problem Analysis Web Page ------------------------------------------
+=item &log_sequence($sequence,$recursive,$padding)
-#---- Student Assessment Web Page --------------------------------------------
+Write data about the sequence to a logfile. If $recursive is not
+undef the data is written recursively. $padding is used for recursive
+calls.
-sub MapOptions {
- my ($cache, $page)=@_;
- my $Ptr = '
'."\n";
+##############################################
+##############################################
- return $Ptr;
-}
+=pod
-# ------ Create different Student Report
-sub StudentReport {
- my ($cache, $name)=@_;
+=item &MapSelect($elementname,$status,$numvisible,$restriction)
- my $Str = '';
- if($cache->{$name.':error'} =~ /course/) {
- my ($username)=split(':',$name);
- $Str .= 'No course data for student ';
- $Str .= ''.$username.'. ';
- return $Str;
- }
-
- $Str .= "
\#
Set Title
";
- $Str .= '
Results
Tries
'."\n";
-
- my $codes;
- my $attempts;
- foreach my $sequence (split(':', $cache->{'orderedSequences'})) {
- if($cache->{'StudentAssessmentMap'} ne 'All Maps' &&
- $cache->{'StudentAssessmentMap'} ne $cache->{$sequence.':title'}) {
- next;
- }
-
- $Str .= '
'.$sequence.'
';
- $Str .= '
'.$cache->{$sequence.':title'}.'
';
-
- $codes = '';
- $attempts = '';
- foreach my $problemID (split(':', $cache->{$sequence.':problems'})) {
- my $problem = $cache->{$problemID.':problem'};
- my $LatestVersion = $cache->{$name.':version:'.$problem};
-
- # Output dashes for all the parts of this problem if there
- # is no version information about the current problem.
- if(!$LatestVersion) {
- foreach my $part (split(/\:/,$cache->{$sequence.':'.
- $problemID.
- ':parts'})) {
- $codes .= "-,";
- $attempts .= "0,";
- }
- next;
- }
+Returns html for a selection box allowing the user to choose one (or more)
+of the sequences in the course. The values of the sequences are the symbs.
+If the top sequence is selected, the value 'top' will result.
- my %partData=undef;
- # Initialize part data, display skips correctly
- # Skip refers to when a student made no submissions on that
- # part/problem.
- foreach my $part (split(/\:/,$cache->{$sequence.':'.
- $problemID.
- ':parts'})) {
- $partData{$part.':tries'}=0;
- $partData{$part.':code'}='-';
- }
+=over 4
- # Looping through all the versions of each part, starting with the
- # oldest version. Basically, it gets the most recent
- # set of grade data for each part.
- for(my $Version=1; $Version<=$LatestVersion; $Version++) {
- foreach my $part (split(/\:/,$cache->{$sequence.':'.
- $problemID.
- ':parts'})) {
-
- if(!defined($cache->{$name.":$Version:$problem".
- ":resource.$part.solved"})) {
- # No grade for this submission, so skip
- next;
- }
+=item $elementname The name of the HTML form element
- my $tries=0;
- my $code='U';
+=item $status 'multiple' or 'single' selection box
- $tries = $cache->{$name.":$Version:$problem".
- ":resource.$part.tries"};
- $partData{$part.':tries'}=($tries) ? $tries : 0;
-
- my $val = $cache->{$name.":$Version:$problem".
- ":resource.$part.solved"};
- if ($val eq 'correct_by_student') {$code = 'Y';}
- elsif ($val eq 'correct_by_override') {$code = 'y';}
- elsif ($val eq 'incorrect_attempted') {$code = 'N';}
- elsif ($val eq 'incorrect_by_override'){$code = 'N';}
- elsif ($val eq 'excused') {$code = 'x';}
- $partData{$part.':code'}=$code;
- }
- }
+=item $numvisible The number of options to be visible
+
+=item $restriction Code reference to subroutine which returns true or
+false. The code must expect a reference to a sequence data structure.
- # Loop through all the parts for the current problem in the
- # correct order and prepare the output
- foreach (split(/\:/,$cache->{$sequence.':'.$problemID.
- ':parts'})) {
- $codes .= $partData{$_.':code'}.',';
- $attempts .= $partData{$_.':tries'}.',';
+=back
+
+=cut
+
+##############################################
+##############################################
+sub MapSelect {
+ my ($elementname,$status,$numvisible,$restriction)=@_;
+ if ($numvisible < 1) {
+ return;
+ }
+ #
+ # Set up array of selected items
+ &SetSelectedMaps($elementname);
+ #
+ # Set up the restriction call
+ if (! defined($restriction)) {
+ $restriction = sub { 1; };
+ }
+ #
+ # Build the form element
+ my $Str = "\n";
+ $Str .= '
'."\n";
-
+ $Str .= "\n";
return $Str;
}
-#---- END Student Assessment Web Page ----------------------------------------
+##############################################
+##############################################
-#---- Menu Web Page ----------------------------------------------------------
+=pod
-sub Title {
- my ($downloadTime)=@_;
+=item &SectionSelect($elementname,$status,$numvisible)
- my $Ptr = '';
+Returns html for a selection box allowing the user to choose one (or more)
+of the sections in the course.
- $Ptr .= 'LON-CAPA Statistics'."\n";
- $Ptr .= ''."\n";
- $Ptr .= ''."\n";
- $Ptr .= ''."\n";
- $Ptr .= '