From 340b0eef6b698c3024f8302ac06f46c2e077031b Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Sat, 15 Jul 2023 22:00:17 +0200 Subject: [PATCH] Reworked timeline grid (stage 1) --- amd/src/studyplan-editor-components.js | 262 +++++++++++++------------ classes/studyitem.php | 5 +- classes/studyplanservice.php | 4 +- version.php | 2 +- 4 files changed, 147 insertions(+), 126 deletions(-) diff --git a/amd/src/studyplan-editor-components.js b/amd/src/studyplan-editor-components.js index f0015ac..b1e6c14 100644 --- a/amd/src/studyplan-editor-components.js +++ b/amd/src/studyplan-editor-components.js @@ -1,5 +1,7 @@ /*eslint no-var: "error"*/ /*eslint no-console: "off"*/ +/*eslint no-unused-vars: warn */ +/*eslint max-len: ["error", { "code": 160 }] */ /*eslint-disable no-trailing-spaces */ /*eslint-env es6*/ // Put this file in path/to/plugin/amd/src @@ -1131,6 +1133,26 @@ export default { } }, methods: { + countLineLayers(line){ + let maxLayer = -1; + for(let i = 0; i <= this.value.slots; i++){ + const slot = line.slots[i]; + // Determine the amount of used layers in a studyline slit + for(const ix in line.slots[i].competencies){ + const item = line.slots[i].competencies[ix]; + if(item.layer > maxLayer){ + maxLayer = item.layer; + } + } + for(const ix in line.slots[i].filters){ + const item = line.slots[i].filters[ix]; + if(item.layer > maxLayer){ + maxLayer = item.layer; + } + } + } + return maxLayer+1; + }, slotsempty(slots) { if(Array.isArray(slots)){ let count = 0; @@ -1353,32 +1375,36 @@ export default {