Skip to content
Snippets Groups Projects
Commit 50075107 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Fix to issue #986.

parent 80651ebb
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ define('CLI_SCRIPT', true); ...@@ -37,6 +37,7 @@ define('CLI_SCRIPT', true);
require(__DIR__ . '/../../../../config.php'); require(__DIR__ . '/../../../../config.php');
require_once($CFG->libdir.'/clilib.php'); require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/questionlib.php');
require_once(__DIR__ . '/../vle_specific.php');
require_once(__DIR__ . '/../locallib.php'); require_once(__DIR__ . '/../locallib.php');
require_once(__DIR__ . '/../stack/utils.class.php'); require_once(__DIR__ . '/../stack/utils.class.php');
require_once(__DIR__ . '/../stack/bulktester.class.php'); require_once(__DIR__ . '/../stack/bulktester.class.php');
...@@ -119,7 +120,7 @@ foreach ($questions as $id) { ...@@ -119,7 +120,7 @@ foreach ($questions as $id) {
'category' => $questiondata->category, 'category' => $questiondata->category,
'lastchanged' => $id->id, 'lastchanged' => $id->id,
'courseid' => cat_to_course($questiondata->category)); 'courseid' => cat_to_course($questiondata->category));
if ($questiondata->hidden) { if (property_exists($questiondata, 'hidden') && $questiondata->hidden) {
$urlparams['showhidden'] = 1; $urlparams['showhidden'] = 1;
} }
...@@ -155,10 +156,7 @@ foreach ($questions as $id) { ...@@ -155,10 +156,7 @@ foreach ($questions as $id) {
} }
// Prepare the display options. // Prepare the display options.
$options = new question_display_options(); $options = question_display_options();
$options->readonly = true;
$options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;
$question->castextprocessor = new castext2_qa_processor($quba->get_question_attempt($slot)); $question->castextprocessor = new castext2_qa_processor($quba->get_question_attempt($slot));
// Create the question text, question note and worked solutions. // Create the question text, question note and worked solutions.
......
...@@ -10,16 +10,13 @@ past development history is documented on [Development history](Development_hist ...@@ -10,16 +10,13 @@ past development history is documented on [Development history](Development_hist
1. Refactor the healthcheck scripts, especially to make unicode requirements for maxima more prominent. 1. Refactor the healthcheck scripts, especially to make unicode requirements for maxima more prominent.
2. Allow users to [systematically deploy](../CAS/Systematic_deployment.md) all variants of a question in a simple manner. 2. Allow users to [systematically deploy](../CAS/Systematic_deployment.md) all variants of a question in a simple manner.
3. Tag inputs with 'aria-live' is 'assertive' for better screen reader support. 3. Tag inputs with 'aria-live' is 'assertive' for better screen reader support.
4. Confirm support for PHP 8.2, (fixes issue #986).
TODO: TODO:
1. Support for PHP 8.2. See issue #986. 1. Fix markdown problems. See issue #420.
* Deprecated: Creation of dynamic property question_display_options::$suppressruntestslink is deprecated in /var/www/html/moodle42/question/type/stack/questiontestrun.php on line 127 2. Error messages: use caserror.class more fully to use user information to target error messages.
The question_display_options class is a moodle issue. 3. Remove all "cte" code from Maxima - mostly install.
2. Fix markdown problems. See issue #420.
3. Error messages: use caserror.class more fully to use user information to target error messages.
4. Remove all "cte" code from Maxima - mostly install.
## For "inputs 2"? ## For "inputs 2"?
......
<?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/>.
/**
* Stack question display class.
* Required in PHP 8.2 to dynamically extend Moodle's class.
* This also moves a moodle dependency into the vle specific code area.
*
* @package qtype_stack
* @copyright 2023 The University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_stack_question_display_options extends question_display_options {
public $suppressruntestslink = false;
}
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
require_once(__DIR__.'/../../../config.php'); require_once(__DIR__.'/../../../config.php');
require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/questionlib.php');
require_once(__DIR__ . '/vle_specific.php');
require_once(__DIR__ . '/locallib.php'); require_once(__DIR__ . '/locallib.php');
require_once(__DIR__ . '/questiontestform.php'); require_once(__DIR__ . '/questiontestform.php');
require_once(__DIR__ . '/stack/questiontest.php'); require_once(__DIR__ . '/stack/questiontest.php');
...@@ -155,10 +156,7 @@ if ($mform->is_cancelled()) { ...@@ -155,10 +156,7 @@ if ($mform->is_cancelled()) {
} }
// Prepare the display options. // Prepare the display options.
$options = new question_display_options(); $options = question_display_options();
$options->readonly = true;
$options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;
// Display the page. // Display the page.
echo $OUTPUT->header(); echo $OUTPUT->header();
......
...@@ -36,6 +36,7 @@ define('NO_OUTPUT_BUFFERING', true); ...@@ -36,6 +36,7 @@ define('NO_OUTPUT_BUFFERING', true);
require_once(__DIR__.'/../../../config.php'); require_once(__DIR__.'/../../../config.php');
require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/questionlib.php');
require_once(__DIR__ . '/vle_specific.php');
require_once(__DIR__ . '/locallib.php'); require_once(__DIR__ . '/locallib.php');
require_once(__DIR__ . '/stack/questiontest.php'); require_once(__DIR__ . '/stack/questiontest.php');
require_once(__DIR__ . '/stack/bulktester.class.php'); require_once(__DIR__ . '/stack/bulktester.class.php');
...@@ -121,11 +122,7 @@ $slot = $quba->add_question($question, $question->defaultmark); ...@@ -121,11 +122,7 @@ $slot = $quba->add_question($question, $question->defaultmark);
$quba->start_question($slot); $quba->start_question($slot);
// Prepare the display options. // Prepare the display options.
$options = new question_display_options(); $options = question_display_options();
$options->readonly = true;
$options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;
// Start output. // Start output.
echo $OUTPUT->header(); echo $OUTPUT->header();
$renderer = $PAGE->get_renderer('qtype_stack'); $renderer = $PAGE->get_renderer('qtype_stack');
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
*/ */
require_once(__DIR__.'/../../../config.php'); require_once(__DIR__.'/../../../config.php');
require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/questionlib.php');
require_once(__DIR__ . '/locallib.php'); require_once(__DIR__ . '/locallib.php');
require_once(__DIR__ . '/tidyquestionform.php'); require_once(__DIR__ . '/tidyquestionform.php');
...@@ -78,10 +77,7 @@ $quba->process_action($slot, $response); ...@@ -78,10 +77,7 @@ $quba->process_action($slot, $response);
$question->setup_fake_feedback_and_input_validation(); $question->setup_fake_feedback_and_input_validation();
// Prepare the display options. // Prepare the display options.
$options = new question_display_options(); $options = question_display_options();
$options->readonly = true;
$options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;
// Create the form for renaming bits of the question. // Create the form for renaming bits of the question.
$form = new qtype_stack_tidy_question_form($PAGE->url, $question); $form = new qtype_stack_tidy_question_form($PAGE->url, $question);
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>. // along with Stack. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
// This file defines question_display_options which the next class extends.
require_once(__DIR__.'/../../../lib/questionlib.php');
require_once('questiondisplayoptions.php');
/** /**
* A collection of things that are a bit VLE specific and have been * A collection of things that are a bit VLE specific and have been
...@@ -194,3 +199,14 @@ function stack_get_mathjax_url(): string { ...@@ -194,3 +199,14 @@ function stack_get_mathjax_url(): string {
function stack_clear_vle_question_cache(int $questionid) { function stack_clear_vle_question_cache(int $questionid) {
question_bank::notify_question_edited($questionid); question_bank::notify_question_edited($questionid);
} }
/*
* This is needed to put links to the STACK question dashboard into the question.
*/
function question_display_options() {
$options = new qtype_stack_question_display_options();
$options->readonly = true;
$options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;
return $options;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment