本文整理汇总了PHP中question_attempt::get_full_step_iterator方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt::get_full_step_iterator方法的具体用法?PHP question_attempt::get_full_step_iterator怎么用?PHP question_attempt::get_full_step_iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_attempt
的用法示例。
在下文中一共展示了question_attempt::get_full_step_iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response_history
/**
* Generate the display of the response history part of the question. This
* is the table showing all the steps the question has been through.
*
* @param question_attempt $qa the question attempt to display.
* @param qbehaviour_renderer $behaviouroutput the renderer to output the behaviour
* specific parts.
* @param qtype_renderer $qtoutput the renderer to output the question type
* specific parts.
* @param question_display_options $options controls what should and should not be displayed.
* @return HTML fragment.
*/
protected function response_history(question_attempt $qa, qbehaviour_renderer $behaviouroutput, qtype_renderer $qtoutput, question_display_options $options)
{
if (!$options->history) {
return '';
}
$table = new html_table();
$table->head = array(get_string('step', 'question'), get_string('time'), get_string('action', 'question'), get_string('state', 'question'));
if ($options->marks >= question_display_options::MARK_AND_MAX) {
$table->head[] = get_string('marks', 'question');
}
foreach ($qa->get_full_step_iterator() as $i => $step) {
$stepno = $i + 1;
$rowclass = '';
if ($stepno == $qa->get_num_steps()) {
$rowclass = 'current';
} else {
if (!empty($options->questionreviewlink)) {
$url = new moodle_url($options->questionreviewlink, array('slot' => $qa->get_slot(), 'step' => $i));
$stepno = $this->output->action_link($url, $stepno, new popup_action('click', $url, 'reviewquestion', array('width' => 450, 'height' => 650)), array('title' => get_string('reviewresponse', 'question')));
}
}
$restrictedqa = new question_attempt_with_restricted_history($qa, $i, null);
$user = new stdClass();
$user->id = $step->get_user_id();
$row = array($stepno, userdate($step->get_timecreated(), get_string('strftimedatetimeshort')), s($qa->summarise_action($step)), $restrictedqa->get_state_string($options->correctness));
if ($options->marks >= question_display_options::MARK_AND_MAX) {
$row[] = $qa->format_fraction_as_mark($step->get_fraction(), $options->markdp);
}
$table->rowclasses[] = $rowclass;
$table->data[] = $row;
}
return html_writer::tag('h4', get_string('responsehistory', 'question'), array('class' => 'responsehistoryheader')) . $options->extrahistorycontent . html_writer::tag('div', html_writer::table($table, true), array('class' => 'responsehistoryheader'));
}
示例2: question_attempt_history
/**
* This is a copy of the history function in the question renderer class
* Since the access to that function is protected I cannot access it outside of the renderer class.
*
* There are a few changes to this function to facilitate simpler use
*
* @param \question_attempt $qa
* @return string
*/
public function question_attempt_history($qa)
{
$table = new \html_table();
$table->head = array(get_string('step', 'question'), get_string('time'), get_string('action', 'question'));
foreach ($qa->get_full_step_iterator() as $i => $step) {
$stepno = $i + 1;
$rowclass = '';
if ($stepno == $qa->get_num_steps()) {
$rowclass = 'current';
}
$user = new \stdClass();
$user->id = $step->get_user_id();
$row = array($stepno, userdate($step->get_timecreated(), get_string('strftimedatetimeshort')), s($qa->summarise_action($step)));
$table->rowclasses[] = $rowclass;
$table->data[] = $row;
}
return \html_writer::tag('h4', get_string('responsehistory', 'question'), array('class' => 'responsehistoryheader')) . \html_writer::tag('div', \html_writer::table($table, true), array('class' => 'responsehistoryheader'));
}