当前位置: 首页>>代码示例>>PHP>>正文


PHP question_attempt::rewrite_pluginfile_urls方法代码示例

本文整理汇总了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);
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:21,代码来源:questionbase.php

示例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));
 }
开发者ID:profcab,项目名称:moodle-qtype_stack,代码行数:50,代码来源:renderer.php


注:本文中的question_attempt::rewrite_pluginfile_urls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。