本文整理匯總了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));
}