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
07743ad7
Commit
07743ad7
authored
Mar 26, 2019
by
Francois Gannaz
Browse files
view: fix confusion coursemodule/moduleinstance
parent
af9206d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
view.php
View file @
07743ad7
...
...
@@ -23,13 +23,13 @@ $id = optional_param('id', 0, PARAM_INT);
$l
=
optional_param
(
'l'
,
0
,
PARAM_INT
);
if
(
$id
)
{
$cm
=
get_coursemodule_from_id
(
LABNBOOK_TABLE
,
$id
,
0
,
false
,
MUST_EXIST
);
$cm
=
get_coursemodule_from_id
(
"labnbook"
,
$id
,
0
,
false
,
MUST_EXIST
);
$course
=
$DB
->
get_record
(
'course'
,
array
(
'id'
=>
$cm
->
course
),
'*'
,
MUST_EXIST
);
$moduleinstance
=
$DB
->
get_record
(
LABNBOOK_TABLE
,
array
(
'id'
=>
$cm
->
instance
),
'*'
,
MUST_EXIST
);
}
else
if
(
$l
)
{
$moduleinstance
=
$DB
->
get_record
(
LABNBOOK_TABLE
,
array
(
'id'
=>
$
n
),
'*'
,
MUST_EXIST
);
$moduleinstance
=
$DB
->
get_record
(
LABNBOOK_TABLE
,
array
(
'id'
=>
$
l
),
'*'
,
MUST_EXIST
);
$course
=
$DB
->
get_record
(
'course'
,
array
(
'id'
=>
$moduleinstance
->
course
),
'*'
,
MUST_EXIST
);
$cm
=
get_coursemodule_from_instance
(
LABNBOOK_TABLE
,
$moduleinstance
->
id
,
$course
->
id
,
false
,
MUST_EXIST
);
$cm
=
get_coursemodule_from_instance
(
"labnbook"
,
$moduleinstance
->
id
,
$course
->
id
,
false
,
MUST_EXIST
);
}
else
{
print_error
(
get_string
(
'missingidandcmid'
,
mod_labnbook
));
}
...
...
@@ -66,7 +66,7 @@ if (has_capability('moodle/course:manageactivities', context_course::instance($c
$groupids
=
groups_get_user_groups
(
$cm
->
course
)[
0
];
$teamconfig
=
teamconfig
::
findForGroups
(
$cm
->
id
,
$groupids
);
if
(
$teamconfig
->
method
===
teamconfig
::
METHOD_STUDENTCHOICE
)
{
redirect
(
'/mod/labnbook/teamchoice.php?l='
.
(
int
)
$m
oduleinstance
->
instance
);
redirect
(
'/mod/labnbook/teamchoice.php?l='
.
(
int
)
$
c
m
->
instance
);
return
;
}
else
if
(
$teamconfig
->
method
===
teamconfig
::
METHOD_TEACHERCHOICE
)
{
// TODO: warn the teacher that this student lacks a team
...
...
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