Added userid to user studyplan data

This commit is contained in:
PMKuipers 2023-11-27 23:18:55 +01:00
parent 96caeb895a
commit 5ca74f8b1a
4 changed files with 10 additions and 6 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

@ -286,7 +286,7 @@ export default {
type: {
type: String,
default() { return "own";},
}
},
},
data() {
return {
@ -457,12 +457,12 @@ export default {
},
guestmode: {
type: Boolean,
default: false,
default() { return false;},
},
teachermode: {
type: Boolean,
default: false,
}
default() { return false;},
},
},
data() {
return {

View File

@ -211,6 +211,7 @@ class studyplan {
public static function simple_structure($value = VALUE_REQUIRED) : \external_description {
return new \external_single_structure([
"id" => new \external_value(PARAM_INT, 'id of studyplan'),
"userid" => new \external_value(PARAM_INT, 'id of user the plan is shown for',VALUE_OPTIONAL),
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname" => new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"idnumber" => new \external_value(PARAM_TEXT, 'idnumber of curriculum'),
@ -253,6 +254,7 @@ class studyplan {
'pages' => $pages,
];
if(isset($userid)) {
$model["userid"] = $userid;
$model["progress"] = $this->scanuserprogress($userid);
$model['amteaching'] = teachingfinder::is_teaching_studyplan($this,$userid);
}
@ -604,6 +606,7 @@ class studyplan {
public static function user_structure($value = VALUE_REQUIRED) : \external_description {
return new \external_single_structure([
"id" => new \external_value(PARAM_INT, 'id of studyplan'),
"userid" => new \external_value(PARAM_INT, 'id of user the plan is shown for'),
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname" => new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"description" => new \external_value(PARAM_RAW, 'description of studyplan'),
@ -642,6 +645,7 @@ class studyplan {
$model = [
'id' => $this->r->id,
'userid' => $userid,
'name' => $this->r->name,
'shortname' => $this->r->shortname,
'description' => $this->description(),