本文整理匯總了PHP中question_attempt::get_last_behaviour_var方法的典型用法代碼示例。如果您正苦於以下問題:PHP question_attempt::get_last_behaviour_var方法的具體用法?PHP question_attempt::get_last_behaviour_var怎麽用?PHP question_attempt::get_last_behaviour_var使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類question_attempt
的用法示例。
在下文中一共展示了question_attempt::get_last_behaviour_var方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: feedback
public function feedback(question_attempt $qa, question_display_options $options) {
if (!$options->feedback) {
return '';
}
if ($qa->get_state() == question_state::$gaveup || $qa->get_state() ==
question_state::$mangaveup) {
return '';
}
$feedback = '';
if (!$qa->get_last_behaviour_var('certainty') &&
$qa->get_last_behaviour_var('_assumedcertainty')) {
$feedback .= html_writer::tag('p',
get_string('assumingcertainty', 'qbehaviour_deferredcbm',
question_cbm::get_string($qa->get_last_behaviour_var('_assumedcertainty'))));
}
if ($options->marks >= question_display_options::MARK_AND_MAX) {
$a = new stdClass();
$a->rawmark = format_float($qa->get_last_behaviour_var('_rawfraction') *
$qa->get_max_mark(), $options->markdp);
$a->mark = $qa->format_mark($options->markdp);
$feedback .= html_writer::tag('p',
get_string('markadjustment', 'qbehaviour_deferredcbm', $a));
}
return $feedback;
}
示例2: feedback
public function feedback(question_attempt $qa, question_display_options $options)
{
if (!$options->feedback) {
return '';
}
if ($qa->get_state() == question_state::$gaveup || $qa->get_state() == question_state::$mangaveup) {
return '';
}
$feedback = '';
if (!$qa->get_last_behaviour_var('certainty') && $qa->get_last_behaviour_var('_assumedcertainty')) {
$feedback .= html_writer::tag('p', get_string('assumingcertainty', 'qbehaviour_deferredcbm', question_cbm::get_string($qa->get_last_behaviour_var('_assumedcertainty'))));
}
return $feedback;
}
示例3: feedback
public function feedback(question_attempt $qa, question_display_options $options)
{
if ($qa->get_last_behaviour_var('_precheck', 0)) {
return '';
} else {
return parent::feedback($qa, $options);
}
}
示例4: penalty_info
/**
* Display the information about the penalty calculations.
* @param question_attempt $qa the question attempt.
* @param object $mark contains information about the current mark.
* @param question_display_options $options display options.
*/
protected function penalty_info(question_attempt $qa, $mark, question_display_options $options)
{
$currentpenalty = $qa->get_question()->penalty * $qa->get_max_mark();
$totalpenalty = $currentpenalty * $qa->get_last_behaviour_var('_try', 0);
if ($currentpenalty == 0) {
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($currentpenalty, $options->markdp));
// Print information about total penalties so far, if larger than current penalty.
if ($totalpenalty > $currentpenalty) {
$output .= ' ' . get_string('gradingdetailspenaltytotal', 'qbehaviour_adaptive', format_float($totalpenalty, $options->markdp));
}
}
return $output;
}
示例5: 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;
}