diff --git a/CHANGES.md b/CHANGES.md index 134db48..f684a42 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ ## Changelog ## +- [2.0.8]: + - Activity completion for views now possible. + - Small last bugfixes. + +- [2.0.7]: + - Fixed typo in view event. + - [2.0.6]: - Small bugfixes and fixes for moodle coding style. diff --git a/exportresultstextfile.php b/exportresultstextfile.php index c09695e..7f6d62b 100644 --- a/exportresultstextfile.php +++ b/exportresultstextfile.php @@ -85,9 +85,9 @@ if (!isset($moduleinstance->misc)) { $mode = 'normal'; } else { - $misc = json_decode($moduleinstance->misc); + $misc = (array) json_decode($moduleinstance->misc); - if (isset($misc->mode) && $misc->mode === 'export_grades') { + if (isset($misc['mode']) && $misc['mode'] === 'export_grades') { $mode = 'export_grades'; } else { $mode = 'normal'; diff --git a/mod_form.php b/mod_form.php index 2727165..ba7cecd 100644 --- a/mod_form.php +++ b/mod_form.php @@ -49,7 +49,7 @@ public function definition() { $oldpw = $moduleinstance->password; if (isset($moduleinstance->misc)) { - $misc = json_decode($moduleinstance->misc); + $misc = (array) json_decode($moduleinstance->misc); } else { $misc = null; } @@ -114,7 +114,7 @@ public function definition() { $mform->addElement('advcheckbox', 'exportgrades', get_string('activate_mode', 'mod_exammanagement')); $mform->addHelpButton('exportgrades', 'export_grades_as_exam_results', 'mod_exammanagement'); - if (isset($misc) && isset($misc->mode) && $misc->mode === 'export_grades') { + if (isset($misc) && isset($misc['mode']) && $misc['mode'] === 'export_grades') { $mform->setDefault('exportgrades', 1); } else { $mform->setDefault('exportgrades', 0); @@ -123,7 +123,7 @@ public function definition() { $mform->addElement('header', 'deselectstepsandphases', get_string('deselectstepsandphases', 'mod_exammanagement')); $mform->addElement('advcheckbox', 'deselectphaseexamreview', get_string('deselectphaseexamreview', 'mod_exammanagement')); - if (isset($misc) && isset($misc->configoptions) && in_array('noexamreview', $misc->configoptions)) { + if (isset($misc) && isset($misc['configoptions']) && in_array('noexamreview', $misc['configoptions'])) { $mform->setDefault('deselectphaseexamreview', 1); } else { $mform->setDefault('deselectphaseexamreview', 0); diff --git a/version.php b/version.php index 889aa0a..d1053e7 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_exammanagement'; // Full name of the plugin (used for diagnostics). -$plugin->release = '2.0.6'; // User-friendly version number. -$plugin->version = 2024022701; // The current module version (Date: YYYYMMDDXX). +$plugin->release = '2.0.8'; // User-friendly version number. +$plugin->version = 2024022800; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2020061500; // Requires this Moodle version. $plugin->maturity = MATURITY_STABLE; diff --git a/view.php b/view.php index c6f4001..d1aff1c 100644 --- a/view.php +++ b/view.php @@ -123,7 +123,7 @@ } else { $misc = (array) json_decode($moduleinstance->misc); - if (isset($misc->mode) && $misc->mode === 'export_grades') { + if (isset($misc['mode']) && $misc['mode'] === 'export_grades') { $mode = 'export_grades'; } else { $mode = 'normal'; @@ -502,7 +502,7 @@ } // Textfield. - $textfield = helper::gettextfield($moduleinstance)->text; + $textfield = helper::gettextfield($moduleinstance)->text ?? false; // Bonussteps. if ($moduleinstance->bonusvisible && $participant) { @@ -592,6 +592,9 @@ $PAGE->force_settings_menu(); } +$completion = new completion_info($course); +$completion->set_module_viewed($cm); + // Output header. echo $OUTPUT->header(); @@ -604,7 +607,7 @@ } // Trigger course_module_viewed event. -$event = \mod_annopy\event\course_module_viewed::create([ +$event = \mod_exammanagement\event\course_module_viewed::create([ 'objectid' => $moduleinstance->id, 'context' => $context, ]);