Skip to content
Snippets Groups Projects
Select Git revision
  • 1ae17069f334802c571aa105427e6541c7587b5e
  • 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

activeworkflows.php

Blame
  • tidyquestionform.php 6.30 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/>.
    
    /**
     * This file defines the editing form used by the tidy question script.
     *
     * @copyright 2013 the Open University
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
    
    defined('MOODLE_INTERNAL') || die();
    
    require_once($CFG->libdir . '/formslib.php');
    require_once($CFG->dirroot . '/question/type/stack/stack/graphlayout/graph.php');
    
    
    /**
     * The editing form used by the tidy question script.
     *
     * @copyright 2013 the Open University
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    class qtype_stack_tidy_question_form extends moodleform {
        protected function definition() {
    
            $mform = $this->_form;
            $question = $this->_customdata;
    
            // Inputs.
            $mform->addElement('header', 'inputsheader', stack_string('inputs'));
    
            foreach ($question->inputs as $inputname => $input) {
                $mform->addElement('text', 'inputname_' . $inputname,
                        stack_string('newnameforx', $inputname), ['size' => 20]);
                $mform->setDefault('inputname_' . $inputname, $inputname);
                $mform->setType('inputname_' . $inputname, PARAM_RAW); // Validated in the validation method.
            }
    
            // PRTs.
            $mform->addElement('header', 'prtsheader', stack_string('prts'));
    
            foreach ($question->prts as $prtname => $prt) {
                $mform->addElement('text', 'prtname_' . $prtname,
                        stack_string('newnameforx', $prtname), ['size' => 20]);
                $mform->setDefault('prtname_' . $prtname, $prtname);
                $mform->setType('prtname_' . $prtname, PARAM_RAW); // Validated in the validation method.
            }
    
            // PRT nodes.
            foreach ($question->prts as $prtname => $prt) {
                $mform->addElement('header', 'prtnodesheader' . $prtname,
                        stack_string('prtnodesheading', $prtname));
    
                $graph = $this->get_prt_graph($prt);
                $newnames = $graph->get_suggested_node_names();
                $mform->addElement('static', $prtname . 'graph', '',