本文整理汇总了PHP中question_engine_data_mapper::load_average_marks方法的典型用法代码示例。如果您正苦于以下问题:PHP question_engine_data_mapper::load_average_marks方法的具体用法?PHP question_engine_data_mapper::load_average_marks怎么用?PHP question_engine_data_mapper::load_average_marks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_engine_data_mapper
的用法示例。
在下文中一共展示了question_engine_data_mapper::load_average_marks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dotest_load_average_marks
protected function dotest_load_average_marks() {
$averages = $this->dm->load_average_marks($this->bothusages);
$this->assertEquals(array(
$this->allslots[0] => (object) array(
'slot' => $this->allslots[0],
'averagefraction' => 0.5,
'numaveraged' => 2,
),
$this->allslots[1] => (object) array(
'slot' => $this->allslots[1],
'averagefraction' => 0,
'numaveraged' => 1,
),
), $averages);
}
示例2: add_average_row
/**
* Add an average grade over the attempts of a set of users.
* @param string $label the title ot use for this row.
* @param array $users the users to average over.
*/
protected function add_average_row($label, $users)
{
global $DB;
list($fields, $from, $where, $params) = $this->base_sql($users);
$record = $DB->get_record_sql("\n SELECT AVG(quiza.sumgrades) AS grade, COUNT(quiza.sumgrades) AS numaveraged\n FROM {$from}\n WHERE {$where}", $params);
$record->grade = quiz_rescale_grade($record->grade, $this->quiz, false);
if ($this->is_downloading()) {
$namekey = 'lastname';
} else {
$namekey = 'fullname';
}
$averagerow = array($namekey => $label, 'sumgrades' => $this->format_average($record), 'feedbacktext' => strip_tags(quiz_report_feedback_for_grade($record->grade, $this->quiz->id, $this->context)));
if ($this->options->slotmarks) {
$dm = new question_engine_data_mapper();
$qubaids = new qubaid_join($from, 'quiza.uniqueid', $where, $params);
$avggradebyq = $dm->load_average_marks($qubaids, array_keys($this->questions));
$averagerow += $this->format_average_grade_for_questions($avggradebyq);
}
$this->add_data_keyed($averagerow);
}
示例3: load_average_question_grades
/**
* Load the average grade for each question, averaged over particular users.
* @param array $userids the user ids to average over.
*/
protected function load_average_question_grades($userids) {
global $DB;
$qmfilter = '';
if ($this->quiz->attempts != 1) {
$qmfilter = '(' . quiz_report_qm_filter_select($this->quiz, 'quiza') . ') AND ';
}
list($usql, $params) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED, 'u');
$params['quizid'] = $this->quiz->id;
$qubaids = new qubaid_join(
'{quiz_attempts} quiza',
'quiza.uniqueid',
"quiza.userid $usql AND quiza.quiz = :quizid",
$params);
$dm = new question_engine_data_mapper();
return $dm->load_average_marks($qubaids, array_keys($this->questions));
}