本文整理汇总了PHP中quiz_report_feedback_for_grade函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_report_feedback_for_grade函数的具体用法?PHP quiz_report_feedback_for_grade怎么用?PHP quiz_report_feedback_for_grade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quiz_report_feedback_for_grade函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: build_table
public function build_table()
{
global $DB;
if ($this->rawdata) {
$this->strtimeformat = str_replace(',', '', get_string('strftimedatetime'));
parent::build_table();
//end of adding data from attempts data to table / download
//now add averages at bottom of table :
$params = array($this->quiz->id);
$averagesql = '
SELECT AVG(qg.grade) AS grade, COUNT(qg.grade) AS numaveraged
FROM {quiz_grades} qg
WHERE quiz = ?';
$this->add_separator();
if ($this->is_downloading()) {
$namekey = 'lastname';
} else {
$namekey = 'fullname';
}
if ($this->groupstudents) {
list($usql, $uparams) = $DB->get_in_or_equal($this->groupstudents);
$record = $DB->get_record_sql($averagesql . ' AND qg.userid ' . $usql, array_merge($params, $uparams));
$groupaveragerow = array($namekey => get_string('groupavg', 'grades'), 'sumgrades' => $this->format_average($record), 'feedbacktext' => strip_tags(quiz_report_feedback_for_grade($record->grade, $this->quiz->id, $this->context)));
if ($this->detailedmarks && ($this->quiz->attempts == 1 || $this->qmsubselect)) {
$avggradebyq = $this->load_average_question_grades($this->groupstudents);
$groupaveragerow += $this->format_average_grade_for_questions($avggradebyq);
}
$this->add_data_keyed($groupaveragerow);
}
if ($this->students) {
list($usql, $uparams) = $DB->get_in_or_equal($this->students);
$record = $DB->get_record_sql($averagesql . ' AND qg.userid ' . $usql, array_merge($params, $uparams));
$overallaveragerow = array($namekey => get_string('overallaverage', 'grades'), 'sumgrades' => $this->format_average($record), 'feedbacktext' => strip_tags(quiz_report_feedback_for_grade($record->grade, $this->quiz->id, $this->context)));
if ($this->detailedmarks && ($this->quiz->attempts == 1 || $this->qmsubselect)) {
$avggradebyq = $this->load_average_question_grades($this->students);
$overallaveragerow += $this->format_average_grade_for_questions($avggradebyq);
}
$this->add_data_keyed($overallaveragerow);
}
}
}
示例3: col_feedbacktext
function col_feedbacktext($attempt)
{
if ($attempt->timefinish) {
if (!$this->is_downloading()) {
return quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz, false), $this->quiz->id);
} else {
return strip_tags(quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz, false), $this->quiz->id));
}
} else {
return '-';
}
}
示例4: display
//.........这里部分代码省略.........
$row[] = $gradehtml;
} else {
$row[] = $grade;
}
} else {
$row[] = '-';
}
}
if ($detailedmarks) {
if (empty($attempt->attempt)) {
foreach ($questions as $question) {
$row[] = '-';
}
} else {
foreach ($questions as $questionid => $question) {
$stateforqinattempt = $gradedstatesbyattempt[$attempt->attemptuniqueid][$questionid];
if (question_state_is_graded($stateforqinattempt)) {
$grade = quiz_rescale_grade($stateforqinattempt->grade, $quiz);
} else {
$grade = '--';
}
if (!$download) {
$grade = $grade . '/' . quiz_rescale_grade($question->grade, $quiz);
$row[] = link_to_popup_window('/mod/quiz/reviewquestion.php?state=' . $stateforqinattempt->id . '&number=' . $question->number, 'reviewquestion', $grade, 450, 650, $strreviewquestion, 'none', true);
} else {
$row[] = $grade;
}
}
}
}
// Feedback column.
if ($hasfeedback) {
if ($attempt->timefinish) {
$row[] = quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $quiz), $quiz->id);
} else {
$row[] = '-';
}
}
if (!$download) {
$table->add_data($row);
} else {
if ($download == 'Excel' or $download == 'ODS') {
$colnum = 0;
foreach ($row as $item) {
$myxls->write($rownum, $colnum, $item, $format);
$colnum++;
}
$rownum++;
} else {
if ($download == 'CSV') {
$text = implode("\t", $row);
echo $text . " \n";
}
}
}
}
//end of adding data from attempts data to table / download
//now add averages :
if (!$download && $attempts) {
$averagesql = "SELECT AVG(qg.grade) AS grade " . "FROM {$CFG->prefix}quiz_grades qg " . "WHERE quiz=" . $quiz->id;
$table->add_separator();
if ($groupstudentslist) {
$groupaveragesql = $averagesql . " AND qg.userid IN ({$groupstudentslist})";
$groupaverage = get_record_sql($groupaveragesql);
$groupaveragerow = array('fullname' => get_string('groupavg', 'grades'), 'sumgrades' => round($groupaverage->grade, $quiz->decimalpoints), 'feedbacktext' => quiz_report_feedback_for_grade($groupaverage->grade, $quiz->id));
if ($detailedmarks && $qmsubselect) {
示例5: col_feedbacktext
/**
* Generate the display of the feedback column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_feedbacktext($attempt) {
if ($attempt->state != quiz_attempt::FINISHED) {
return '-';
}
$feedback = quiz_report_feedback_for_grade(
quiz_rescale_grade($attempt->sumgrades, $this->quiz, false),
$this->quiz->id, $this->context);
if ($this->is_downloading()) {
$feedback = strip_tags($feedback);
}
return $feedback;
}