From 00b5753b726e24d49a8ed64b6213cec3fb4419e6 Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Mon, 27 Nov 2023 20:54:14 +0100 Subject: [PATCH] Updated block to new myreport view --- amd/src/block_mytreestudyplan.js | 49 ++----------------------------- lang/en/block_mytreestudyplan.php | 4 +-- lang/nl/block_mytreestudyplan.php | 6 ++-- templates/block.mustache | 4 +-- version.php | 4 +-- 5 files changed, 11 insertions(+), 56 deletions(-) diff --git a/amd/src/block_mytreestudyplan.js b/amd/src/block_mytreestudyplan.js index 1070f19..75a37d7 100644 --- a/amd/src/block_mytreestudyplan.js +++ b/amd/src/block_mytreestudyplan.js @@ -42,7 +42,7 @@ let strings = load_strings({ * @param {string} type Type of page to show * @param {Object} arg Arguments passed */ - export function init(type="myreport",arg) { + export function init(type="own",arg) { // Save time by only starting up the Vue app if the required block element is present const blockelement = document.getElementById('block_mytreestudyplan'); if(blockelement){ @@ -50,52 +50,7 @@ let strings = load_strings({ el: '#block_mytreestudyplan', data: { "studyplans": [], - }, - mounted() { - let call_method; - let call_args; - if(type == "teacher"){ - call_method = 'local_treestudyplan_get_teacher_studyplan'; - call_args = {}; - } - else if(type == "teaching"){ - call_method = 'local_treestudyplan_get_teaching_studyplans'; - call_args = {}; - } - else{ - call_method = 'local_treestudyplan_get_own_studyplan'; - call_args = {}; - } - call([{ - methodname: call_method, - args: call_args - }])[0].done(function(response){ - debug.info("Studyplans:",response); - const timingval = { future: 0, present: 1, past: 2, }; - response.sort((a,b) => { - const timinga = TSComponents.studyplanTiming(a); - const timingb = TSComponents.studyplanTiming(b); - - let t = timingval[timinga] - timingval[timingb]; - if(t == 0){ - // sort by start date if timing is equal - t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime(); - - if (t == 0) { - // sort by name if timing is equal - t = a.name.localeCompare(b.name); - } - } - return t; - }); - app.studyplans = ProcessStudyplans(response); - }).fail(notification.exception); - - }, - created() { - - }, - updated() { + "type" : type, }, methods: { diff --git a/lang/en/block_mytreestudyplan.php b/lang/en/block_mytreestudyplan.php index c69828a..aae78fe 100644 --- a/lang/en/block_mytreestudyplan.php +++ b/lang/en/block_mytreestudyplan.php @@ -20,8 +20,8 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['pluginname'] = 'My Treestudyplan'; -$string['mytreestudyplan'] = 'MyTreestudyplan'; +$string['pluginname'] = 'My studyplan'; +$string['mytreestudyplan'] = 'My studyplan'; $string['title'] = 'My Studyplan'; $string['mytreestudyplan:addinstance'] = 'Add my studyplan block'; diff --git a/lang/nl/block_mytreestudyplan.php b/lang/nl/block_mytreestudyplan.php index 4328e7c..c6031ef 100644 --- a/lang/nl/block_mytreestudyplan.php +++ b/lang/nl/block_mytreestudyplan.php @@ -20,8 +20,8 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['pluginname'] = 'Mijn Treestudyplan'; -$string['mytreestudyplan'] = 'MyTreestudyplan'; -$string['title'] = 'Mijn Studieplan'; +$string['pluginname'] = 'Mijn studieplan'; +$string['mytreestudyplan'] = 'My studieplan'; +$string['title'] = 'Mijn studieplan'; $string['mytreestudyplan:addinstance'] = 'Voeg mijn studieplan block toe'; diff --git a/templates/block.mustache b/templates/block.mustache index 7bcc047..712833a 100644 --- a/templates/block.mustache +++ b/templates/block.mustache @@ -41,10 +41,10 @@
{{^teachermode}} - + {{/teachermode}} {{#teachermode}} - + {{/teachermode}}
diff --git a/version.php b/version.php index e3aa938..806ec85 100644 --- a/version.php +++ b/version.php @@ -22,7 +22,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'block_mytreestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494). -$plugin->version = 2023090800; // YYYYMMDDHH (year, month, day, iteration). +$plugin->version = 2023112700; // YYYYMMDDHH (year, month, day, iteration). $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11). $plugin->release = "1.0.0"; @@ -31,5 +31,5 @@ $plugin->maturity = MATURITY_RC; $plugin->supported = [ 311, 401 ]; $plugin->dependencies = [ - 'local_treestudyplan' => 2023090700, + 'local_treestudyplan' => 2023112400, ];