Fixed default aggregation setting not working
This commit is contained in:
parent
9fee6fb8b5
commit
4a358728e5
2
amd/build/page-edit-plan.min.js
vendored
2
amd/build/page-edit-plan.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/studyplan-editor-components.min.js
vendored
2
amd/build/studyplan-editor-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -49,14 +49,24 @@ let strings = load_strings({
|
|||
* Initialize the Page
|
||||
* @param {int} contextid The context we should attempt to work in (1:1 related to the category)
|
||||
* @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)
|
||||
* @param {object} options Options to be passed to this script
|
||||
*/
|
||||
export function init(contextid,categoryid) {
|
||||
export function init(contextid,categoryid,options) {
|
||||
// Make sure the id's are numeric and integer
|
||||
if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;}
|
||||
else { contextid = Number(contextid);} // ensure a numeric value instead of string
|
||||
if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}
|
||||
else { categoryid = Number(categoryid);} // ensure a numeric value instead of string
|
||||
|
||||
debug.info("options",options);
|
||||
if ( options !== null && typeof options === 'object' && !Array.isArray(options) ) {
|
||||
if ( !options.defaultAggregation ) {
|
||||
options.defaultAggregation = "core";
|
||||
}
|
||||
} else {
|
||||
options = { defaultAggregation: "core"};
|
||||
}
|
||||
|
||||
const in_systemcontext = (contextid <= 1);
|
||||
|
||||
// Setup the initial Vue app for this page
|
||||
|
@ -73,7 +83,7 @@ export function init(contextid,categoryid) {
|
|||
startdate: '2020-08-01',
|
||||
enddate: '',
|
||||
context: contextid,
|
||||
aggregation: 'bistate',
|
||||
aggregation: options.defaultAggregation,
|
||||
aggregation_config: '',
|
||||
}
|
||||
},
|
||||
|
|
|
@ -528,6 +528,10 @@ export default {
|
|||
'contextid': {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
'defaultAggregation': {
|
||||
type: String,
|
||||
default: "core",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -554,7 +558,7 @@ export default {
|
|||
periods : 4,
|
||||
startdate: (new Date()).getFullYear() + '-08-01',
|
||||
enddate: ((new Date()).getFullYear()+1) + '-08-01',
|
||||
aggregation: 'bistate',
|
||||
aggregation: this.defaultAggregation,
|
||||
aggregation_config: '',
|
||||
},
|
||||
aggregation_parsed: {
|
||||
|
|
|
@ -78,7 +78,9 @@ $PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/boot
|
|||
if ($CFG->debugdeveloper) {
|
||||
$PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
|
||||
}
|
||||
$PAGE->requires->js_call_amd('local_treestudyplan/page-edit-plan', 'init', [$studyplancontext->id, $categoryid]);
|
||||
$PAGE->requires->js_call_amd('local_treestudyplan/page-edit-plan', 'init', [$studyplancontext->id, $categoryid, [
|
||||
"defaultAggregation" => get_config("local_treestudyplan","aggregation_mode"),
|
||||
]]);
|
||||
|
||||
$catlist = courseservice::list_accessible_categories_with_usage("edit");
|
||||
|
||||
|
@ -133,6 +135,7 @@ print $OUTPUT->header();
|
|||
v-model="create.studyplan"
|
||||
type="button"
|
||||
variant="primary"
|
||||
default-aggregation="<?php print(get_config("local_treestudyplan","aggregation_mode")); ?>"
|
||||
:contextid='contextid'
|
||||
><i class='fa fa-plus'></i> <?php t("studyplan_add");?></t-studyplan-edit>
|
||||
<b-button v-if='!activestudyplan && !loadingstudyplan'
|
||||
|
|
Loading…
Reference in New Issue
Block a user