@@ -819,7 +829,7 @@ export default {
{{text['coursetiming_'+value.course.timing]}}
- {{ value.course.startdate }} - {{ value.course.enddate }}
+ {{ startdate }} - {{ enddate }}
@@ -1152,6 +1162,17 @@ export default {
}
return status;
+ },
+ startdate(){
+ return format_date(this.value.course.startdate);
+ },
+ enddate(){
+ if(this.value.course.enddate){
+ return format_date(this.value.course.enddate);
+ }
+ else {
+ return this.text.noenddate;
+ }
}
},
created(){
@@ -1234,7 +1255,7 @@ export default {
@@ -1279,7 +1300,7 @@ export default {
{{ text['coursetiming_'+value.course.timing] }}
- {{ value.course.startdate }} - {{ value.course.enddate }}
+ {{ startdate }} - {{ enddate }}
diff --git a/amd/src/studyplan-editor-components.js b/amd/src/studyplan-editor-components.js
index 8bde064..403e0b4 100644
--- a/amd/src/studyplan-editor-components.js
+++ b/amd/src/studyplan-editor-components.js
@@ -10,13 +10,14 @@ import {SimpleLine} from "./simpleline";
import {call} from 'core/ajax';
import notification from 'core/notification';
import {get_strings} from 'core/str';
-import {load_stringkeys, load_strings} from './string-helper';
+import {load_stringkeys, load_strings, format_date} from './string-helper';
import {objCopy,transportItem} from './studyplan-processor';
import Debugger from './debugger';
import {download,upload} from './downloader';
const STUDYPLAN_EDITOR_FIELDS = ['name','shortname','description','context_id',
'slots','startdate','enddate','aggregation','aggregation_config'];
+const PERIOD_EDITOR_FIELDS = ['fullname','shortname','startdate','enddate'];
export default {
STUDYPLAN_EDITOR_FIELDS: STUDYPLAN_EDITOR_FIELDS, // make copy available in plugin
@@ -140,6 +141,13 @@ export default {
setting_bistate_accept_pending_submitted: 'setting_bistate_accept_pending_submitted',
settingdesc_bistate_accept_pending_submitted: 'settingdesc_bistate_accept_pending_submitted',
},
+ period_edit: {
+ edit: 'period_edit',
+ fullname: 'studyplan_name',
+ shortname: 'studyplan_shortname',
+ startdate: 'studyplan_startdate',
+ enddate: 'studyplan_enddate',
+ },
studyplan_associate: {
associations: 'associations',
associated_cohorts: 'associated_cohorts',
@@ -1044,6 +1052,120 @@ export default {
`
});
+ /*******************
+ *
+ * Period editor
+ *
+ *************/
+
+ Vue.component('t-period-edit', {
+ props: {
+ 'value' :{
+ type: Object,
+ default(){ return null;},
+ },
+ 'type' :{
+ type: String,
+ default() { return "link";},
+ },
+ 'variant' : {
+ type: String,
+ default() { return "";},
+ }
+ },
+ data() {
+ return {
+ show: false,
+ editdata: {
+ fullname: '',
+ shortname: '',
+ startdate: (new Date()).getFullYear() + '-08-01',
+ enddate: ((new Date()).getFullYear()+1) + '-08-01',
+ },
+ text: strings.period_edit,
+ };
+ },
+ created() {
+ },
+ mounted() {
+ },
+ updated() {
+
+ },
+ computed: {
+ },
+ methods: {
+ editStart(){
+ objCopy(this.editdata,this.value,PERIOD_EDITOR_FIELDS);
+ this.show = true;
+ },
+ editFinish(){
+ const self = this;
+ let args = { 'id': this.value.id };
+ let method = 'local_treestudyplan_edit_period';
+
+ objCopy(args,this.editdata,PERIOD_EDITOR_FIELDS);
+
+ call([{
+ methodname: method,
+ args: args
+ }])[0].done(function(response){
+ objCopy(self.value,response,PERIOD_EDITOR_FIELDS);
+ self.$emit('input',self.value);
+ }).fail(notification.exception);
+ },
+ }
+ ,
+ template:
+ `
+
+
+
+
+
+
+ {{ text.fullname}}
+
+
+
+
+
+ {{ text.shortname}}
+
+
+
+
+
+ {{ text.studyplan_startdate}}
+
+
+
+
+
+ {{ text.studyplan_enddate}}
+
+
+
+
+
+
+
+ `
+ });
+
/*
* T-STUDYPLAN
*/
@@ -1384,6 +1506,7 @@ export default {
@@ -2315,7 +2438,19 @@ export default {
} else {
return "exclamation-circle";
}
+ },
+ startdate(){
+ return format_date(this.value.course.startdate);
+ },
+ enddate(){
+ if(this.value.course.enddate){
+ return format_date(this.value.course.enddate);
+ }
+ else {
+ return this.text.noenddate;
+ }
}
+
},
methods: {
hasGrades() {
@@ -2376,7 +2511,7 @@ export default {
@@ -2412,7 +2547,7 @@ export default {
diff --git a/amd/src/studyplan-processor.js b/amd/src/studyplan-processor.js
index 415ff2d..d8f3575 100644
--- a/amd/src/studyplan-processor.js
+++ b/amd/src/studyplan-processor.js
@@ -64,57 +64,60 @@ export function ProcessStudyplans(studyplans){
*/
export function ProcessStudyplan(studyplan){
let connections = {};
- for(const il in studyplan.studylines) {
- const line = studyplan.studylines[il];
+ for(const ip in studyplan.pages){
+ const page = studyplan.pages[ip];
+ for(const il in page.studylines) {
+ const line = page.studylines[il];
- for(const is in line.slots ) {
- const slot = line.slots[is];
+ for(const is in line.slots ) {
+ const slot = line.slots[is];
- if(slot.competencies !== undefined){
- for(const ic in slot.competencies){
- const itm = slot.competencies[ic];
+ if(slot.competencies !== undefined){
+ for(const ic in slot.competencies){
+ const itm = slot.competencies[ic];
- for(const idx in itm.connections.in) {
- const conn = itm.connections.in[idx];
+ for(const idx in itm.connections.in) {
+ const conn = itm.connections.in[idx];
- if(conn.id in connections){
- itm.connections[idx] = connections[conn.id];
- } else {
- connections[conn.id] = conn;
+ if(conn.id in connections){
+ itm.connections[idx] = connections[conn.id];
+ } else {
+ connections[conn.id] = conn;
+ }
}
- }
- for(const idx in itm.connections.out) {
- const conn = itm.connections.out[idx];
+ for(const idx in itm.connections.out) {
+ const conn = itm.connections.out[idx];
- if(conn.id in connections){
- itm.connections[idx] = connections[conn.id];
- } else {
- connections[conn.id] = conn;
+ if(conn.id in connections){
+ itm.connections[idx] = connections[conn.id];
+ } else {
+ connections[conn.id] = conn;
+ }
}
}
}
- }
- if(slot.filters !== undefined){
- for(const ix in slot.filters){
- const itm = slot.filters[ix];
+ if(slot.filters !== undefined){
+ for(const ix in slot.filters){
+ const itm = slot.filters[ix];
- for(const idx in itm.connections.in) {
- const conn = itm.connections.in[idx];
+ for(const idx in itm.connections.in) {
+ const conn = itm.connections.in[idx];
- if(conn.id in connections){
- itm.connections[idx] = connections[conn.id];
- } else {
- connections[conn.id] = conn;
+ if(conn.id in connections){
+ itm.connections[idx] = connections[conn.id];
+ } else {
+ connections[conn.id] = conn;
+ }
}
- }
- for(const idx in itm.connections.out) {
- const conn = itm.connections.out[idx];
+ for(const idx in itm.connections.out) {
+ const conn = itm.connections.out[idx];
- if(conn.id in connections){
- itm.connections[idx] = connections[conn.id];
- } else {
- connections[conn.id] = conn;
+ if(conn.id in connections){
+ itm.connections[idx] = connections[conn.id];
+ } else {
+ connections[conn.id] = conn;
+ }
}
}
}
diff --git a/amd/src/treestudyplan-components.js b/amd/src/treestudyplan-components.js
index a2a0732..d8e39c5 100644
--- a/amd/src/treestudyplan-components.js
+++ b/amd/src/treestudyplan-components.js
@@ -4,7 +4,7 @@
/*eslint-env es6*/
// Put this file in path/to/plugin/amd/src
-import {load_strings} from './string-helper';
+import {load_strings, format_date} from './string-helper';
export default {
studyplanTiming(a) {
@@ -60,17 +60,11 @@ export default {
return timing;
},
startdate(){
- const opts = {
- year: 'numeric', month: 'short', day: 'numeric'
- };
- return new Date(this.value.pages[0].startdate).toLocaleDateString(document.documentElement.lang,opts);
+ return format_date(this.value.pages[0].startdate);
},
enddate(){
if(this.value.enddate){
- const opts = {
- year: 'numeric', month: 'short', day: 'numeric'
- };
- return new Date(this.value.pages[0].enddate).toLocaleDateString(document.documentElement.lang,opts);
+ return format_date(this.value.pages[0].enddate);
}
else {
return this.text.noenddate;
@@ -162,7 +156,12 @@ export default {
}
},
computed: {
-
+ startdate(){
+ return format_date(this.value.startdate);
+ },
+ enddate(){
+ return format_date(this.value.enddate);
+ }
},
data() {
return {
@@ -170,7 +169,11 @@ export default {
},
template: `
`,
});
diff --git a/css/devstyles.css b/css/devstyles.css
index dc84d76..f8f5eef 100644
--- a/css/devstyles.css
+++ b/css/devstyles.css
@@ -583,6 +583,10 @@ a.t-item-course-config {
border-bottom-style: solid;
}
+.s-studyline-header-period .datespan{
+ font-size: 9px;
+}
+
.t-studyline-slot.rightmost,
.r-studyline-slot.rightmost {
diff --git a/version.php b/version.php
index f770b19..24523cb 100644
--- a/version.php
+++ b/version.php
@@ -1,6 +1,6 @@
component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
-$plugin->version = 2023072701; // YYYYMMDDHH (year, month, day, iteration)
+$plugin->version = 2023072801; // YYYYMMDDHH (year, month, day, iteration)
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
$plugin->dependencies = [