當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。