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: {
type: String, type: String,
default() { return "own";}, default() { return "own";},
} },
}, },
data() { data() {
return { return {
@ -457,12 +457,12 @@ export default {
}, },
guestmode: { guestmode: {
type: Boolean, type: Boolean,
default: false, default() { return false;},
}, },
teachermode: { teachermode: {
type: Boolean, type: Boolean,
default: false, default() { return false;},
} },
}, },
data() { data() {
return { return {

View File

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