本文整理匯總了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));
}