Skip to content
Snippets Groups Projects
Select Git revision
  • 414b0ca55d5e31cf3ce68b95e055a78979231515
  • master default protected
  • hsh_v4.5
  • hsh_v4-4
  • hsh_v4.4
  • hsh_v4.3
  • hsh_v4.1.x
  • hsh_v4.2
  • hsh_v4.1
  • hsh_v3.11
  • hsh_3.10
  • v3.11-r2-hsh
  • v3.11-r2
  • v3.11-r1
  • v3.10-r1
  • v3.9-r1
  • v3.8-r2
  • v3.8-r1
  • v3.7-r1
19 results

backup_and_restore_workflow_test.php

Blame
  • renderer.php 23.79 KiB
    <?php
    // This file is part of Stack - http://stack.maths.ed.ac.uk/
    //
    // Stack is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // Stack is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with Stack.  If not, see <http://www.gnu.org/licenses/>.
    
    defined('MOODLE_INTERNAL') || die();
    
    /**
     * Stack question renderer class.
     *
     * @package   qtype_stack
     * @copyright 2012 The Open University
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
    require_once(__DIR__ . '/vle_specific.php');
    
    /**
     * Generates the output for Stack questions.
     *
     * @copyright 2012 The Open University
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    // @codingStandardsIgnoreStart
    // There's a matching class name in the API.
    class qtype_stack_renderer extends qtype_renderer {
    // @codingStandardsIgnoreEnd
    
        public function formulation_and_controls(question_attempt $qa, question_display_options $options) {
            /* Return type should be @var qtype_stack_question $question. */
            $question = $qa->get_question();
    
            $response = $qa->get_last_qt_data();
    
            // We need to provide a processor for the CASText2 post-processing,
            // basically for targetting pluginfiles.
            $question->castextprocessor = new castext2_qa_processor($qa);
    
            if (is_string($question->questiontextinstantiated)) {
                // The question has not been instantiated successfully, at this level it is likely
                // a failure at compilation and that means invalid teacher code.
                return $question->questiontextinstantiated;
            }
    
            $questiontext = $question->questiontextinstantiated->get_rendered($question->castextprocessor);
    
            // Replace inputs.
            $inputstovaldiate = [];
    
            // Get the list of placeholders before format_text.
            $originalinputplaceholders = array_unique(stack_utils::extract_placeholders($questiontext, 'input'));
            sort($originalinputplaceholders);
            $originalfeedbackplaceholders = array_unique(stack_utils::extract_placeholders($questiontext, 'feedback'));
            sort($originalfeedbackplaceholders);
    
            // Now format the questiontext.
            $questiontext = $question->format_text(
                    stack_maths::process_display_castext($questiontext, $this),
                    FORMAT_HTML, // All CASText2 processed content has already been formatted to HTML.