From 1f663f3e36580f3dbc92468258e9dab015e729b1 Mon Sep 17 00:00:00 2001 From: AL Rachels Date: Mon, 10 Apr 2023 11:13:27 -0500 Subject: [PATCH] Removed legacy deprecated code --- classes/event/course_exercises_viewed.php | 10 ---------- classes/event/exam_completed.php | 10 ---------- classes/event/exercise_added.php | 10 ---------- classes/event/exercise_completed.php | 10 ---------- classes/event/exercise_deleted.php | 10 ---------- classes/event/exercise_edited.php | 10 ---------- classes/event/export_viewallgrades_to_csv.php | 10 ---------- classes/event/grade_deleted.php | 10 ---------- classes/event/invalid_access_attempt.php | 10 ---------- classes/event/layout_deleted.php | 10 ---------- classes/event/layout_imported.php | 10 ---------- classes/event/lesson_completed.php | 10 ---------- classes/event/lesson_deleted.php | 10 ---------- classes/event/lesson_exported.php | 10 ---------- classes/event/lesson_imported.php | 10 ---------- classes/event/owngrades_deleted.php | 10 ---------- classes/event/viewed_all_grades.php | 10 ---------- classes/event/viewed_own_grades.php | 10 ---------- gview.php | 2 +- lang/en/mootyper.php | 2 +- mod_form.php | 4 +++- settings.php | 10 ++++++---- upgrade.txt | 5 +++++ version.php | 4 ++-- 24 files changed, 18 insertions(+), 189 deletions(-) diff --git a/classes/event/course_exercises_viewed.php b/classes/event/course_exercises_viewed.php index 35c9f3b2..4df82e90 100644 --- a/classes/event/course_exercises_viewed.php +++ b/classes/event/course_exercises_viewed.php @@ -72,14 +72,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->objectid)); } - - /** - * Return the legacy event log data. - * - * @return array|null - */ - protected function get_legacy_logdata() { - return array($this->courseid, 'mootyper', 'view mootyper', 'exercises.php?id=' . $this->objectid, - $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/exam_completed.php b/classes/event/exam_completed.php index 26ae7402..9bb7ee21 100644 --- a/classes/event/exam_completed.php +++ b/classes/event/exam_completed.php @@ -70,14 +70,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/exercise_added.php b/classes/event/exercise_added.php index 038ea5f5..a3f2a748 100644 --- a/classes/event/exercise_added.php +++ b/classes/event/exercise_added.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/exercise_completed.php b/classes/event/exercise_completed.php index 8fb78003..2f798b70 100644 --- a/classes/event/exercise_completed.php +++ b/classes/event/exercise_completed.php @@ -70,14 +70,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/exercise_deleted.php b/classes/event/exercise_deleted.php index cbe7ad5a..41b7880c 100644 --- a/classes/event/exercise_deleted.php +++ b/classes/event/exercise_deleted.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/exercise_edited.php b/classes/event/exercise_edited.php index 0e05b968..18d9079c 100644 --- a/classes/event/exercise_edited.php +++ b/classes/event/exercise_edited.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/export_viewallgrades_to_csv.php b/classes/event/export_viewallgrades_to_csv.php index db5abbf9..d28cc8dd 100644 --- a/classes/event/export_viewallgrades_to_csv.php +++ b/classes/event/export_viewallgrades_to_csv.php @@ -70,14 +70,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/gview.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('gview.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'gview', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/grade_deleted.php b/classes/event/grade_deleted.php index 4dc0698b..72c7d2aa 100644 --- a/classes/event/grade_deleted.php +++ b/classes/event/grade_deleted.php @@ -70,14 +70,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/gview.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('gview.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'gview', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/invalid_access_attempt.php b/classes/event/invalid_access_attempt.php index d9505610..aa324021 100644 --- a/classes/event/invalid_access_attempt.php +++ b/classes/event/invalid_access_attempt.php @@ -71,14 +71,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/view.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('view.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'view', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/layout_deleted.php b/classes/event/layout_deleted.php index 307fde84..c62b2888 100644 --- a/classes/event/layout_deleted.php +++ b/classes/event/layout_deleted.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/layouts.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('layouts.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'layouts', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/layout_imported.php b/classes/event/layout_imported.php index 766b1f76..2d466baf 100644 --- a/classes/event/layout_imported.php +++ b/classes/event/layout_imported.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/lesson_completed.php b/classes/event/lesson_completed.php index 0a030277..48c6e248 100644 --- a/classes/event/lesson_completed.php +++ b/classes/event/lesson_completed.php @@ -70,14 +70,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/lesson_deleted.php b/classes/event/lesson_deleted.php index 5897b17f..b252a49f 100644 --- a/classes/event/lesson_deleted.php +++ b/classes/event/lesson_deleted.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/lesson_exported.php b/classes/event/lesson_exported.php index 6c49885a..5b81a1d5 100644 --- a/classes/event/lesson_exported.php +++ b/classes/event/lesson_exported.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/lesson_imported.php b/classes/event/lesson_imported.php index 971e4f23..b3075675 100644 --- a/classes/event/lesson_imported.php +++ b/classes/event/lesson_imported.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/exercises.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('exercises.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'exercises', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/owngrades_deleted.php b/classes/event/owngrades_deleted.php index 4b7b3b5e..14ee7ff9 100644 --- a/classes/event/owngrades_deleted.php +++ b/classes/event/owngrades_deleted.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/gview.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('owngrades.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'owngrades', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/viewed_all_grades.php b/classes/event/viewed_all_grades.php index 9ab7a322..f6902fdf 100644 --- a/classes/event/viewed_all_grades.php +++ b/classes/event/viewed_all_grades.php @@ -70,14 +70,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/gview.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('gview.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'gview', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/classes/event/viewed_own_grades.php b/classes/event/viewed_own_grades.php index 395c0b52..5fd70f01 100644 --- a/classes/event/viewed_own_grades.php +++ b/classes/event/viewed_own_grades.php @@ -69,14 +69,4 @@ public function get_description() { public function get_url() { return new \moodle_url('/mod/mootyper/owngrades.php', array('id' => $this->contextinstanceid)); } - - /** - * replace add_to_log() statement. - * - * @return array of parameters to be passed to legacy add_to_log() function. - */ - protected function get_legacy_logdata() { - $url = new \moodle_url('owngrades.php', array('id' => $this->contextinstanceid)); - return array($this->courseid, 'mootyper', 'owngrades', $url->out(), $this->objectid, $this->contextinstanceid); - } } diff --git a/gview.php b/gview.php index 5679d806..a944718c 100755 --- a/gview.php +++ b/gview.php @@ -517,7 +517,7 @@ $chart = new core\chart_bar(); // Tell the api we want a bar chart. $chart->set_horizontal(true); // Calling set_horizontal() passing true as parameter will display horizontal bar charts. - $chart->set_title(get_string('charttitleallgrades', 'mootyper')); // Tell the api what we want for a the chart title. + $chart->set_title(get_string('charttitleallgrades', 'mootyper')); // Tell the api what we want for a chart title. // Temp $chart->add_series($serie1); // Pass the hits per minute data to the api. $chart->add_series($serie2); // Pass the precision data to the api. $chart->add_series($serie3); // Pass the words per minute data to the api. diff --git a/lang/en/mootyper.php b/lang/en/mootyper.php index eaa23b18..4a657af2 100755 --- a/lang/en/mootyper.php +++ b/lang/en/mootyper.php @@ -80,7 +80,7 @@ $string['defaultlayout'] = 'Default keyboard layout'; $string['defaultlayout_desc'] = 'If overwrite_defaultlayout is not activated then this layout will be used in new activitys as default but trainer can chose a different layout.'; $string['defaultlayout_filenamewithoutfiletype'] = 'Defaultlayout filename (without filetype!)'; -$string['default_defaultlayout_filenamewithoutfiletype'] = 'English(UKV5)'; +$string['default_defaultlayout_filenamewithoutfiletype'] = 'English(USV5)'; $string['defaultlayout_filenamewithoutfiletype_desc'] = 'This is the filename of the defaultlayout that should be used if overwrite_defaultlayout is activated. If file does not exist, then the normal defaultlayout will be used.'; $string['defaultprecision'] = 'Default typing precision %'; $string['defaulttextalign'] = 'Text alignment'; diff --git a/mod_form.php b/mod_form.php index 287b4758..182639bd 100755 --- a/mod_form.php +++ b/mod_form.php @@ -173,7 +173,9 @@ public function definition() { isset($mootyperconfig->defaultlayout_filenamewithoutfiletype) && keyboards::is_layout_installed("$mootyperconfig->defaultlayout_filenamewithoutfiletype")) { // We should overwrite and the layout is installed! - $mform->setDefault('layout', keyboards::get_id_of_layout_by_layoutname($mootyperconfig->defaultlayout_filenamewithoutfiletype)); + $mform->setDefault('layout', + keyboards::get_id_of_layout_by_layoutname($mootyperconfig->defaultlayout_filenamewithoutfiletype + )); } else { // We should not overwrite or the laylout is not installed so we have to use the "normal" default. $mform->setDefault('layout', $mootyperconfig->defaultlayout); diff --git a/settings.php b/settings.php index 8e45410a..762ddd24 100755 --- a/settings.php +++ b/settings.php @@ -124,14 +124,16 @@ 3, $layouts)); - // Check if the layout that might should be used by the layoutname is installed - $defaultlayoutid = keyboards::get_id_of_layout_by_layoutname(get_string('default_defaultlayout_filenamewithoutfiletype', 'mootyper')); + // Check if the layout that might should be used by the layoutname is installed. + $defaultlayoutid = keyboards::get_id_of_layout_by_layoutname( + get_string('default_defaultlayout_filenamewithoutfiletype', 'mootyper' + )); $description = get_string('defaultlayout_filenamewithoutfiletype_desc', 'mootyper'); if ($defaultlayoutid == 0) { - $description = get_string('default_defaultlayout_filenamewithoutfiletype', 'mootyper') . " does not exist. " . $description; + $description = get_string('default_defaultlayout_filenamewithoutfiletype', 'mootyper')." does not exist. ". $description; } - // Overwrite defaultlayout by layoutname + // Overwrite defaultlayout by layoutname. $settings->add(new admin_setting_configcheckbox("mod_mootyper/overwrite_defaultlayout", get_string('overwrite_defaultlayout', 'mootyper'), '', 1)); $settings->add(new admin_setting_configtext("mod_mootyper/defaultlayout_filenamewithoutfiletype", diff --git a/upgrade.txt b/upgrade.txt index 88161087..05a8d2c9 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -75,6 +75,11 @@ Moodle Versions 20230224 MooTyper_699 - Create Hindi(HIV5) KB Layout. Dropping this ticket because the Hindi alphabet is not in the Courier New font file so it is not compatible with view.php and typer.js files. +20230224 MooTyper_1013 - Need to see about selecting KB Layout based on name instead of ID. + New code provided as a merged pulled request for item #110. +20230406 MooTyper_1032 - Invalid event functions defined in \mod_mootyper\event + \course_exercises_viewed. Deleted deprecated legacy log code as need in all the new, + MooTyper v4.2.3, files. diff --git a/version.php b/version.php index 0d69f940..961201d7 100755 --- a/version.php +++ b/version.php @@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023020600; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2023041000; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2018120300; // Requires Moodle 3.6. $plugin->cron = 60; // Period for cron to check this module (secs). $plugin->component = 'mod_mootyper'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '4.2.3 (Build: 2023020600)'; +$plugin->release = '4.2.3 (Build: 2023041000)';