Implemended studyplan suspension
This commit is contained in:
parent
f2fac43139
commit
747e1decd1
2
amd/build/report-viewer-components.min.js
vendored
2
amd/build/report-viewer-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
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
2
amd/build/treestudyplan-components.min.js
vendored
2
amd/build/treestudyplan-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
|
@ -438,7 +438,7 @@ export default {
|
||||||
const list = self.studyplans[k];
|
const list = self.studyplans[k];
|
||||||
for (const idx in list) {
|
for (const idx in list) {
|
||||||
const plan = list[idx];
|
const plan = list[idx];
|
||||||
if (plan.id == parts[0]){
|
if (plan.id == parts[0] && !plan.suspended){
|
||||||
self.selectStudyplan(plan);
|
self.selectStudyplan(plan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -448,14 +448,23 @@ export default {
|
||||||
|
|
||||||
if (self.studyplans.present.length == 1) {
|
if (self.studyplans.present.length == 1) {
|
||||||
// Directly show the current study plan if it's the only current one
|
// Directly show the current study plan if it's the only current one
|
||||||
self.selectStudyplan(self.studyplans.present[0]);
|
const plan = self.studyplans.present[0];
|
||||||
|
if (!plan.suspended) {
|
||||||
|
self.selectStudyplan(plan);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If there is but a single studyplan, select it anyway, even if it is not current...
|
// If there is but a single studyplan, select it anyway, even if it is not current...
|
||||||
if (this.studyplancount == 1) {
|
if (this.studyplancount == 1) {
|
||||||
if(self.studyplans.future.lengh > 0) {
|
if(self.studyplans.future.lengh > 0) {
|
||||||
self.selectStudyplan(self.studyplans.future[0]);
|
const plan = self.studyplans.future[0];
|
||||||
|
if (!plan.suspended) {
|
||||||
|
self.selectStudyplan(plan);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.selectStudyplan(self.studyplans.past[0]);
|
const plan = self.studyplans.past[0];
|
||||||
|
if (!plan.suspended) {
|
||||||
|
self.selectStudyplan(plan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -721,7 +721,6 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
planSaved(updatedpage){
|
planSaved(updatedpage){
|
||||||
const self = this;
|
const self = this;
|
||||||
debug.info("Got new page data",updatedpage);
|
|
||||||
|
|
||||||
if(self.mode == 'create'){
|
if(self.mode == 'create'){
|
||||||
// Inform parent of the details of the newly created plan
|
// Inform parent of the details of the newly created plan
|
||||||
|
|
|
@ -6,10 +6,14 @@
|
||||||
|
|
||||||
import {load_strings} from './util/string-helper';
|
import {load_strings} from './util/string-helper';
|
||||||
import {format_date, studyplanDates, studyplanTiming} from './util/date-helper';
|
import {format_date, studyplanDates, studyplanTiming} from './util/date-helper';
|
||||||
|
import FitTextVue from './util/fittext-vue';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
install(Vue/*,options*/){
|
install(Vue/*,options*/){
|
||||||
|
Vue.use(FitTextVue);
|
||||||
|
|
||||||
let strings = load_strings({
|
let strings = load_strings({
|
||||||
studyplancard: {
|
studyplancard: {
|
||||||
open: "open",
|
open: "open",
|
||||||
|
@ -18,6 +22,7 @@ export default {
|
||||||
description: "studyplan_description",
|
description: "studyplan_description",
|
||||||
completed: "completed",
|
completed: "completed",
|
||||||
details: "studyplan_details",
|
details: "studyplan_details",
|
||||||
|
suspended: "suspended",
|
||||||
},
|
},
|
||||||
details: {
|
details: {
|
||||||
details: "studyplan_details",
|
details: "studyplan_details",
|
||||||
|
@ -43,6 +48,10 @@ export default {
|
||||||
open: {
|
open: {
|
||||||
type: Boolean
|
type: Boolean
|
||||||
},
|
},
|
||||||
|
ignoresuspend: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -60,6 +69,9 @@ export default {
|
||||||
end: (dates.end)?format_date(dates.end):this.text.noenddate,
|
end: (dates.end)?format_date(dates.end):this.text.noenddate,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
suspended() {
|
||||||
|
return (this.value.suspended && !this.ignoresuspend);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -69,7 +81,7 @@ export default {
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<b-card
|
<b-card
|
||||||
:class="'s-studyplan-card timing-' + timing"
|
:class="'s-studyplan-card timing-' + timing + (suspended?' s-suspended':'')"
|
||||||
>
|
>
|
||||||
<template #header></template>
|
<template #header></template>
|
||||||
|
|
||||||
|
@ -78,8 +90,11 @@ export default {
|
||||||
<div class='s-studyplan-card-info'>
|
<div class='s-studyplan-card-info'>
|
||||||
<div class='s-studyplan-card-titlebar'>
|
<div class='s-studyplan-card-titlebar'>
|
||||||
<b-card-title>
|
<b-card-title>
|
||||||
<a class='title' v-if='open' href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>
|
<a class='title' v-if='open && !suspended'
|
||||||
|
href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>
|
||||||
<template v-else>{{value.name}}</template>
|
<template v-else>{{value.name}}</template>
|
||||||
|
<div v-if="suspended" class='text-danger'
|
||||||
|
><fittext maxsize="12pt">{{text.suspended}}</fittext></div>
|
||||||
</b-card-title>
|
</b-card-title>
|
||||||
<div class='s-studyplan-card-titleslot'><slot name='title'></slot></div>
|
<div class='s-studyplan-card-titleslot'><slot name='title'></slot></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -87,7 +102,7 @@ export default {
|
||||||
{{ text.idnumber }}: {{ value.idnumber }}
|
{{ text.idnumber }}: {{ value.idnumber }}
|
||||||
</div>
|
</div>
|
||||||
<s-progress-bar
|
<s-progress-bar
|
||||||
v-if='value.progress !== undefined && value.progress !== null'
|
v-if='!suspended && value.progress !== undefined && value.progress !== null'
|
||||||
v-model="value.progress"
|
v-model="value.progress"
|
||||||
></s-progress-bar>
|
></s-progress-bar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,7 +117,7 @@ export default {
|
||||||
v-model="value"
|
v-model="value"
|
||||||
v-if="value.description"
|
v-if="value.description"
|
||||||
><i class='fa fa-info-circle'></i></s-studyplan-details>
|
><i class='fa fa-info-circle'></i></s-studyplan-details>
|
||||||
<b-button style="float:right;" v-if='open' variant='primary'
|
<b-button style="float:right;" v-if='open && !suspended' variant='primary'
|
||||||
@click.prevent='onOpenClick($event)'>{{ text.open }}</b-button>
|
@click.prevent='onOpenClick($event)'>{{ text.open }}</b-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -6,6 +6,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||||
require_once($CFG->dirroot.'/repository/lib.php');
|
require_once($CFG->dirroot.'/repository/lib.php');
|
||||||
use local_treestudyplan\aggregator;
|
use local_treestudyplan\aggregator;
|
||||||
use local_treestudyplan\studyplan;
|
use local_treestudyplan\studyplan;
|
||||||
|
use local_treestudyplan\premium;
|
||||||
use local_treestudyplan\studyplanservice;
|
use local_treestudyplan\studyplanservice;
|
||||||
use local_treestudyplan\courseservice;
|
use local_treestudyplan\courseservice;
|
||||||
use local_treestudyplan\form\text_integer;
|
use local_treestudyplan\form\text_integer;
|
||||||
|
@ -214,6 +215,14 @@ class studyplan_editform extends formbase {
|
||||||
$mform->setType($field, PARAM_INT);
|
$mform->setType($field, PARAM_INT);
|
||||||
$mform->addRule($field, null, 'required', null, 'client');
|
$mform->addRule($field, null, 'required', null, 'client');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// These fields are only relevant if the studyplan is edited
|
||||||
|
$field = 'suspended';
|
||||||
|
$mform->addElement('advcheckbox',$field,
|
||||||
|
get_string('studyplan_suspend','local_treestudyplan'),
|
||||||
|
get_string('studyplan_suspend_details','local_treestudyplan'),
|
||||||
|
[],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$aggregators = [];
|
$aggregators = [];
|
||||||
|
@ -339,6 +348,7 @@ class studyplan_editform extends formbase {
|
||||||
'descriptionformat' => $entry->descriptionformat,
|
'descriptionformat' => $entry->descriptionformat,
|
||||||
'aggregation' => $entry->aggregation,
|
'aggregation' => $entry->aggregation,
|
||||||
'aggregation_config' => $aggregation_config,
|
'aggregation_config' => $aggregation_config,
|
||||||
|
'suspended' => $entry->suspended,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ class studentstudyplanservice extends \external_api {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
|
|
||||||
$studyplan = studyplan::find_by_id($studyplanid);
|
$studyplan = studyplan::find_by_id($studyplanid);
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_VIEWOTHER, $studyplan->context());
|
webservicehelper::require_capabilities(self::CAP_VIEWOTHER, $studyplan->context());
|
||||||
|
@ -285,7 +285,12 @@ class studentstudyplanservice extends \external_api {
|
||||||
$userid = $invite->user_id;
|
$userid = $invite->user_id;
|
||||||
|
|
||||||
if ($studyplan->exist_for_user($userid)) {
|
if ($studyplan->exist_for_user($userid)) {
|
||||||
return $studyplan->user_model($userid);
|
if (!$studyplan->suspended()) {
|
||||||
|
return $studyplan->user_model($userid);
|
||||||
|
} else {
|
||||||
|
throw new \moodle_exception("The selected studyplan is suspended");
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new \moodle_exception("Invitation's user is not linked to this studyplan");
|
throw new \moodle_exception("Invitation's user is not linked to this studyplan");
|
||||||
}
|
}
|
||||||
|
@ -424,7 +429,7 @@ class studentstudyplanservice extends \external_api {
|
||||||
|
|
||||||
$studyplan = studyplan::find_by_id($studyplanid);
|
$studyplan = studyplan::find_by_id($studyplanid);
|
||||||
|
|
||||||
if ($studyplan->exist_for_user($userid)) {
|
if ($studyplan->exist_for_user($userid) && !$studyplan->suspended()) {
|
||||||
$model = $studyplan->user_model($userid);
|
$model = $studyplan->user_model($userid);
|
||||||
return $model;
|
return $model;
|
||||||
} else {
|
} else {
|
||||||
|
@ -470,7 +475,7 @@ class studentstudyplanservice extends \external_api {
|
||||||
$page = studyplanpage::find_by_id($pageid);
|
$page = studyplanpage::find_by_id($pageid);
|
||||||
$studyplan = $page->studyplan();
|
$studyplan = $page->studyplan();
|
||||||
|
|
||||||
if ($studyplan->exist_for_user($userid)) {
|
if ($studyplan->exist_for_user($userid && !$studyplan->suspended())) {
|
||||||
return $page->user_model($userid);
|
return $page->user_model($userid);
|
||||||
} else {
|
} else {
|
||||||
throw new \moodle_exception("You do not have access to this studyplan page");
|
throw new \moodle_exception("You do not have access to this studyplan page");
|
||||||
|
|
|
@ -122,6 +122,15 @@ class studyplan {
|
||||||
return $this->r->name;
|
return $this->r->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if studyplan is suspended
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function suspended() {
|
||||||
|
return boolval($this->r->suspended);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function icon() {
|
private function icon() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
$fs = \get_file_storage();
|
$fs = \get_file_storage();
|
||||||
|
@ -235,6 +244,7 @@ class studyplan {
|
||||||
"pages" => new \external_multiple_structure(studyplanpage::simple_structure(), 'pages'),
|
"pages" => new \external_multiple_structure(studyplanpage::simple_structure(), 'pages'),
|
||||||
"progress" => new \external_value(PARAM_FLOAT,"fraction of completed modules",VALUE_OPTIONAL),
|
"progress" => new \external_value(PARAM_FLOAT,"fraction of completed modules",VALUE_OPTIONAL),
|
||||||
"amteaching" => new \external_value(PARAM_BOOL,"Current user is teaching one or more courses in this studyplan",VALUE_OPTIONAL),
|
"amteaching" => new \external_value(PARAM_BOOL,"Current user is teaching one or more courses in this studyplan",VALUE_OPTIONAL),
|
||||||
|
"suspended" => new \external_value(PARAM_BOOL, 'if studyplan is suspended',VALUE_OPTIONAL),
|
||||||
], 'Basic studyplan info', $value);
|
], 'Basic studyplan info', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +272,7 @@ class studyplan {
|
||||||
'aggregation_config' => $this->aggregator->config_string(),
|
'aggregation_config' => $this->aggregator->config_string(),
|
||||||
'aggregation_info' => $this->aggregator->basic_model(),
|
'aggregation_info' => $this->aggregator->basic_model(),
|
||||||
'pages' => $pages,
|
'pages' => $pages,
|
||||||
|
'suspended' => boolval($this->r->suspended),
|
||||||
];
|
];
|
||||||
if(isset($userid)) {
|
if(isset($userid)) {
|
||||||
$model["userid"] = $userid;
|
$model["userid"] = $userid;
|
||||||
|
@ -297,7 +308,8 @@ class studyplan {
|
||||||
])),
|
])),
|
||||||
], "Scale forcing on stuff", VALUE_OPTIONAL),
|
], "Scale forcing on stuff", VALUE_OPTIONAL),
|
||||||
], "Advanced features available", VALUE_OPTIONAL),
|
], "Advanced features available", VALUE_OPTIONAL),
|
||||||
], 'Studyplan full structure', $value);
|
"suspended" => new \external_value(PARAM_BOOL, 'if studyplan is suspended',VALUE_OPTIONAL),
|
||||||
|
], 'Studyplan full structure', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -320,6 +332,7 @@ class studyplan {
|
||||||
"aggregation_config" => $this->aggregator->config_string(),
|
"aggregation_config" => $this->aggregator->config_string(),
|
||||||
'aggregation_info' => $this->aggregator->basic_model(),
|
'aggregation_info' => $this->aggregator->basic_model(),
|
||||||
'pages' => [],
|
'pages' => [],
|
||||||
|
'suspended' => boolval($this->r->suspended),
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($this->pages() as $p) {
|
foreach ($this->pages() as $p) {
|
||||||
|
@ -392,12 +405,22 @@ class studyplan {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit study line properties
|
* Edit study line properties
|
||||||
* @param array $fields Changed roperties for study line ['name', 'shortname', 'description', 'idnumber',
|
* @param array $fields Changed properties for study line ['name', 'shortname', 'description', 'idnumber',
|
||||||
* 'context_id', 'aggregation', 'aggregation_config']
|
* 'context_id', 'aggregation', 'aggregation_config', 'suspended']
|
||||||
*/
|
*/
|
||||||
public function edit($fields) : self {
|
public function edit($fields) : self {
|
||||||
global $DB;
|
global $DB;
|
||||||
$editable = ['name', 'shortname', 'description', 'descriptionformat', 'idnumber', 'context_id', 'aggregation', 'aggregation_config'];
|
$editable = [
|
||||||
|
'name',
|
||||||
|
'shortname',
|
||||||
|
'description',
|
||||||
|
'descriptionformat',
|
||||||
|
'idnumber',
|
||||||
|
'context_id',
|
||||||
|
'aggregation',
|
||||||
|
'aggregation_config',
|
||||||
|
'suspended'
|
||||||
|
];
|
||||||
$info = ['id' => $this->id, ];
|
$info = ['id' => $this->id, ];
|
||||||
foreach ($editable as $f) {
|
foreach ($editable as $f) {
|
||||||
if (array_key_exists($f, $fields)) {
|
if (array_key_exists($f, $fields)) {
|
||||||
|
|
|
@ -127,15 +127,19 @@ class studyplanservice extends \external_api {
|
||||||
if (isset($id) && $id > 0) {
|
if (isset($id) && $id > 0) {
|
||||||
$studyplan = studyplan::find_by_id($id);
|
$studyplan = studyplan::find_by_id($id);
|
||||||
|
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities([self::CAP_EDIT, self::CAP_VIEW], $studyplan->context());
|
webservicehelper::require_capabilities([self::CAP_EDIT, self::CAP_VIEW], $studyplan->context());
|
||||||
}
|
}
|
||||||
|
|
||||||
$model = $studyplan->editor_model();
|
// If suspended, only allow the mapping if the user has edit rights
|
||||||
debug::dump($model);
|
if (!has_capability(self::CAP_EDIT,$studyplan->context()) && $studyplan->suspended()) {
|
||||||
return $model;
|
return null;
|
||||||
|
} else {
|
||||||
|
$model = $studyplan->editor_model();
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +639,7 @@ class studyplanservice extends \external_api {
|
||||||
public static function add_studyitem($lineid, $type, $details, $slot = -1, $layer = 0) {
|
public static function add_studyitem($lineid, $type, $details, $slot = -1, $layer = 0) {
|
||||||
$line = studyline::find_by_id($lineid);
|
$line = studyline::find_by_id($lineid);
|
||||||
$studyplan = $line->studyplan();
|
$studyplan = $line->studyplan();
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
||||||
|
@ -689,7 +693,7 @@ class studyplanservice extends \external_api {
|
||||||
|
|
||||||
$o = studyitem::find_by_id($id);
|
$o = studyitem::find_by_id($id);
|
||||||
$studyplan = $o->studyline()->studyplan();
|
$studyplan = $o->studyline()->studyplan();
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $o->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $o->context());
|
||||||
|
@ -747,7 +751,7 @@ class studyplanservice extends \external_api {
|
||||||
$item = studyitem::find_by_id(($sq['id']));
|
$item = studyitem::find_by_id(($sq['id']));
|
||||||
$studyplan = $item->studyline()->studyplan();
|
$studyplan = $item->studyline()->studyplan();
|
||||||
|
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
||||||
|
@ -787,7 +791,7 @@ class studyplanservice extends \external_api {
|
||||||
public static function delete_studyitem($id) {
|
public static function delete_studyitem($id) {
|
||||||
$o = studyitem::find_by_id($id);
|
$o = studyitem::find_by_id($id);
|
||||||
$studyplan = $o->studyline()->studyplan();
|
$studyplan = $o->studyline()->studyplan();
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $o->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $o->context());
|
||||||
|
@ -832,7 +836,7 @@ class studyplanservice extends \external_api {
|
||||||
if ($toplan->id() != $studyplan->id()) {
|
if ($toplan->id() != $studyplan->id()) {
|
||||||
throw new \webservice_access_exception("The items to connect need to be in the same studyplan" );
|
throw new \webservice_access_exception("The items to connect need to be in the same studyplan" );
|
||||||
}
|
}
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
||||||
|
@ -878,7 +882,7 @@ class studyplanservice extends \external_api {
|
||||||
if ($toplan->id() != $studyplan->id()) {
|
if ($toplan->id() != $studyplan->id()) {
|
||||||
throw new \webservice_access_exception("The items to connect need to be in the same studyplan" );
|
throw new \webservice_access_exception("The items to connect need to be in the same studyplan" );
|
||||||
}
|
}
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
|
||||||
|
@ -1001,7 +1005,7 @@ class studyplanservice extends \external_api {
|
||||||
$results = [];
|
$results = [];
|
||||||
$page = studyplanpage::find_by_id(($pageid));
|
$page = studyplanpage::find_by_id(($pageid));
|
||||||
$studyplan = $page->studyplan();
|
$studyplan = $page->studyplan();
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT,$studyplan->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT,$studyplan->context());
|
||||||
|
@ -1059,8 +1063,9 @@ class studyplanservice extends \external_api {
|
||||||
$studyplan = studyitem::find_by_id($itemid)->studyline()->studyplan();
|
$studyplan = studyitem::find_by_id($itemid)->studyline()->studyplan();
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
// Check correct capabilities.
|
// Check correct capabilities.
|
||||||
if ($studyplan->is_coach() || has_capability(self::CAP_EDIT, $studyplan->context()) ||
|
if (($studyplan->is_coach() && !$studyplan->suspended())
|
||||||
is_enrolled($coursecontext, $USER, 'local/treestudyplan:selectowngradables')) {
|
|| has_capability(self::CAP_EDIT, $studyplan->context())
|
||||||
|
|| is_enrolled($coursecontext, $USER, 'local/treestudyplan:selectowngradables')) {
|
||||||
return gradeinfo::include_grade($gradeid, $itemid, $include, $required)->model();
|
return gradeinfo::include_grade($gradeid, $itemid, $include, $required)->model();
|
||||||
} else {
|
} else {
|
||||||
return success::fail("Access denied")->model();
|
return success::fail("Access denied")->model();
|
||||||
|
@ -1114,8 +1119,9 @@ class studyplanservice extends \external_api {
|
||||||
|
|
||||||
// Check correct capabilities.
|
// Check correct capabilities.
|
||||||
$studyplan = $item->studyline()->studyplan();
|
$studyplan = $item->studyline()->studyplan();
|
||||||
if ($studyplan->is_coach() || has_capability('local/treestudyplan:editstudyplan', $studyplan->context()) ||
|
if (($studyplan->is_coach() && !$studyplan->suspended())
|
||||||
($coursecontext && is_enrolled($coursecontext, $USER, 'local/treestudyplan:selectowngradables'))) {
|
|| has_capability('local/treestudyplan:editstudyplan', $studyplan->context())
|
||||||
|
|| ($coursecontext && is_enrolled($coursecontext, $USER, 'local/treestudyplan:selectowngradables'))) {
|
||||||
return coursecompetencyinfo::require_competency($competencyid, $itemid, $required)->model();
|
return coursecompetencyinfo::require_competency($competencyid, $itemid, $required)->model();
|
||||||
} else {
|
} else {
|
||||||
return success::fail("Access denied")->model();
|
return success::fail("Access denied")->model();
|
||||||
|
@ -1841,7 +1847,7 @@ class studyplanservice extends \external_api {
|
||||||
public static function set_studyitem_span($id, $span = null) {
|
public static function set_studyitem_span($id, $span = null) {
|
||||||
$o = studyitem::find_by_id($id);
|
$o = studyitem::find_by_id($id);
|
||||||
$studyplan = $o->studyline()->studyplan();
|
$studyplan = $o->studyline()->studyplan();
|
||||||
if ($studyplan->is_coach()) {
|
if ($studyplan->is_coach() && !$studyplan->suspended()) {
|
||||||
\external_api::validate_context($studyplan->context());
|
\external_api::validate_context($studyplan->context());
|
||||||
} else {
|
} else {
|
||||||
webservicehelper::require_capabilities(self::CAP_EDIT, $o->context());
|
webservicehelper::require_capabilities(self::CAP_EDIT, $o->context());
|
||||||
|
|
|
@ -1487,6 +1487,14 @@ body.path-local-treestudyplan .editmode-switch-form > * {
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.path-local-treestudyplan .card.s-studyplan-card.s-suspended .card-body,
|
||||||
|
.features-treestudyplan .card.s-studyplan-card.s-suspended .card-body {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
.path-local-treestudyplan .card.s-studyplan-card.s-suspended .card-footer,
|
||||||
|
.features-treestudyplan .card.s-studyplan-card.s-suspended .card-footer {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
.path-local-treestudyplan .card.s-studyplan-card.timing-past .card-header,
|
.path-local-treestudyplan .card.s-studyplan-card.timing-past .card-header,
|
||||||
.features-treestudyplan .card.s-studyplan-card.timing-past .card-header {
|
.features-treestudyplan .card.s-studyplan-card.timing-past .card-header {
|
||||||
background-color: var(--past);
|
background-color: var(--past);
|
||||||
|
|
|
@ -603,7 +603,7 @@ function xmldb_local_treestudyplan_upgrade($oldversion) {
|
||||||
// Treestudyplan savepoint reached.
|
// Treestudyplan savepoint reached.
|
||||||
upgrade_plugin_savepoint(true, 2024030801, 'local', 'treestudyplan');
|
upgrade_plugin_savepoint(true, 2024030801, 'local', 'treestudyplan');
|
||||||
}
|
}
|
||||||
if ($oldversion < 2024030900) {
|
if ($oldversion < 2024031000) {
|
||||||
|
|
||||||
// Define field suspended to be added to local_treestudyplan.
|
// Define field suspended to be added to local_treestudyplan.
|
||||||
$table = new xmldb_table('local_treestudyplan');
|
$table = new xmldb_table('local_treestudyplan');
|
||||||
|
@ -615,7 +615,7 @@ function xmldb_local_treestudyplan_upgrade($oldversion) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treestudyplan savepoint reached.
|
// Treestudyplan savepoint reached.
|
||||||
upgrade_plugin_savepoint(true, 2024030900, 'local', 'treestudyplan');
|
upgrade_plugin_savepoint(true, 2024031000, 'local', 'treestudyplan');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -178,6 +178,7 @@ print $OUTPUT->header();
|
||||||
:key='studyplan.id'
|
:key='studyplan.id'
|
||||||
v-model='studyplans[planindex]'
|
v-model='studyplans[planindex]'
|
||||||
open
|
open
|
||||||
|
ignoresuspend
|
||||||
@open='selectStudyplan(studyplan.id)'
|
@open='selectStudyplan(studyplan.id)'
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
|
|
|
@ -170,6 +170,8 @@ $string["studyplan_enddate"] = 'End date of plan';
|
||||||
$string["studyplan_noneselected"] = "Pick a study plan to start editing";
|
$string["studyplan_noneselected"] = "Pick a study plan to start editing";
|
||||||
$string["studyplan_select"] = "Study plan:";
|
$string["studyplan_select"] = "Study plan:";
|
||||||
$string["studyplan_select_placeholder"] = "Select study plan";
|
$string["studyplan_select_placeholder"] = "Select study plan";
|
||||||
|
$string["studyplan_suspend"] = 'Suspend studyplan';
|
||||||
|
$string["studyplan_suspend_details"] = 'Suspend studyplan for all except studyplan managers';
|
||||||
|
|
||||||
$string["studyline_add"] = 'Add study line';
|
$string["studyline_add"] = 'Add study line';
|
||||||
$string["studyline_edit"] = 'Edit study line';
|
$string["studyline_edit"] = 'Edit study line';
|
||||||
|
@ -497,3 +499,4 @@ $string["line_can_enrol"] = 'You can register for this line';
|
||||||
$string["line_is_enrolled"] = 'You are registered for this line';
|
$string["line_is_enrolled"] = 'You are registered for this line';
|
||||||
$string["line_enrolled_in"] = 'Registered in {$a}';
|
$string["line_enrolled_in"] = 'Registered in {$a}';
|
||||||
$string["switch_coach_editmode"] = "Edit studyplan";
|
$string["switch_coach_editmode"] = "Edit studyplan";
|
||||||
|
$string["suspended"] = "Suspended";
|
|
@ -170,6 +170,9 @@ $string["studyplan_enddate"] = 'Einddatum';
|
||||||
$string["studyplan_noneselected"] = "Kies een studieplan uit de lijst";
|
$string["studyplan_noneselected"] = "Kies een studieplan uit de lijst";
|
||||||
$string["studyplan_select"] = "Studieplan";
|
$string["studyplan_select"] = "Studieplan";
|
||||||
$string["studyplan_select_placeholder"] = "Selecteer studieplan";
|
$string["studyplan_select_placeholder"] = "Selecteer studieplan";
|
||||||
|
$string["studyplan_suspend"] = 'Studieplan tijdelijk uitschakelen';
|
||||||
|
$string["studyplan_suspend_details"] = 'Inkijken van studieplan tijdelijk uitschakelen, behalve voor beheerders.';
|
||||||
|
|
||||||
|
|
||||||
$string["studyline_add"] = 'Nieuwe leerlijn';
|
$string["studyline_add"] = 'Nieuwe leerlijn';
|
||||||
$string["studyline_edit"] = 'Leerlijn bewerken';
|
$string["studyline_edit"] = 'Leerlijn bewerken';
|
||||||
|
@ -497,3 +500,4 @@ $string["line_can_enrol"] = 'Je kunt jezelf inschrijven voor deze leerlijn';
|
||||||
$string["line_is_enrolled"] = 'Je bent ingeschreven voor deze leerlijn';
|
$string["line_is_enrolled"] = 'Je bent ingeschreven voor deze leerlijn';
|
||||||
$string["line_enrolled_in"] = 'Ingeschreven in {$a}';
|
$string["line_enrolled_in"] = 'Ingeschreven in {$a}';
|
||||||
$string["switch_coach_editmode"] = "Studieplan bewerken";
|
$string["switch_coach_editmode"] = "Studieplan bewerken";
|
||||||
|
$string["suspended"] = "Tijdelijk uitgeschakeld";
|
|
@ -15,6 +15,14 @@
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.card.s-studyplan-card.s-suspended {
|
||||||
|
.card-body {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
.card-footer {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.card.s-studyplan-card.timing-past .card-header {
|
.card.s-studyplan-card.timing-past .card-header {
|
||||||
background-color: var(--past);
|
background-color: var(--past);
|
||||||
|
@ -157,4 +165,6 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1487,6 +1487,14 @@ body.path-local-treestudyplan .editmode-switch-form > * {
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.path-local-treestudyplan .card.s-studyplan-card.s-suspended .card-body,
|
||||||
|
.features-treestudyplan .card.s-studyplan-card.s-suspended .card-body {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
.path-local-treestudyplan .card.s-studyplan-card.s-suspended .card-footer,
|
||||||
|
.features-treestudyplan .card.s-studyplan-card.s-suspended .card-footer {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
.path-local-treestudyplan .card.s-studyplan-card.timing-past .card-header,
|
.path-local-treestudyplan .card.s-studyplan-card.timing-past .card-header,
|
||||||
.features-treestudyplan .card.s-studyplan-card.timing-past .card-header {
|
.features-treestudyplan .card.s-studyplan-card.timing-past .card-header {
|
||||||
background-color: var(--past);
|
background-color: var(--past);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
||||||
$plugin->version = 2024030901; // YYYYMMDDHH (year, month, day, iteration).
|
$plugin->version = 2024031000; // YYYYMMDDHH (year, month, day, iteration).
|
||||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||||
|
|
||||||
$plugin->release = "1.1.6";
|
$plugin->release = "1.1.6";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user