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
14852059
Verified
Commit
14852059
authored
Jun 17, 2020
by
David Beniamine
Browse files
WIP : add new calls
+ Delete teamconfig + Get number of started reports
parent
15b43120
Changes
2
Hide whitespace changes
Inline
Side-by-side
classes/fetch/user.php
View file @
14852059
...
...
@@ -42,6 +42,23 @@ class user extends moodlefetcher
return
$this
->
fetch
(
'GET'
,
'/v1/teamconfig/'
.
$teamconfigId
);
}
/**
* @return int
*/
public
function
getNumStartedReports
(
$teamconfigId
)
{
return
$this
->
fetch
(
'GET'
,
'/v1/teamconfig/'
.
$teamconfigId
.
'/countStartedReports'
);
}
/**
* deletes a teamconfig
* @return boolean
*/
public
function
deleteTeamconfig
(
$teamconfigId
)
{
return
$this
->
fetch
(
'POST'
,
'/v1/teamconfig/'
.
$teamconfigId
.
'/delete'
);
}
/**
* Give a teacher a tutor access to these LnB missions and classes, if it does not exist yet.
*
...
...
lib.php
View file @
14852059
...
...
@@ -141,13 +141,17 @@ function labnbook_delete_instance($id)
{
global
$DB
;
$exists
=
$DB
->
get_record
(
LABNBOOK_TABLE
,
[
'id'
=>
$id
]);
if
(
!
$exists
)
{
$record
=
$DB
->
get_record
(
LABNBOOK_TABLE
,
[
'id'
=>
$id
]);
if
(
!
$record
)
{
return
false
;
}
$fetcher
=
new
fetch\user
();
if
(
!
$fetcher
->
deleteTeamconfig
(
$record
->
labnbook_teamconfigid
))
{
throw
new
moodle_exception
(
"Cannot delete teamconfig : some students have started to work."
);
return
false
;
}
$DB
->
delete_records
(
LABNBOOK_TABLE
,
[
'id'
=>
$id
]);
return
true
;
}
/**
...
...
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