/** * The intended question weight. Maximum mark for the question as a percentage * of maximum mark for the offlinequiz. That is, the indended influence this question * on the student's overall mark. * @param object $question containst the data to display. * @return string contents of this table cell. */ protected function col_intended_weight($question) { return offlinequiz_report_scale_summarks_as_percentage($question->_stats->maxmark, $this->offlinequiz); }
/** * The intended question weight. Maximum mark for the question as a percentage * of maximum mark for the offlinequiz. That is, the indended influence this question * on the student's overall mark. * @param object $question containst the data to display. * @return string contents of this table cell. */ protected function col_intended_weight($question) { if (!property_exists($question, '_stats')) { return ''; } return offlinequiz_report_scale_summarks_as_percentage($question->_stats->maxmark, $this->offlinequiz); }
protected function get_formatted_offlinequiz_info_data($course, $cm, $offlinequiz, $offlinequizstats) { // You can edit this array to control which statistics are displayed. $todisplay = array('allattemptscount' => 'number', 'maxgrade' => 'number_format', 'bestgrade' => 'scale_to_maxgrade', 'worstgrade' => 'scale_to_maxgrade', 'allattemptsavg' => 'scale_to_maxgrade', 'median' => 'scale_to_maxgrade', 'standarddeviation' => 'scale_to_maxgrade', 'skewness' => 'number_format', 'kurtosis' => 'number_format', 'cic' => 'percent_to_number_format', 'errorratio' => 'number_format_percent', 'standarderror' => 'scale_to_maxgrade'); if ($offlinequiz->sumgrades > 0) { $offlinequizstats->sumgrades = $offlinequiz->sumgrades; } else { if ($offlinequiz->sumgrades == -1) { $offlinequizstats->sumgrades = ''; $offlinequizstats->bestgrade = ''; $offlinequizstats->worstgrade = ''; $offlinequizstats->allattemptsavg = ''; $offlinequizstats->median = ''; $offlinequizstats->standarddeviation = ''; } } $offlinequizstats->maxgrade = $offlinequiz->grade; // General information about the offlinequiz. $offlinequizinfo = array(); $offlinequizinfo[get_string('offlinequizname', 'offlinequiz_statistics')] = format_string($offlinequiz->name); if ($cm->idnumber) { $offlinequizinfo[get_string('idnumbermod')] = $cm->idnumber; } if ($offlinequiz->timeopen) { $offlinequizinfo[get_string('reviewopens', 'offlinequiz')] = userdate($offlinequiz->timeopen); } if ($offlinequiz->timeclose) { $offlinequizinfo[get_string('reviewcloses', 'offlinequiz')] = userdate($offlinequiz->timeclose); } if ($offlinequiz->timeopen && $offlinequiz->timeclose) { $offlinequizinfo[get_string('duration', 'offlinequiz_statistics')] = format_time($offlinequiz->timeclose - $offlinequiz->timeopen); } // The statistics. foreach ($todisplay as $property => $format) { if (!isset($offlinequizstats->{$property}) || empty($format)) { continue; } $value = $offlinequizstats->{$property}; switch ($format) { case 'summarks_as_percentage': $formattedvalue = offlinequiz_report_scale_summarks_as_percentage($value, $offlinequiz); break; case 'scale_to_maxgrade': $formattedvalue = offlinequiz_report_scale_grade($value, $offlinequiz); break; case 'number_format_percent': $formattedvalue = offlinequiz_format_grade($offlinequiz, $value) . '%'; break; case 'number_format': // 2 extra decimal places, since not a percentage, // and we want the same number of sig figs.??? $formattedvalue = format_float($value, $offlinequiz->decimalpoints); break; case 'percent_to_number_format': $formattedvalue = format_float($value / 100.0, $offlinequiz->decimalpoints); break; case 'number': $formattedvalue = $value + 0; break; default: $formattedvalue = $value; } $offlinequizinfo[get_string($property, 'offlinequiz_statistics', $this->using_attempts_string(!empty($offlinequizstats->allattempts)))] = $formattedvalue; } return $offlinequizinfo; }