Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LabNbook
LabNbook-Moodle
Commits
73534e1a
Commit
73534e1a
authored
Oct 31, 2019
by
Francois Gannaz
Browse files
labnbook_update_instance() calls LnB
parent
507e9990
Changes
2
Hide whitespace changes
Inline
Side-by-side
classes/fetch/user.php
View file @
73534e1a
...
...
@@ -50,6 +50,8 @@ class user extends moodlefetcher
}
/**
* Use a LnB mission in a Moodle activity.
*
* @param int $missionId
* @param int $courseId
* @param int|null $groupId
...
...
@@ -65,6 +67,25 @@ class user extends moodlefetcher
->
data
->
team_config
;
}
/**
* Update the team config of a Moodle-LnB activity.
*
* @param int $missionId
* @param int $teamconfigId
* @param int $courseId
* @param int|null $groupId
* @return object teamconfig
*/
public
function
updateMissionUse
(
int
$missionId
,
int
$teamconfigId
,
int
$courseId
,
int
$groupId
=
null
)
{
return
$this
->
fetch
(
'POST'
,
"/v1/mission/
$missionId
/use"
,
[
'team_config_id'
=>
$teamconfigId
,
'courseid'
=>
$courseId
,
'groupid'
=>
$groupId
]
)
->
data
->
team_config
;
}
/**
* Return the JS code that fetches the missions.
*
...
...
lib.php
View file @
73534e1a
...
...
@@ -80,6 +80,15 @@ function labnbook_update_instance($moduleinstance, $mform = null) {
$moduleinstance
->
timemodified
=
time
();
$moduleinstance
->
id
=
$moduleinstance
->
instance
;
$fetcher
=
new
fetch\user
();
$courseid
=
(
int
)
$moduleinstance
->
course
;
$groupid
=
(
int
)
$moduleinstance
->
groupmode
===
0
?
null
:
(
int
)
$moduleinstance
->
group
;
try
{
$fetcher
->
updateMissionUse
(
$moduleinstance
->
labnbook_missionid
,
$moduleinstance
->
labnbook_teamconfigid
,
$courseid
,
$groupid
);
}
catch
(
\
Exception
$e
)
{
die
(
"fatal error: "
.
$e
->
getMessage
());
// TODO
}
return
$DB
->
update_record
(
LABNBOOK_TABLE
,
$moduleinstance
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment