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


PHP question_attempt::get_last_step方法代码示例

本文整理汇总了PHP中question_attempt::get_last_step方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt::get_last_step方法的具体用法?PHP question_attempt::get_last_step怎么用?PHP question_attempt::get_last_step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在question_attempt的用法示例。


在下文中一共展示了question_attempt::get_last_step方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: penalty_info

 protected function penalty_info(question_attempt $qa, $mark, question_display_options $options)
 {
     if (!$qa->get_question()->penalty && !$qa->get_last_behaviour_var('_hashint', false)) {
         // No penalty for the attempts and no hinting done.
         return '';
     }
     $output = '';
     // Print details of grade adjustment due to penalties.
     if ($mark->raw != $mark->cur) {
         $output .= ' ' . get_string('gradingdetailsadjustment', 'qbehaviour_adaptive', $mark);
     }
     // Print information about any new penalty, only relevant if the answer can be improved.
     if ($qa->get_behaviour()->is_state_improvable($qa->get_state())) {
         $output .= ' ' . get_string('gradingdetailspenalty', 'qbehaviour_adaptive', format_float($qa->get_last_step()->get_behaviour_var('_penalty'), $options->markdp));
     }
     return $output;
 }
开发者ID:saylordotorg,项目名称:moodle-qbehaviour_adaptivehints,代码行数:17,代码来源:renderer.php

示例2: correct_response

 public function correct_response(question_attempt $qa)
 {
     global $DB;
     $output = '';
     $showcorrect = false;
     $question = $qa->get_question();
     if (empty($question->correctresponse)) {
         $output .= html_writer::tag('p', get_string('noresponsedetails', 'qtype_ordering'));
     } else {
         if ($step = $qa->get_last_step()) {
             switch ($step->get_state()) {
                 case 'gradedright':
                     $showcorrect = false;
                     break;
                 case 'gradedpartial':
                     $showcorrect = true;
                     break;
                 case 'gradedwrong':
                     $showcorrect = true;
                     break;
             }
         }
     }
     if ($showcorrect) {
         $output .= html_writer::tag('p', get_string('correctorder', 'qtype_ordering'));
         $output .= html_writer::start_tag('ol');
         $correctresponse = $question->correctresponse;
         foreach ($correctresponse as $position => $answerid) {
             $answer = $question->answers[$answerid];
             $output .= html_writer::tag('li', $answer->answer);
         }
         $output .= html_writer::end_tag('ol');
     }
     return $output;
 }
开发者ID:Kathrin84,项目名称:moodle-qtype_ordering,代码行数:35,代码来源:renderer.php


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