Select Git revision
activeworkflows.php
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', '',