本文整理汇总了PHP中question_attempt::rewrite_pluginfile_urls方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt::rewrite_pluginfile_urls方法的具体用法?PHP question_attempt::rewrite_pluginfile_urls怎么用?PHP question_attempt::rewrite_pluginfile_urls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_attempt
的用法示例。
在下文中一共展示了question_attempt::rewrite_pluginfile_urls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_text
/**
* Apply {@link format_text()} to some content with appropriate settings for
* this question.
*
* @param string $text some content that needs to be output.
* @param int $format the FORMAT_... constant.
* @param question_attempt $qa the question attempt.
* @param string $component used for rewriting file area URLs.
* @param string $filearea used for rewriting file area URLs.
* @param bool $clean Whether the HTML needs to be cleaned. Generally,
* parts of the question do not need to be cleaned, and student input does.
* @return string the text formatted for output by format_text.
*/
public function format_text($text, $format, $qa, $component, $filearea, $itemid,
$clean = false) {
$formatoptions = new stdClass();
$formatoptions->noclean = !$clean;
$formatoptions->para = false;
$text = $qa->rewrite_pluginfile_urls($text, $component, $filearea, $itemid);
return format_text($text, $format, $formatoptions);
}
示例2: prt_feedback_display
/**
* Actually generate the display of the PRT feedback.
* @param string $name the PRT name.
* @param question_attempt $qa the question attempt to display.
* @param question_definition $question the question being displayed.
* @param stack_potentialresponse_tree_state $result the results to display.
* @param question_display_options $options controls what should and should not be displayed.
* @return string nicely formatted feedback, for display.
*/
protected function prt_feedback_display($name, question_attempt $qa, question_definition $question, stack_potentialresponse_tree_state $result, question_display_options $options, $includestandardfeedback)
{
$err = '';
if ($result->errors) {
$err = $result->errors;
}
$feedback = '';
$feedbackbits = $result->get_feedback();
if ($feedbackbits) {
$feedback = array();
$format = null;
foreach ($feedbackbits as $bit) {
$feedback[] = $qa->rewrite_pluginfile_urls($bit->feedback, 'qtype_stack', $bit->filearea, $bit->itemid);
if (!is_null($bit->format)) {
if (is_null($format)) {
$format = $bit->format;
}
if ($bit->format != $format) {
throw new coding_exception('Inconsistent feedback formats found in PRT ' . $name);
}
}
}
if (is_null($format)) {
$format = FORMAT_HTML;
}
$feedback = $result->substitue_variables_in_feedback(implode(' ', $feedback));
$feedback = format_text(stack_maths::process_display_castext($feedback, $this), $format, array('noclean' => true, 'para' => false));
}
$gradingdetails = '';
if (!$result->errors && $qa->get_behaviour_name() == 'adaptivemultipart') {
// This is rather a hack, but it will probably work.
$renderer = $this->page->get_renderer('qbehaviour_adaptivemultipart');
$gradingdetails = $renderer->render_adaptive_marks($qa->get_behaviour()->get_part_mark_details($name), $options);
}
if ($includestandardfeedback) {
$standardfeedback = $this->standard_prt_feedback($qa, $question, $result);
} else {
$standardfeedback = '';
}
return html_writer::nonempty_tag('div', $standardfeedback . $err . $feedback . $gradingdetails, array('class' => 'stackprtfeedback stackprtfeedback-' . $name));
}