当前位置: 首页>>代码示例>>PHP>>正文


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怎么用?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;
         }
     }
 }
开发者ID:nottmoo,项目名称:moodle,代码行数:7,代码来源:renderer.php

示例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;
     }
 }
开发者ID:rezeau,项目名称:moodle-qtype_regexp,代码行数:39,代码来源:renderer.php


注:本文中的question_attempt::get_reverse_step_iterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。