From a25470ff263c0f0c975b9f093b1dee6ce2d71b63 Mon Sep 17 00:00:00 2001 From: Jean-Michel Vedrine Date: Sun, 28 Apr 2019 21:17:41 +0200 Subject: Allow several variables in combined algebra subquestions --- questiontype.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'questiontype.php') diff --git a/questiontype.php b/questiontype.php index 263408e..972b291 100644 --- a/questiontype.php +++ b/questiontype.php @@ -119,6 +119,15 @@ class qtype_algebra extends question_type { } } + /** + * Returns true is answer with the $key is empty in the question data and should not be saved in DB. + * @param object $questiondata This holds the information from the question editing form or import. + * @param int $key A key of the answer in question. + * @return bool True if answer shouldn't be saved in DB. + */ + protected function is_answer_empty($questiondata, $key) { + return trim($questiondata->answer[$key]) == ''; + } /** * Saves question-type specific options * @@ -156,7 +165,6 @@ class qtype_algebra extends question_type { $result->error = $e->getMessage(); return $result; } - // Process the allowed functions field. This code just sets up the variable, it is saved // in the parent class' save_question_options method called at the end of this method // Look for the 'all' option. If we find it then set the string to an empty value. -- cgit v1.2.3