aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt2
-rw-r--r--displayformula.php9
-rw-r--r--lib.php5
-rw-r--r--parser.php12
-rw-r--r--question.php1
-rw-r--r--questiontype.php1
-rw-r--r--version.php4
7 files changed, 26 insertions, 8 deletions
diff --git a/README.txt b/README.txt
index 932eb51..d371985 100644
--- a/README.txt
+++ b/README.txt
@@ -26,7 +26,7 @@ Updated to Moodle 2.0 by Stefan Raffeiner <stefan.raffeiner@gmail.com>
Updated to Moodle 2.1 by Jean-Michel VĂ©drine <vedrine@univ-st-etienne.fr>
This plugin is now maintained by Jean-Michel VĂ©drine. This version is upgraded to
-work with Moodle 2.5.
+work with Moodle 2.8 and ulteriors versions.
For support use the Moodle quiz forum at https://moodle.org/mod/forum/view.php?id=737
Enjoy.
diff --git a/displayformula.php b/displayformula.php
index 788304b..58723f1 100644
--- a/displayformula.php
+++ b/displayformula.php
@@ -62,8 +62,15 @@ $text = format_text($texexp, FORMAT_MOODLE, $formatoptions);
<title>Formula</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php
+
if (!empty($CFG->additionalhtmlhead) && stripos($CFG->additionalhtmlhead, 'MathJax') !== false) {
- echo $CFG->additionalhtmlhead;
+ // For website where Mathjax is enabled using additional HTML in head.
+ echo $CFG->additionalhtmlhead;
+} else {
+ // For other website directly include MathJax.
+ echo "<script type=\"text/javascript\" async
+ src=\"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML\">
+</script>";
}
?>
</head>
diff --git a/lib.php b/lib.php
index f14538d..29cb75f 100644
--- a/lib.php
+++ b/lib.php
@@ -17,9 +17,8 @@
/**
* Serve question type files
*
- * @since 2.0
- * @package qtype
- * @subpackage algebra
+ * @since Moodle 2.0
+ * @package qtype_algebra
* @copyright Dongsheng Cai <dongsheng@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/parser.php b/parser.php
index 6a81fe6..8a21bc3 100644
--- a/parser.php
+++ b/parser.php
@@ -1336,10 +1336,20 @@ class qtype_algebra_parser_bracket extends qtype_algebra_parser_term {
* @return the numerical value of the term given the provided values for the variables
*/
function evaluate($params) {
+ if($this->_sign=='-') {
+ $mult=-1;
+ } else {
+ $mult=1;
+ }
if(count($this->_arguments)!=$this->_nargs) {
return 0;
}
- return $this->_arguments[0]->evaluate($params);
+ return $mult*$this->_arguments[0]->evaluate($params);
+ }
+
+ function set_negative() {
+ // Set the sign to be a '-'
+ $this->_sign='-';
}
/**
diff --git a/question.php b/question.php
index 7d585bb..52eea54 100644
--- a/question.php
+++ b/question.php
@@ -25,6 +25,7 @@
defined('MOODLE_INTERNAL') || die();
+require_once($CFG->dirroot . '/question/type/questionbase.php');
require_once($CFG->dirroot . '/question/type/algebra/questiontype.php');
require_once($CFG->dirroot . '/question/type/algebra/parser.php');
require_once($CFG->dirroot . '/question/type/algebra/xmlrpc-utils.php');
diff --git a/questiontype.php b/questiontype.php
index d8672b9..a49698a 100644
--- a/questiontype.php
+++ b/questiontype.php
@@ -24,6 +24,7 @@
defined('MOODLE_INTERNAL') || die();
+require_once($CFG->dirroot . '/question/type/questiontypebase.php');
require_once($CFG->dirroot . '/question/type/algebra/question.php');
require_once($CFG->dirroot . '/question/type/algebra/parser.php');
require_once($CFG->dirroot . '/question/type/algebra/xmlrpc-utils.php');
diff --git a/version.php b/version.php
index 2f734d9..0b2f746 100644
--- a/version.php
+++ b/version.php
@@ -23,8 +23,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'qtype_algebra';
-$plugin->version = 2014110800;
+$plugin->version = 2016012400;
$plugin->requires = 2013050100;
-$plugin->release = '1.33 for Moodle 2.5, 2.6 and 2.7';
+$plugin->release = '1.4 for Moodle 2.8, 2.9 and 3.0';
$plugin->maturity = MATURITY_STABLE;