Skip to content
Snippets Groups Projects
Commit e02dce23 authored by Tim Hunt's avatar Tim Hunt
Browse files

Fix problems with Moodle 3.5 #378

parent d4985b98
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,10 @@ require_once(__DIR__ . '/stack/bulktester.class.php'); ...@@ -42,7 +42,10 @@ require_once(__DIR__ . '/stack/bulktester.class.php');
$questionid = required_param('questionid', PARAM_INT); $questionid = required_param('questionid', PARAM_INT);
// Load the necessary data. // Load the necessary data.
$questiondata = $DB->get_record('question', array('id' => $questionid), '*', MUST_EXIST); $questiondata = question_bank::load_question_data($questionid);
if (!$questiondata) {
print_error('questiondoesnotexist', 'question');
}
$question = question_bank::load_question($questionid); $question = question_bank::load_question($questionid);
// Process any other URL parameters, and do require_login. // Process any other URL parameters, and do require_login.
......
...@@ -30,11 +30,15 @@ require_once(__DIR__ . '/../edit_stack_form.php'); ...@@ -30,11 +30,15 @@ require_once(__DIR__ . '/../edit_stack_form.php');
*/ */
class qtype_stack_edit_form_testable extends qtype_stack_edit_form { class qtype_stack_edit_form_testable extends qtype_stack_edit_form {
public function __construct($questiontext, $specificfeedback) { public function __construct($questiontext, $specificfeedback) {
global $USER;
$syscontext = context_system::instance(); $syscontext = context_system::instance();
$category = question_make_default_categories(array($syscontext)); $category = question_make_default_categories(array($syscontext));
$fakequestion = new stdClass(); $fakequestion = new stdClass();
$fakequestion->qtype = 'stack'; $fakequestion->qtype = 'stack';
$fakequestion->category = $category->id; $fakequestion->category = $category->id;
$fakequestion->contextid = $syscontext->id;
$fakequestion->createdby = $USER->id;
$fakequestion->modifiedby = $USER->id;
$fakequestion->questiontext = $questiontext; $fakequestion->questiontext = $questiontext;
$fakequestion->options = new stdClass(); $fakequestion->options = new stdClass();
$fakequestion->options->specificfeedback = $specificfeedback; $fakequestion->options->specificfeedback = $specificfeedback;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment