本文整理汇总了PHP中question_attempt::get_reverse_step_iterator方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt::get_reverse_step_iterator方法的具体用法?PHP question_attempt::get_reverse_step_iterator怎么用?PHP question_attempt::get_reverse_step_iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_attempt
的用法示例。
在下文中一共展示了question_attempt::get_reverse_step_iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_graded_step
protected function get_graded_step(question_attempt $qa) {
foreach ($qa->get_reverse_step_iterator() as $step) {
if ($step->has_behaviour_var('_try')) {
return $step;
}
}
}
示例2: specific_feedback
public function specific_feedback(question_attempt $qa)
{
$question = $qa->get_question();
$currentanswer = remove_blanks($qa->get_last_qt_var('answer'));
$ispreview = false;
$completemessage = '';
$closestcomplete = false;
foreach ($qa->get_reverse_step_iterator() as $step) {
$hintadded = $step->has_behaviour_var('_helps') === true;
break;
}
$closest = $question->closest;
if ($hintadded) {
// hint added one letter or hint added letter and answer is complete
$answer = $question->get_matching_answer(array('answer' => $closest[0]));
// help has added letter OR word and answer is complete
$isstateimprovable = $qa->get_behaviour()->is_state_improvable($qa->get_state());
if ($closest[2] == 'complete' && $isstateimprovable) {
$closestcomplete = true;
$class = '"correctness correct"';
$completemessage = '<div class=' . $class . '>' . get_string("clicktosubmit", "qtype_regexp") . '</div>';
}
} else {
$answer = $question->get_matching_answer(array('answer' => $qa->get_last_qt_var('answer')));
}
if ($closest[3]) {
$closest[3] = '[' . $closest[3] . ']';
// rest of submitted answer, in red
}
$f = '';
// student's response with corrections to be displayed in feedback div
$f = '<span style="color:#0000FF;">' . $closest[1] . '<strong>' . $closest[4] . '</strong></span> ' . $closest[3];
// color blue for correct words/letters
if ($answer && $answer->feedback || $closestcomplete == true) {
return $question->format_text($f . $answer->feedback . $completemessage, $answer->feedbackformat, $qa, 'question', 'answerfeedback', $answer->id);
} else {
return $f;
}
}