本文整理汇总了PHP中question_attempt::get_behaviour_field_name方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt::get_behaviour_field_name方法的具体用法?PHP question_attempt::get_behaviour_field_name怎么用?PHP question_attempt::get_behaviour_field_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_attempt
的用法示例。
在下文中一共展示了question_attempt::get_behaviour_field_name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controls
public function controls(question_attempt $qa, question_display_options $options)
{
if ($options->readonly || $qa->get_state() != question_state::$todo) {
return '';
}
// Hidden input to move the question into the complete state.
return html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $qa->get_behaviour_field_name('seen'), 'value' => 1));
}
示例2: feedback
public function feedback(question_attempt $qa, question_display_options $options)
{
if (!$qa->get_state()->is_active() || !$options->readonly) {
return '';
}
$attributes = array('type' => 'submit', 'id' => $qa->get_behaviour_field_name('tryagain'), 'name' => $qa->get_behaviour_field_name('tryagain'), 'value' => get_string('tryagain', 'qbehaviour_interactive'), 'class' => 'submit btn');
if ($options->readonly !== qbehaviour_interactive::READONLY_EXCEPT_TRY_AGAIN) {
$attributes['disabled'] = 'disabled';
}
$output = html_writer::empty_tag('input', $attributes);
if (empty($attributes['disabled'])) {
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button', array($attributes['id'], $qa->get_slot()));
}
return $output;
}
示例3: precheck_button
/**
* Construct the HTML for the optional 'precheck' button, which triggers
* a partial submit in which no penalties are imposed but only the
* 'Use as example' test cases are run.
* This code is identical to the 'submit_button' code in
* qbehaviour_renderer::submit_button except for the id and name of the
* button.
*/
protected function precheck_button(question_attempt $qa, question_display_options $options)
{
if (!$qa->get_state()->is_active()) {
return '';
// Not sure if this can happen, but the submit button does it.
}
$attributes = array('type' => 'submit', 'id' => $qa->get_behaviour_field_name('precheck'), 'name' => $qa->get_behaviour_field_name('precheck'), 'value' => get_string('precheck', 'qbehaviour_adaptive_adapted_for_coderunner'), 'class' => 'submit btn');
if ($options->readonly) {
$attributes['disabled'] = 'disabled';
}
$output = html_writer::empty_tag('input', $attributes);
if (!$options->readonly) {
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button', array($attributes['id'], $qa->get_slot()));
}
return $output;
}
示例4: controls
public function controls(question_attempt $qa, question_display_options $options)
{
$a = new stdClass();
$a->help = $this->output->help_icon('certainty', 'qbehaviour_deferredcbm');
$a->choices = $this->certainty_choices($qa->get_behaviour_field_name('certainty'), $qa->get_last_behaviour_var('certainty'), $options->readonly);
return html_writer::tag('div', get_string('howcertainareyou', 'qbehaviour_deferredcbm', $a), array('class' => 'certaintychoices'));
}
示例5: submit_button
/**
* Several behaviours need a submit button, so put the common code here.
* The button is disabled if the question is displayed read-only.
* @param question_display_options $options controls what should and should not be displayed.
* @return string HTML fragment.
*/
protected function submit_button(question_attempt $qa, question_display_options $options)
{
$attributes = array('type' => 'submit', 'id' => $qa->get_behaviour_field_name('submit'), 'name' => $qa->get_behaviour_field_name('submit'), 'value' => get_string('check', 'question'), 'class' => 'submit btn');
if ($options->readonly) {
$attributes['disabled'] = 'disabled';
}
$output = html_writer::empty_tag('input', $attributes);
if (!$options->readonly) {
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button', array($attributes['id'], $qa->get_slot()));
}
return $output;
}
示例6: controls
public function controls(question_attempt $qa, question_display_options $options)
{
return html_writer::tag('div', get_string('howcertainareyou', 'qbehaviour_deferredcbm', $this->certainly_choices($qa->get_behaviour_field_name('certainty'), $qa->get_last_behaviour_var('certainty'), $options->readonly)), array('class' => 'certaintychoices'));
}
示例7: render_hint_button
/**
* Renders hint button. Could be used by behaviour or question renderer to avoid code duplication while rendering it.
* @param hintobj object an object of a child of qtype_specific_hint class
*/
public function render_hint_button(question_attempt $qa, question_display_options $options, $hintobj)
{
$question = $qa->get_question();
$hintkey = $hintobj->hint_key();
// Render button.
$attributes = array('type' => 'submit', 'id' => $qa->get_behaviour_field_name($hintkey . 'btn'), 'name' => $qa->get_behaviour_field_name($hintkey . 'btn'), 'value' => get_string('hintbtn', 'qbehaviour_adaptivehints', $hintobj->hint_description()), 'class' => 'submit btn');
if ($options->readonly) {
$attributes['disabled'] = 'disabled';
}
$output = html_writer::empty_tag('input', $attributes);
// Cost message.
if ($hintobj->penalty_response_based()) {
// If penalty is response-based.
// Try to get last response.
$response = $qa->get_last_qt_data();
if (empty($response)) {
$response = null;
}
$penalty = $hintobj->penalty_for_specific_hint($response);
if ($penalty != 0) {
$output .= $this->button_cost('withpenaltyapprox', $penalty, $options);
// Note that reported penalty is approximation since user could change response in adaptive.
}
} else {
$penalty = $hintobj->penalty_for_specific_hint(null);
if ($penalty != 0) {
$output .= $this->button_cost('withpenalty', $penalty, $options);
}
}
if (!$options->readonly) {
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button', array($attributes['id'], $qa->get_slot()));
}
return $output;
}