diff --git a/lang/en/qtype_wq.php b/lang/en/qtype_wq.php index 96c5d2c5..7bc2de2e 100644 --- a/lang/en/qtype_wq.php +++ b/lang/en/qtype_wq.php @@ -105,3 +105,6 @@ $string['privacy:metadata:qtype_wq:xml'] = 'Wiris Quizzes Question XML'; $string['auxiliar_text'] = 'Write an optional reasoning for your answer:'; + +$string['log_server_errors'] = 'Log server errors'; +$string['log_server_errors_help'] = 'Extensively log errors coming from the WirisQuizzes service to your server logs. This might cause an increase in the size of your log files but might help the Wiris team troubleshoot issues.'; diff --git a/question.php b/question.php index 9db662d1..05ece334 100644 --- a/question.php +++ b/question.php @@ -357,6 +357,7 @@ public function call_wiris_service($request) { $service = $builder->getQuizzesService(); $isdebugmodeenabled = get_config('qtype_wq', 'debug_mode_enabled') == '1'; + $islogmodeenabled = get_config('qtype_wq', 'log_server_errors') == '1'; if ($isdebugmodeenabled) { // @codingStandardsIgnoreLine @@ -382,6 +383,10 @@ public function call_wiris_service($request) { print_object($e); } + if ($islogmodeenabled) { + error_log('WIRISQUIZZES SERVER ERROR --- REQUEST: --- ' . $request->serialize()); + } + throw new moodle_exception('wirisquestionincorrect', 'qtype_wq', $link, $a, ''); } @@ -391,4 +396,16 @@ public function call_wiris_service($request) { } return $response; } + + + public function update_attempt_state_data_for_new_version( + question_attempt_step $oldstep, + question_definition $otherversion + ) { + return $this->base->update_attempt_state_data_for_new_version($oldstep, $otherversion->base); + } + + public function validate_can_regrade_with_other_version(question_definition $otherversion): ?string { + return $this->base->validate_can_regrade_with_other_version($otherversion->base); + } } diff --git a/renderer.php b/renderer.php index ecba267c..942c29f9 100644 --- a/renderer.php +++ b/renderer.php @@ -203,6 +203,6 @@ protected function prepare_response( 'auxiliar_text', $step ); - return format_text($text, $step->get_qt_var($name), $formatoptions); + return format_text($text, FORMAT_MOODLE, $formatoptions); } } diff --git a/settings.php b/settings.php index 8883b2f9..2050e989 100644 --- a/settings.php +++ b/settings.php @@ -37,63 +37,92 @@ } } -$settings->add(new admin_setting_heading('qtype_wq/connectionsettings', - get_string('connectionsettings', 'qtype_wq'), - get_string('connectionsettings_text', 'qtype_wq'))); - -$settings->add(new admin_setting_configtext('qtype_wq/quizzesserviceurl', - get_string('quizzesserviceurl', 'qtype_wq'), - get_string('quizzesserviceurl_help', 'qtype_wq'), - 'http://www.wiris.net/demo/quizzes', - PARAM_URL)); - -$settings->add(new admin_setting_configtext('qtype_wq/quizzeseditorurl', - get_string('quizzeseditorurl', 'qtype_wq'), - get_string('quizzeseditorurl_help', 'qtype_wq'), - 'http://www.wiris.net/demo/editor', - PARAM_URL)); - -$settings->add(new admin_setting_configtext('qtype_wq/quizzeshandurl', - get_string('quizzeshandurl', 'qtype_wq'), - get_string('quizzeshandurl_help', 'qtype_wq'), - 'http://www.wiris.net/demo/hand', - PARAM_URL)); - -$settings->add(new admin_setting_configtext('qtype_wq/quizzeswirislauncherurl', - get_string('quizzeswirislauncherurl', 'qtype_wq'), - get_string('quizzeswirislauncherurl_help', 'qtype_wq'), - 'http://stateful.wiris.net/demo/wiris', - PARAM_URL)); - -$settings->add(new admin_setting_configtext('qtype_wq/quizzeswirisurl', - get_string('quizzeswirisurl', 'qtype_wq'), - get_string('quizzeswirisurl_help', 'qtype_wq'), - 'http://www.wiris.net/demo/wiris', - PARAM_URL)); +$settings->add(new admin_setting_heading( + 'qtype_wq/connectionsettings', + get_string('connectionsettings', 'qtype_wq'), + get_string('connectionsettings_text', 'qtype_wq') +)); + +$settings->add(new admin_setting_configtext( + 'qtype_wq/quizzesserviceurl', + get_string('quizzesserviceurl', 'qtype_wq'), + get_string('quizzesserviceurl_help', 'qtype_wq'), + 'http://www.wiris.net/demo/quizzes', + PARAM_URL +)); + +$settings->add(new admin_setting_configtext( + 'qtype_wq/quizzeseditorurl', + get_string('quizzeseditorurl', 'qtype_wq'), + get_string('quizzeseditorurl_help', 'qtype_wq'), + 'http://www.wiris.net/demo/editor', + PARAM_URL +)); + +$settings->add(new admin_setting_configtext( + 'qtype_wq/quizzeshandurl', + get_string('quizzeshandurl', 'qtype_wq'), + get_string('quizzeshandurl_help', 'qtype_wq'), + 'http://www.wiris.net/demo/hand', + PARAM_URL +)); + +$settings->add(new admin_setting_configtext( + 'qtype_wq/quizzeswirislauncherurl', + get_string('quizzeswirislauncherurl', 'qtype_wq'), + get_string('quizzeswirislauncherurl_help', 'qtype_wq'), + 'http://stateful.wiris.net/demo/wiris', + PARAM_URL +)); + +$settings->add(new admin_setting_configtext( + 'qtype_wq/quizzeswirisurl', + get_string('quizzeswirisurl', 'qtype_wq'), + get_string('quizzeswirisurl_help', 'qtype_wq'), + 'http://www.wiris.net/demo/wiris', + PARAM_URL +)); // Access provider option. If enabled only loged users can access to Wiris Quizzes services. -$settings->add(new admin_setting_configcheckbox('qtype_wq/access_provider_enabled', - get_string('access_provider_enabled', 'qtype_wq'), - get_string('access_provider_enabled_help', 'qtype_wq'), - '0')); - -$settings->add(new admin_setting_heading('qtype_wq/compatibility_settings', - get_string('compatibility_settings', 'qtype_wq'), - get_string('compatibility_settings_text', 'qtype_wq'))); - -$settings->add(new admin_setting_configcheckbox('qtype_wq/filtercodes_compatibility', - get_string('filtercodes_compatibility_enabled', 'qtype_wq'), - get_string('filtercodes_compatibility_enabled_help', 'qtype_wq'), - '0')); - -$settings->add(new admin_setting_heading('qtype_wq/troubleshooting_settings', - get_string('troubleshooting_settings', 'qtype_wq'), - get_string('troubleshooting_settings_text', 'qtype_wq'))); - -$settings->add(new admin_setting_configcheckbox('qtype_wq/debug_mode_enabled', - get_string('debug_mode_enabled', 'qtype_wq'), - get_string('debug_mode_enabled_help', 'qtype_wq'), - '0')); +$settings->add(new admin_setting_configcheckbox( + 'qtype_wq/access_provider_enabled', + get_string('access_provider_enabled', 'qtype_wq'), + get_string('access_provider_enabled_help', 'qtype_wq'), + '0' +)); + +$settings->add(new admin_setting_heading( + 'qtype_wq/compatibility_settings', + get_string('compatibility_settings', 'qtype_wq'), + get_string('compatibility_settings_text', 'qtype_wq') +)); + +$settings->add(new admin_setting_configcheckbox( + 'qtype_wq/filtercodes_compatibility', + get_string('filtercodes_compatibility_enabled', 'qtype_wq'), + get_string('filtercodes_compatibility_enabled_help', 'qtype_wq'), + '0' +)); + +$settings->add(new admin_setting_heading( + 'qtype_wq/troubleshooting_settings', + get_string('troubleshooting_settings', 'qtype_wq'), + get_string('troubleshooting_settings_text', 'qtype_wq') +)); + +$settings->add(new admin_setting_configcheckbox( + 'qtype_wq/debug_mode_enabled', + get_string('debug_mode_enabled', 'qtype_wq'), + get_string('debug_mode_enabled_help', 'qtype_wq'), + '0' +)); + +$settings->add(new admin_setting_configcheckbox( + 'qtype_wq/log_server_errors', + get_string('log_server_errors', 'qtype_wq'), + get_string('log_server_errors_help', 'qtype_wq'), + '0' +)); if ($CFG->version >= 2012120300 && $CFG->version < 2013051400) { diff --git a/step.php b/step.php index 818fa383..37067460 100644 --- a/step.php +++ b/step.php @@ -217,7 +217,7 @@ public function get_var($name, $subquesbool = true) { } private function get_step_var_internal($name, $subquesbool) { - if ($subquesbool && strlen($this->extraprefix) > 0) { + if ($subquesbool && isset($this->extraprefix) && strlen($this->extraprefix) > 0) { // The prefix is needed when it is a subquestion of a cloze // (multianswer) question type. if (substr($name, 0, 2) === '!_') { diff --git a/version.php b/version.php index fc69a1c5..09c624ad 100644 --- a/version.php +++ b/version.php @@ -16,9 +16,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024032203; +$plugin->version = 2024032204; $plugin->requires = 2015111600; // Moodle 3.0. -$plugin->release = '4.11.3'; +$plugin->release = '4.11.4'; $plugin->maturity = MATURITY_STABLE; $plugin->component = 'qtype_wq'; $plugin->dependencies = array(