* For some reason, the `data-trigger="hover focus"` does not work when
rendering the popover via HTML. It just defaults to click, so the
feedback popover for qtype_multianswer questions does not show on hover.
Configuring the feedback popover's trigger via JS seems to work.
Since PHP 8.2, all properties on a class must be defined as the PHP
Dynamic Property feature has been deprecated.
This commit goes one step further and switches this class to using
constructor property promotion. This language feature has been available
since PHP 8.0 and allows for simplified creation of class properties
which are initially defined in the constructor.
PHP 8.2 has deprecated setting properties on objects dynamically.
The qtype_calculatedmulti question type had two properties being
set this way($correctanswerlength and$correctanswerformat).
This patch extends the question_answer class to add the properties
when the object is instantiated.
Declare qformat_xml::answerfiles and qformat_xml::feedbackfiles instead
of dynamically declaring answerfiles and feedbackfiles for the
question_answer instance when exporting questions and answers to XML
format.
The question answers for question type plugins extending
\qtype_calculated now have the type
\qtype_calculated\qtype_calculated_answer. So the answers for test
helper functions make_calculatedmulti_question_singleresponse() and
make_calculatedmulti_question_multiresponse() should also be changed
accordingly.
The question answers for question type plugins extending
\qtype_calculated now have the type
\qtype_calculated\qtype_calculated_answer. So the answers for
make_calculatedsimple_question_sum() should be changed accordingly.
* Question type plugins that extend qtype_calculated should be made
aware of the changes about the new question_answer type
\qtype_calculated\qtype_calculated_answer.
This commit addresses compatibility issues in the qtype_multianswer
question type. The following changes were made:
- The usage of the undeclared property $maxmark on subquestions in
qtype_multianswer was identified as problematic. To resolve this,
the existing declared property $defaultmark is now being used for
the same purpose.
By switching to the declared property $defaultmark, compatibility with
PHP 8.2 is ensured and the issue with the undeclared property is
resolved.
This commit addresses compatibility issues in the qtype_calculated
question type. The following problems were identified and resolved:
- qtype_calculated was reusing the qtype_numerical_answer class and
setting two additional properties ($correctanswerlength and
$correctanswerformat) that were not declared. To resolve this, a new
class, qtype_calculated_answer, was defined and utilised.
- During grading in qtype_numerical, there were references to an
undeclared property ($unitisright) used to track calculation details.
This issue was fixed using a 'replace temp with query' refactoring.
These changes ensure the qtype_calculated question type is compatible
with PHP 8.2 and addresses the identified issues.