aboutsummaryrefslogtreecommitdiff
path: root/questiontype.php
diff options
context:
space:
mode:
authorJean-Michel Vedrine <vedrine@vedrine.org>2019-04-28 21:17:41 +0200
committerJean-Michel Vedrine <vedrine@vedrine.org>2019-04-28 21:17:41 +0200
commita25470ff263c0f0c975b9f093b1dee6ce2d71b63 (patch)
tree9cd2ede656d92804635e31ab779e5be34d999836 /questiontype.php
parent35e6e62481c00d21698537a91215bfa8f5364363 (diff)
Allow several variables in combined algebra subquestions
Diffstat (limited to 'questiontype.php')
-rw-r--r--questiontype.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/questiontype.php b/questiontype.php
index 263408e..972b291 100644
--- a/questiontype.php
+++ b/questiontype.php
@@ -120,6 +120,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
*
* This is called by {@link save_question()} to save the question-type specific data from a
@@ -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.