Finalized adding id number

This commit is contained in:
PMKuipers 2023-08-09 12:20:05 +02:00
parent b8427ee300
commit db0e7ac3df
8 changed files with 18 additions and 10 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,3 @@
define("local_treestudyplan/treestudyplan-components",["exports","./string-helper"],(function(_exports,_stringHelper){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var _default={studyplanTiming:function(a){var now=(new Date).getTime(),timing="future";return new Date(a.startdate).getTime()<now&&(timing=a.enddate&&now>new Date(a.enddate).getTime()?"past":"present"),timing},install:function(Vue){var strings=(0,_stringHelper.load_strings)({studyplancard:{open:"open",noenddate:"noenddate"}}),ItemEventBus=new Vue;Vue.component("s-studyplan-card",{props:{value:{type:Object},open:{type:Boolean}},data:function(){return{text:strings.studyplancard}},computed:{timing:function(){var now=(new Date).getTime(),startdate=new Date(this.value.pages[0].startdate).getTime(),enddate=new Date(this.value.pages[0].enddate).getTime(),timing="future";return startdate<now&&(timing=this.value.pages[0].enddate&&now>enddate?"past":"present"),timing},startdate:function(){return(0,_stringHelper.format_date)(this.value.pages[0].startdate)},enddate:function(){return this.value.enddate?(0,_stringHelper.format_date)(this.value.pages[0].enddate):this.text.noenddate}},methods:{onOpenClick:function(e){this.$emit("open",e)}},template:"\n <b-card \n :class=\"'s-studyplan-card timing-' + timing\"\n >\n <template #header></template>\n <b-card-title>\n <a v-if='open' href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>\n <template v-else>{{value.name}}</template>\n <slot name='title'></slot>\n </b-card-title>\n {{ value.description }}\n <slot></slot>\n <template #footer>\n <span :class=\"'t-timing-'+timing\" v-html=\"startdate + ' - '+ enddate\"></span>\n <span class=\"s-studyplan-card-buttons\">\n <slot name='footer'></slot>\n <b-button style=\"float:right;\" v-if='open' variant='primary' \n @click.prevent='onOpenClick($event)'>{{ text.open }}</b-button>\n </span>\n </template>\n </b-card>\n "}),Vue.component("s-studyline-header-heading",{props:{},data:function(){return{layerHeights:{}}},created:function(){ItemEventBus.$on("headerHeightChange",this.onHeaderHeightChange)},computed:{},methods:{onHeaderHeightChange:function(newheight){this.$refs.main&&(this.$refs.main.style.height="".concat(newheight,"px"))}},template:'\n <div class="s-studyline-header-heading" ref="main"></div>\n '}),Vue.component("s-studyline-header-period",{props:{value:{type:Object}},mounted:function(){var self=this;1==self.value.period&&(self.resizeListener=new ResizeObserver((function(){if(self.$refs.main){var size=self.$refs.main.getBoundingClientRect();ItemEventBus.$emit("headerHeightChange",size.height)}})).observe(self.$refs.main))},unmounted:function(){this.resizeListener&&this.resizeListener.disconnect()},computed:{startdate:function(){return(0,_stringHelper.format_date)(this.value.startdate)},enddate:function(){return(0,_stringHelper.format_date)(this.value.enddate)},current:function(){if(this.value&&this.value.startdate&&this.value.enddate){var now=new Date,pstart=new Date(this.value.startdate),pend=new Date(this.value.enddate);return now>=pstart&&now<pend}return!1}},data:function(){return{}},template:'\n <div :class="\'s-studyline-header-period \' + (current?\'current \':\' \')" ref="main"\n ><p><abbr :id="\'s-period-\'+value.id" :title="value.fullname">{{ value.shortname }}</abbr>\n <b-tooltip\n :target="\'s-period-\'+value.id" triggers="hover"\n >{{ value.fullname }}<br>\n <span class="s-studyline-header-period-datespan">\n <span class="date">{{ startdate }}</span> - <span class="date">{{ enddate }}</span>\n </span>\n </b-tooltip>\n <slot></slot\n ><p class="s-studyline-header-period-datespan small">\n <span class="date">{{ startdate }}</span> - <span class="date">{{ enddate }}</span>\n </p>\n </div>\n '})}};return _exports.default=_default,_exports.default})); define("local_treestudyplan/treestudyplan-components",["exports","./string-helper"],(function(_exports,_stringHelper){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var _default={studyplanTiming:function(a){var now=(new Date).getTime(),timing="future";return new Date(a.startdate).getTime()<now&&(timing=a.enddate&&now>new Date(a.enddate).getTime()?"past":"present"),timing},install:function(Vue){var strings=(0,_stringHelper.load_strings)({studyplancard:{open:"open",noenddate:"noenddate",idnumber:"studyplan_idnumber"}}),ItemEventBus=new Vue;Vue.component("s-studyplan-card",{props:{value:{type:Object},open:{type:Boolean}},data:function(){return{text:strings.studyplancard}},computed:{timing:function(){var now=(new Date).getTime(),startdate=new Date(this.value.pages[0].startdate).getTime(),enddate=new Date(this.value.pages[0].enddate).getTime(),timing="future";return startdate<now&&(timing=this.value.pages[0].enddate&&now>enddate?"past":"present"),timing},startdate:function(){return(0,_stringHelper.format_date)(this.value.pages[0].startdate)},enddate:function(){return this.value.enddate?(0,_stringHelper.format_date)(this.value.pages[0].enddate):this.text.noenddate}},methods:{onOpenClick:function(e){this.$emit("open",e)}},template:"\n <b-card \n :class=\"'s-studyplan-card timing-' + timing\"\n >\n <template #header></template>\n <b-card-title>\n <a v-if='open' href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>\n <template v-else>{{value.name}}</template>\n <slot name='title'></slot>\n </b-card-title>\n <div class='s-studyplan-card-idnumber' v-if='value.idnumber'><i>{{ text.idnumber}}:</i> {{ value.idnumber }}</div>\n <div class='s-studyplan-card-description' v-if='value.description'>{{ value.description }}</div>\n <slot></slot>\n <template #footer>\n <span :class=\"'t-timing-'+timing\" v-html=\"startdate + ' - '+ enddate\"></span>\n <span class=\"s-studyplan-card-buttons\">\n <slot name='footer'></slot>\n <b-button style=\"float:right;\" v-if='open' variant='primary' \n @click.prevent='onOpenClick($event)'>{{ text.open }}</b-button>\n </span>\n </template>\n </b-card>\n "}),Vue.component("s-studyline-header-heading",{props:{},data:function(){return{layerHeights:{}}},created:function(){ItemEventBus.$on("headerHeightChange",this.onHeaderHeightChange)},computed:{},methods:{onHeaderHeightChange:function(newheight){this.$refs.main&&(this.$refs.main.style.height="".concat(newheight,"px"))}},template:'\n <div class="s-studyline-header-heading" ref="main"></div>\n '}),Vue.component("s-studyline-header-period",{props:{value:{type:Object}},mounted:function(){var self=this;1==self.value.period&&(self.resizeListener=new ResizeObserver((function(){if(self.$refs.main){var size=self.$refs.main.getBoundingClientRect();ItemEventBus.$emit("headerHeightChange",size.height)}})).observe(self.$refs.main))},unmounted:function(){this.resizeListener&&this.resizeListener.disconnect()},computed:{startdate:function(){return(0,_stringHelper.format_date)(this.value.startdate)},enddate:function(){return(0,_stringHelper.format_date)(this.value.enddate)},current:function(){if(this.value&&this.value.startdate&&this.value.enddate){var now=new Date,pstart=new Date(this.value.startdate),pend=new Date(this.value.enddate);return now>=pstart&&now<pend}return!1}},data:function(){return{}},template:'\n <div :class="\'s-studyline-header-period \' + (current?\'current \':\' \')" ref="main"\n ><p><abbr :id="\'s-period-\'+value.id" :title="value.fullname">{{ value.shortname }}</abbr>\n <b-tooltip\n :target="\'s-period-\'+value.id" triggers="hover"\n >{{ value.fullname }}<br>\n <span class="s-studyline-header-period-datespan">\n <span class="date">{{ startdate }}</span> - <span class="date">{{ enddate }}</span>\n </span>\n </b-tooltip>\n <slot></slot\n ><p class="s-studyline-header-period-datespan small">\n <span class="date">{{ startdate }}</span> - <span class="date">{{ enddate }}</span>\n </p>\n </div>\n '})}};return _exports.default=_default,_exports.default}));
//# sourceMappingURL=treestudyplan-components.min.js.map //# sourceMappingURL=treestudyplan-components.min.js.map

