本文整理汇总了PHP中question_attempt_step::get_behaviour_var方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt_step::get_behaviour_var方法的具体用法?PHP question_attempt_step::get_behaviour_var怎么用?PHP question_attempt_step::get_behaviour_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_attempt_step
的用法示例。
在下文中一共展示了question_attempt_step::get_behaviour_var方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_set_var
public function test_set_var() {
$step = new question_attempt_step();
$step->set_qt_var('_x', 1);
$step->set_behaviour_var('_x', 2);
$this->assertEquals('1', $step->get_qt_var('_x'));
$this->assertEquals('2', $step->get_behaviour_var('_x'));
}
示例2: is_same_comment
/**
* Checks whether two manual grading actions are the same. That is, whether
* the comment, and the mark (if given) is the same.
*
* @param question_attempt_step $pendingstep contains the new responses.
* @return bool whether the new response is the same as we already have.
*/
protected function is_same_comment($pendingstep) {
$previouscomment = $this->qa->get_last_behaviour_var('comment');
$newcomment = $pendingstep->get_behaviour_var('comment');
if (is_null($previouscomment) && !html_is_blank($newcomment) ||
$previouscomment != $newcomment) {
return false;
}
// So, now we know the comment is the same, so check the mark, if present.
$previousfraction = $this->qa->get_fraction();
$newmark = $pendingstep->get_behaviour_var('mark');
if (is_null($previousfraction)) {
return is_null($newmark) || $newmark === '';
} else if (is_null($newmark) || $newmark === '') {
return false;
}
$newfraction = $newmark / $pendingstep->get_behaviour_var('maxmark');
return abs($newfraction - $previousfraction) < 0.0000001;
}
示例3: apply_attempt_state
public function apply_attempt_state(question_attempt_step $step)
{
if ($step->has_behaviour_var('_applypenalties')) {
$this->applypenalties = (bool) $step->get_behaviour_var('_applypenalties');
}
parent::apply_attempt_state($step);
}
示例4: do_grading
protected function do_grading(question_attempt_step $responsesstep,
question_attempt_pending_step $pendingstep) {
if (!$this->question->is_gradable_response($responsesstep->get_qt_data())) {
$pendingstep->set_state(question_state::$gaveup);
} else {
$response = $responsesstep->get_qt_data();
list($fraction, $state) = $this->question->grade_response($response);
if ($responsesstep->has_behaviour_var('certainty')) {
$certainty = $responsesstep->get_behaviour_var('certainty');
} else {
$certainty = question_cbm::default_certainty();
$pendingstep->set_behaviour_var('_assumedcertainty', $certainty);
}
$pendingstep->set_behaviour_var('_rawfraction', $fraction);
$pendingstep->set_fraction(question_cbm::adjust_fraction($fraction, $certainty));
$pendingstep->set_state($state);
$pendingstep->set_new_response_summary(question_cbm::summary_with_certainty(
$this->question->summarise_response($response),
$responsesstep->get_behaviour_var('certainty')));
}
return question_attempt::KEEP;
}
示例5: adaptive_mark_details_from_step
/**
* Actually populate the qbehaviour_adaptive_mark_details object.
* @param question_attempt_step $gradedstep the step that holds the relevant mark details.
* @param question_state $state the state corresponding to $gradedstep.
* @param unknown_type $maxmark the maximum mark for this question_attempt.
* @param unknown_type $penalty the penalty for this question, as a fraction.
*/
protected function adaptive_mark_details_from_step(question_attempt_step $gradedstep,
question_state $state, $maxmark, $penalty) {
$details = new qbehaviour_adaptive_mark_details($state);
$details->maxmark = $maxmark;
$details->actualmark = $gradedstep->get_fraction() * $details->maxmark;
$details->rawmark = $gradedstep->get_behaviour_var('_rawfraction') * $details->maxmark;
$details->currentpenalty = $penalty * $details->maxmark;
$details->totalpenalty = $details->currentpenalty * $this->qa->get_last_behaviour_var('_try', 0);
$details->improvable = $this->is_state_improvable($gradedstep->get_state());
return $details;
}