本文整理汇总了PHP中quiz_feedback_for_grade函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_feedback_for_grade函数的具体用法?PHP quiz_feedback_for_grade怎么用?PHP quiz_feedback_for_grade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quiz_feedback_for_grade函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_result_info
/**
* Generates data pertaining to quiz results
*
* @param array $quiz Array containing quiz data
* @param int $context The page context ID
* @param int $cm The Course Module Id
* @param mod_quiz_view_object $viewobj
*/
public function view_result_info($quiz, $context, $cm, $viewobj) {
$output = '';
if (!$viewobj->numattempts && !$viewobj->gradecolumn && is_null($viewobj->mygrade)) {
return $output;
}
$resultinfo = '';
if ($viewobj->overallstats) {
if ($viewobj->moreattempts) {
$a = new stdClass();
$a->method = quiz_get_grading_option_name($quiz->grademethod);
$a->mygrade = quiz_format_grade($quiz, $viewobj->mygrade);
$a->quizgrade = quiz_format_grade($quiz, $quiz->grade);
$resultinfo .= $this->heading(get_string('gradesofar', 'quiz', $a), 2, 'main');
} else {
$a = new stdClass();
$a->grade = quiz_format_grade($quiz, $viewobj->mygrade);
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
$a = get_string('outofshort', 'quiz', $a);
$resultinfo .= $this->heading(get_string('yourfinalgradeis', 'quiz', $a), 2,
'main');
}
}
if ($viewobj->mygradeoverridden) {
$resultinfo .= html_writer::tag('p', get_string('overriddennotice', 'grades'),
array('class' => 'overriddennotice'))."\n";
}
if ($viewobj->gradebookfeedback) {
$resultinfo .= $this->heading(get_string('comment', 'quiz'), 3, 'main');
$resultinfo .= '<p class="quizteacherfeedback">'.$viewobj->gradebookfeedback.
"</p>\n";
}
if ($viewobj->feedbackcolumn) {
$resultinfo .= $this->heading(get_string('overallfeedback', 'quiz'), 3, 'main');
$resultinfo .= html_writer::tag('p',
quiz_feedback_for_grade($viewobj->mygrade, $quiz, $context),
array('class' => 'quizgradefeedback'))."\n";
}
if ($resultinfo) {
$output .= $this->box($resultinfo, 'generalbox', 'feedback');
}
return $output;
}
示例2: quiz_get_best_grade
} else {
$data[] = '';
}
} else {
if ($showing == 'scores') {
// Grade and feedback.
$bestgrade = quiz_get_best_grade($quiz, $USER->id);
$attempts = quiz_get_user_attempts($quiz->id, $USER->id, 'all');
list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts, $context);
$grade = '';
$feedback = '';
if ($quiz->grade && !is_null($bestgrade)) {
if ($alloptions->scores) {
$grade = "{$bestgrade} / {$quiz->grade}";
}
if ($alloptions->overallfeedback) {
$feedback = quiz_feedback_for_grade($bestgrade, $quiz->id);
}
}
$data[] = $grade;
$data[] = $feedback;
}
}
$table->data[] = $data;
}
// End of loop over quiz instances.
// Display the table.
echo '<br />';
print_table($table);
// Finish the page
print_footer($course);
示例3: get_overall_feedback
/**
* Get the overall feedback corresponding to a particular mark.
* @param $grade a particular grade.
*/
public function get_overall_feedback($grade)
{
return quiz_feedback_for_grade($grade, $this->get_quiz(), $this->quizobj->get_context());
}
示例4: optional_param
// The required page
$showall = optional_param('showall', 0, PARAM_BOOL);
if (!($attempt = get_record("quiz_attempts", "id", $attempt))) {
error("No such attempt ID exists");
}
if (!($quiz = get_record("quiz", "id", $attempt->quiz))) {
error("The quiz with id {$attempt->quiz} belonging to attempt {$attempt} is missing");
}
if (!($course = get_record("course", "id", $quiz->course))) {
error("The course with id {$quiz->course} that the quiz with id {$quiz->id} belongs to is missing");
}
if (!($cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id))) {
error("The course module for the quiz with id {$quiz->id} is missing");
}
$grade = quiz_rescale_grade($attempt->sumgrades, $quiz);
$feedback = quiz_feedback_for_grade($grade, $attempt->quiz);
if (!count_records('question_sessions', 'attemptid', $attempt->uniqueid)) {
// this question has not yet been upgraded to the new model
quiz_upgrade_states($attempt);
}
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$coursecontext = get_context_instance(CONTEXT_COURSE, $cm->course);
$isteacher = has_capability('mod/quiz:preview', get_context_instance(CONTEXT_MODULE, $cm->id));
$options = quiz_get_reviewoptions($quiz, $attempt, $context);
$popup = $isteacher ? 0 : $quiz->popup;
// Controls whether this is shown in a javascript-protected window.
if (!has_capability('mod/quiz:viewreports', $context)) {
if (!$attempt->timefinish) {
redirect('attempt.php?q=' . $quiz->id);
}
示例5: quiz_format_grade
$resultinfo .= $OUTPUT->heading(get_string('gradesofar', 'quiz', $a), 2, 'main');
} else {
$a = quiz_format_grade($quiz, $mygrade) . '/' . quiz_format_grade($quiz, $quiz->grade);
$resultinfo .= $OUTPUT->heading(get_string('yourfinalgradeis', 'quiz', $a), 2, 'main');
}
}
if ($mygradeoverridden) {
$resultinfo .= '<p class="overriddennotice">' . get_string('overriddennotice', 'grades') . "</p>\n";
}
if ($gradebookfeedback) {
$resultinfo .= $OUTPUT->heading(get_string('comment', 'quiz'), 3, 'main');
$resultinfo .= '<p class="quizteacherfeedback">' . $gradebookfeedback . "</p>\n";
}
if ($feedbackcolumn) {
$resultinfo .= $OUTPUT->heading(get_string('overallfeedback', 'quiz'), 3, 'main');
$resultinfo .= '<p class="quizgradefeedback">' . quiz_feedback_for_grade($mygrade, $quiz->id) . "</p>\n";
}
if ($resultinfo) {
echo $OUTPUT->box($resultinfo, 'generalbox', 'feedback');
}
}
/// Determine if we should be showing a start/continue attempt button,
/// or a button to go back to the course page.
echo $OUTPUT->box_start('quizattempt');
$buttontext = '';
// This will be set something if as start/continue attempt button should appear.
if (!$quiz->questions) {
echo $OUTPUT->heading(get_string("noquestions", "quiz"));
} else {
if ($unfinished) {
if ($canattempt) {
示例6: view_table
//.........这里部分代码省略.........
$table->align[] = 'center';
$table->size[] = '';
}
$table->head[] = get_string('attemptstate', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
if ($viewobj->markcolumn) {
$table->head[] = get_string('marks', 'quiz') . ' / ' . quiz_format_grade($quiz, $quiz->sumgrades);
$table->align[] = 'center';
$table->size[] = '';
}
if ($viewobj->gradecolumn) {
$table->head[] = get_string('grade') . ' / ' . quiz_format_grade($quiz, $quiz->grade);
$table->align[] = 'center';
$table->size[] = '';
}
// Grade by category code start.
$catgrades = new quizaccess_gradebycategory_calculator($quiz);
// $this->lateststeps may or may not already have been loaded depending if the reoprt
// is set to show question grades.
$catgrades->load_latest_steps($viewobj->attempts);
$categorynames = $catgrades->load_cat_data();
// Output column headings for category averages
foreach ($categorynames as $catname) {
$table->head[] = $catname . ' / ' . quiz_format_grade($quiz, 100);
$table->align[] = 'center';
$table->size[] = '';
}
// Grade by category code end.
if ($viewobj->canreviewmine) {
$table->head[] = get_string('review', 'quiz');
$table->align[] = 'center';
$table->size[] = '';
}
if ($viewobj->feedbackcolumn) {
$table->head[] = get_string('feedback', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
}
// One row for each attempt.
foreach ($viewobj->attemptobjs as $attemptobj) {
$attemptoptions = $attemptobj->get_display_options(true);
$row = array();
// Add the attempt number.
if ($viewobj->attemptcolumn) {
if ($attemptobj->is_preview()) {
$row[] = get_string('preview', 'quiz');
} else {
$row[] = $attemptobj->get_attempt_number();
}
}
$row[] = $this->attempt_state($attemptobj);
if ($viewobj->markcolumn) {
if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX && $attemptobj->is_finished()) {
$row[] = quiz_format_grade($quiz, $attemptobj->get_sum_marks());
} else {
$row[] = '';
}
}
// Outside the if because we may be showing feedback but not grades.
$attemptgrade = quiz_rescale_grade($attemptobj->get_sum_marks(), $quiz, false);
if ($viewobj->gradecolumn) {
if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX && $attemptobj->is_finished()) {
// Highlight the highest grade if appropriate.
if ($viewobj->overallstats && !$attemptobj->is_preview() && $viewobj->numattempts > 1 && !is_null($viewobj->mygrade) && $attemptgrade == $viewobj->mygrade && $quiz->grademethod == QUIZ_GRADEHIGHEST) {
$table->rowclasses[$attemptobj->get_attempt_number()] = 'bestrow';
}
$row[] = quiz_format_grade($quiz, $attemptgrade);
} else {
$row[] = '';
}
}
// Grade by category code start.
// Output cell contents for category average.
foreach (array_keys($categorynames) as $catid) {
$row[] = $catgrades->grade_by_category($attemptobj->get_uniqueid(), $catid);
}
// Grade by category code end.
if ($viewobj->canreviewmine) {
$row[] = $viewobj->accessmanager->make_review_link($attemptobj->get_attempt(), $attemptoptions, $this);
}
if ($viewobj->feedbackcolumn && $attemptobj->is_finished()) {
if ($attemptoptions->overallfeedback) {
$row[] = quiz_feedback_for_grade($attemptgrade, $quiz, $context);
} else {
$row[] = '';
}
}
if ($attemptobj->is_preview()) {
$table->data['preview'] = $row;
} else {
$table->data[$attemptobj->get_attempt_number()] = $row;
}
}
// End of loop over attempts.
$output = '';
$output .= $this->view_table_heading();
$output .= html_writer::table($table);
return $output;
}
开发者ID:advancingdesign,项目名称:moodle-mod_quiz_accessrule_gradebycategory,代码行数:101,代码来源:mod_quiz_renderer.php
示例7: quiz_format_grade
$a->grade = quiz_format_grade($quiz, $mygrade);
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
$a = get_string('outofshort', 'quiz', $a);
$resultinfo .= $OUTPUT->heading(get_string('yourfinalgradeis', 'quiz', $a), 2, 'main');
}
}
if ($mygradeoverridden) {
$resultinfo .= '<p class="overriddennotice">' . get_string('overriddennotice', 'grades') . "</p>\n";
}
if ($gradebookfeedback) {
$resultinfo .= $OUTPUT->heading(get_string('comment', 'quiz'), 3, 'main');
$resultinfo .= '<p class="quizteacherfeedback">' . $gradebookfeedback . "</p>\n";
}
if ($feedbackcolumn) {
$resultinfo .= $OUTPUT->heading(get_string('overallfeedback', 'quiz'), 3, 'main');
$resultinfo .= '<p class="quizgradefeedback">' . quiz_feedback_for_grade($mygrade, $quiz, $context, $cm) . "</p>\n";
}
if ($resultinfo) {
echo $OUTPUT->box($resultinfo, 'generalbox', 'feedback');
}
}
/// Determine if we should be showing a start/continue attempt button,
/// or a button to go back to the course page.
echo $OUTPUT->box_start('quizattempt');
$buttontext = '';
// This will be set something if as start/continue attempt button should appear.
if (!quiz_clean_layout($quiz->questions, true)) {
echo $OUTPUT->heading(get_string("noquestions", "quiz"));
} else {
if ($unfinished) {
if ($canpreview) {
示例8: print_heading
print_heading(get_string("nomoreattempts", "quiz"));
}
if ($numattempts && $quiz->sumgrades && !is_null($mygrade)) {
if ($overallstats) {
if ($available && $moreattempts) {
$a = new stdClass();
$a->method = quiz_get_grading_option_name($quiz->grademethod);
$a->mygrade = $mygrade;
$a->quizgrade = $quiz->grade;
print_heading(get_string('gradesofar', 'quiz', $a));
} else {
print_heading(get_string('yourfinalgradeis', 'quiz', "{$mygrade} / {$quiz->grade}"));
}
}
if ($overallfeedback) {
echo '<p class="quizgradefeedback">' . quiz_feedback_for_grade($mygrade, $quiz->id) . '</p>';
}
}
// Print a button to start/continue an attempt, if appropriate.
if (!$quiz->questions) {
print_heading(get_string("noquestions", "quiz"));
} else {
if ($available && $moreattempts) {
echo "<br />";
echo "<div class=\"quizattempt\">";
if ($unfinished) {
if (has_capability('mod/quiz:preview', $context)) {
$buttontext = get_string('continuepreview', 'quiz');
} else {
$buttontext = get_string('continueattemptquiz', 'quiz');
}
示例9: get_overall_feedback
public function get_overall_feedback($grade)
{
return quiz_feedback_for_grade($grade, $this->quiz, $this->context, $this->cm);
}
示例10: quiz_get_user_attempts
// Grade and feedback.
$attempts = quiz_get_user_attempts($quiz->id, $USER->id, 'all');
list($someoptions, $alloptions) = quiz_get_combined_reviewoptions(
$quiz, $attempts, $context);
$grade = '';
$feedback = '';
if ($quiz->grade && array_key_exists($quiz->id, $grades)) {
if ($alloptions->marks >= question_display_options::MARK_AND_MAX) {
$a = new stdClass();
$a->grade = quiz_format_grade($quiz, $grades[$quiz->id]);
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
$grade = get_string('outofshort', 'quiz', $a);
}
if ($alloptions->overallfeedback) {
$feedback = quiz_feedback_for_grade($grades[$quiz->id], $quiz, $context);
}
}
$data[] = $grade;
if ($showfeedback) {
$data[] = $feedback;
}
}
$table->data[] = $data;
} // End of loop over quiz instances.
// Display the table.
echo html_writer::table($table);
// Finish the page
示例11: stdClass
if ($quiz->grade != $quiz->sumgrades) {
$a = new stdClass();
$a->grade = round($attempt->sumgrades, $CFG->quiz_decimalpoints);
$a->maxgrade = $quiz->sumgrades;
$rows[] = '<tr><th scope="row" class="cell">' . get_string('marks', 'quiz') . '</th><td class="cell">' . get_string('outofshort', 'quiz', $a) . '</td></tr>';
}
/// Now the scaled grade.
$a = new stdClass();
$a->grade = '<b>' . $grade . '</b>';
$a->maxgrade = $quiz->grade;
$a->percent = '<b>' . round($attempt->sumgrades / $quiz->sumgrades * 100, 0) . '</b>';
$rows[] = '<tr><th scope="row" class="cell">' . get_string('grade') . '</th><td class="cell">' . get_string('outofpercent', 'quiz', $a) . '</td></tr>';
}
}
/// Feedback if there is any, and the user is allowed to see it now.
$feedback = quiz_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $quiz, false), $attempt->quiz);
if ($options->overallfeedback && $feedback) {
$rows[] = '<tr><th scope="row" class="cell">' . get_string('feedback', 'quiz') . '</th><td class="cell">' . $feedback . '</td></tr>';
}
/// Now output the summary table, if there are any rows to be shown.
if (!empty($rows)) {
echo '<table class="generaltable generalbox quizreviewsummary"><tbody>', "\n";
echo implode("\n", $rows);
echo "\n</tbody></table>\n";
}
/// Print the navigation panel if required
$numpages = quiz_number_of_pages($attempt->layout);
if ($numpages > 1 and !$showall) {
print_paging_bar($numpages, $page, 1, 'review.php?attempt=' . $attempt->id . '&');
echo '<div class="controls"><a href="review.php?attempt=' . $attempt->id . '&showall=true">';
print_string('showall', 'quiz');
示例12: quiz_get_user_attempts
} else {
if ($showing == 'scores') {
// Grade and feedback.
$attempts = quiz_get_user_attempts($quiz->id, $USER->id, 'all');
list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts, $context);
$grade = '';
$feedback = '';
if ($quiz->grade && array_key_exists($quiz->id, $scores)) {
if ($alloptions->scores) {
$a = new stdClass();
$a->grade = quiz_format_grade($quiz, $scores[$quiz->id]);
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
$grade = get_string('outofshort', 'quiz', $a);
}
if ($alloptions->overallfeedback) {
$feedback = quiz_feedback_for_grade($scores[$quiz->id], $quiz, $context, $cm);
}
}
$data[] = $grade;
if ($showfeedback) {
$data[] = $feedback;
}
}
}
$table->data[] = $data;
}
// End of loop over quiz instances.
// Display the table.
echo '<br />';
echo html_writer::table($table);
// Finish the page