File diff suppressed because one or more lines are too long

View file

@ -16,7 +16,7 @@ import Debugger from './debugger';
import {download,upload} from './downloader'; import {download,upload} from './downloader';
const STUDYPLAN_EDITOR_FIELDS = const STUDYPLAN_EDITOR_FIELDS =
['name','shortname','description','context_id', 'aggregation','aggregation_config']; ['name','shortname','description','idnumber','context_id', 'aggregation','aggregation_config'];
const STUDYPLAN_EDITOR_PAGE_FIELDS = //TODO: Add 'fullname', 'shortname' and 'description' when implementing proper page management const STUDYPLAN_EDITOR_PAGE_FIELDS = //TODO: Add 'fullname', 'shortname' and 'description' when implementing proper page management
['context_id', 'periods','startdate','enddate']; ['context_id', 'periods','startdate','enddate'];
const PERIOD_EDITOR_FIELDS = const PERIOD_EDITOR_FIELDS =

View file

@ -25,6 +25,7 @@ export default {
studyplancard: { studyplancard: {
open: "open", open: "open",
noenddate: "noenddate", noenddate: "noenddate",
idnumber: "studyplan_idnumber"
} }
}); });
// Create new eventbus for interaction between item components // Create new eventbus for interaction between item components
@ -86,7 +87,8 @@ export default {
<template v-else>{{value.name}}</template> <template v-else>{{value.name}}</template>
<slot name='title'></slot> <slot name='title'></slot>
</b-card-title> </b-card-title>
{{ value.description }} <div class='s-studyplan-card-idnumber' v-if='value.idnumber'><i>{{ text.idnumber}}:</i> {{ value.idnumber }}</div>
<div class='s-studyplan-card-description' v-if='value.description'>{{ value.description }}</div>
<slot></slot> <slot></slot>
<template #footer> <template #footer>
<span :class="'t-timing-'+timing" v-html="startdate + ' - '+ enddate"></span> <span :class="'t-timing-'+timing" v-html="startdate + ' - '+ enddate"></span>

View file

@ -79,6 +79,7 @@ class studyplan {
"id" => new \external_value(PARAM_INT, 'id of studyplan'), "id" => new \external_value(PARAM_INT, 'id of studyplan'),
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'), "name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'), "shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"idnumber" => new \external_value(PARAM_TEXT, 'idnumber of curriculum'),
"context_id" => new \external_value(PARAM_INT, 'context_id of studyplan'), "context_id" => new \external_value(PARAM_INT, 'context_id of studyplan'),
"description"=> new \external_value(PARAM_TEXT, 'description of studyplan'), "description"=> new \external_value(PARAM_TEXT, 'description of studyplan'),
"aggregation" => new \external_value(PARAM_TEXT, 'selected aggregator'), "aggregation" => new \external_value(PARAM_TEXT, 'selected aggregator'),
@ -98,6 +99,7 @@ class studyplan {
'id' => $this->r->id, 'id' => $this->r->id,
'name' => $this->r->name, 'name' => $this->r->name,
'shortname' => $this->r->shortname, 'shortname' => $this->r->shortname,
'idnumber' => $this->r->idnumber,
'context_id' => $this->context()->id, 'context_id' => $this->context()->id,
'description' => $this->r->description, 'description' => $this->r->description,
'aggregation' => $this->r->aggregation, 'aggregation' => $this->r->aggregation,
@ -112,8 +114,8 @@ class studyplan {
"id" => new \external_value(PARAM_INT, 'id of studyplan'), "id" => new \external_value(PARAM_INT, 'id of studyplan'),
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'), "name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'), "shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"idnumber" => new \external_value(PARAM_TEXT, 'idnumber of curriculum'),
"description"=> new \external_value(PARAM_TEXT, 'description of studyplan'), "description"=> new \external_value(PARAM_TEXT, 'description of studyplan'),
"idnumber"=> new \external_value(PARAM_TEXT, 'idnumber of curriculum'),
"context_id" => new \external_value(PARAM_INT, 'context_id of studyplan'), "context_id" => new \external_value(PARAM_INT, 'context_id of studyplan'),
"aggregation" => new \external_value(PARAM_TEXT, 'selected aggregator'), "aggregation" => new \external_value(PARAM_TEXT, 'selected aggregator'),
"aggregation_config" => new \external_value(PARAM_TEXT, 'config string for aggregator'), "aggregation_config" => new \external_value(PARAM_TEXT, 'config string for aggregator'),
@ -137,8 +139,8 @@ class studyplan {
'id' => $this->r->id, 'id' => $this->r->id,
'name' => $this->r->name, 'name' => $this->r->name,
'shortname' => $this->r->shortname, 'shortname' => $this->r->shortname,
'description' => $this->r->description,
'idnumber' => $this->r->idnumber, 'idnumber' => $this->r->idnumber,
'description' => $this->r->description,
'context_id' => $this->context()->id, 'context_id' => $this->context()->id,
"aggregation" => $this->r->aggregation, "aggregation" => $this->r->aggregation,
"aggregation_config" => $this->aggregator->config_string(), "aggregation_config" => $this->aggregator->config_string(),

View file

@ -119,6 +119,7 @@ class studyplanservice extends \external_api
return new \external_function_parameters( [ return new \external_function_parameters( [
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'), "name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'), "shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"idnumber"=> new \external_value(PARAM_TEXT, 'idnumber of studyplan'),
"description"=> new \external_value(PARAM_TEXT, 'description of studyplan'), "description"=> new \external_value(PARAM_TEXT, 'description of studyplan'),
"periods" => new \external_value(PARAM_INT, 'number of periods in studyplan'), "periods" => new \external_value(PARAM_INT, 'number of periods in studyplan'),
"startdate" => new \external_value(PARAM_TEXT, 'start date of studyplan'), "startdate" => new \external_value(PARAM_TEXT, 'start date of studyplan'),
@ -134,7 +135,7 @@ class studyplanservice extends \external_api
return studyplan::simple_structure(); return studyplan::simple_structure();
} }
public static function add_studyplan($name, $shortname,$description, $periods, $startdate, $enddate, $aggregation="bistate", $aggregation_config='',$context_id=0) public static function add_studyplan($name, $shortname, $idnumber, $description, $periods, $startdate, $enddate, $aggregation="bistate", $aggregation_config='',$context_id=0)
{ {
// Check if we have the proper rights for the requested context // Check if we have the proper rights for the requested context
$context = webservicehelper::find_context($context_id); $context = webservicehelper::find_context($context_id);
@ -143,6 +144,7 @@ class studyplanservice extends \external_api
$o = studyplan::add([ $o = studyplan::add([
'name' => $name, 'name' => $name,
'shortname' => $shortname, 'shortname' => $shortname,
'idnumber' => $idnumber,
'description' => $description, 'description' => $description,
'periods' => $periods, 'periods' => $periods,
'startdate' => $startdate, 'startdate' => $startdate,
@ -166,6 +168,7 @@ class studyplanservice extends \external_api
"id" => new \external_value(PARAM_INT, 'id of studyplan'), "id" => new \external_value(PARAM_INT, 'id of studyplan'),
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'), "name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'), "shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"idnumber"=> new \external_value(PARAM_TEXT, 'idnumber of studyplan'),
"description"=> new \external_value(PARAM_TEXT, 'description of studyplan'), "description"=> new \external_value(PARAM_TEXT, 'description of studyplan'),
"periods" => new \external_value(PARAM_INT, 'number of periods in studyplan'), "periods" => new \external_value(PARAM_INT, 'number of periods in studyplan'),
"startdate" => new \external_value(PARAM_TEXT, 'start date of studyplan'), "startdate" => new \external_value(PARAM_TEXT, 'start date of studyplan'),
@ -181,7 +184,7 @@ class studyplanservice extends \external_api
return studyplan::simple_structure(); return studyplan::simple_structure();
} }
public static function edit_studyplan($id, $name, $shortname, $description, $periods, $startdate, $enddate, $aggregation="bistate", $aggregation_config='',$context_id=0) public static function edit_studyplan($id, $name, $shortname, $idnumber, $description, $periods, $startdate, $enddate, $aggregation="bistate", $aggregation_config='',$context_id=0)
{ {
// Validate access in the intended context // Validate access in the intended context
$context = webservicehelper::find_context($context_id); $context = webservicehelper::find_context($context_id);
@ -193,6 +196,7 @@ class studyplanservice extends \external_api
$o->edit([ $o->edit([
'name' => $name, 'name' => $name,
'shortname' => $shortname, 'shortname' => $shortname,
'idnumber' => $idnumber,
'description' => $description, 'description' => $description,
'periods' => $periods, 'periods' => $periods,
'startdate' => $startdate, 'startdate' => $startdate,