Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iena
iena-course-format
Commits
6f61e2f4
Commit
6f61e2f4
authored
Oct 12, 2021
by
Myriam Delaruelle
Browse files
only display uservisible activities in progress bar
parent
d3cd4adb
Changes
1
Hide whitespace changes
Inline
Side-by-side
entity/course_format_iena_completion.php
View file @
6f61e2f4
...
...
@@ -42,18 +42,6 @@ class course_format_iena_completion {
return
false
;
}
// $modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
// FROM {course_modules_completion} as cmc
// inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
// inner join {user} as u on u.id = cmc.userid
// inner join {modules} as m on m.id = cm.module
// where cm.course = ? and cm.deletioninprogress = 0
// and cmc.userid = ?
// order by section, coursemoduleid asc', array($course->id, $USER->id));
// echo "<pre>";
// var_dump($modules);
// echo "</pre>";
$sections
=
[];
...
...
@@ -65,7 +53,9 @@ class course_format_iena_completion {
$module
=
$completion
->
get_data
(
$cm
,
true
,
$USER
->
id
,
$fast_modinfo
);
$module
->
url
=
"
$CFG->wwwroot
/mod/
$cm->modname
/view.php?id=
$cm->id
"
;
$module
->
section
=
$cm
->
section
;
if
(
$cm
->
deletioninprogress
==
0
&&
$cm
->
completion
!=
0
)
{
if
(
$cm
->
deletioninprogress
==
0
&&
$cm
->
completion
!=
0
&&
$cm
->
uservisible
)
{
$module
->
name
=
$cm
->
name
;
$module
->
url
=
"
$CFG->wwwroot
/mod/
$cm->modname
/view.php?id=
$cm->id
"
;
$modules
[]
=
$module
;
}
}
...
...
@@ -81,19 +71,15 @@ class course_format_iena_completion {
$inner_modules
=
[];
$inner_completed
=
0
;
foreach
(
$modules
as
$module
)
{
if
(
$module
->
section
==
$section_id
)
{
if
(
$module
->
section
==
$section_id
)
{
$mod
=
new
StdClass
();
$mod
->
coursemoduleid
=
$module
->
coursemoduleid
;
$mod
->
completion
=
$module
->
completionstate
;
$mod
->
name
=
$module
->
name
;
$mod
->
url
=
$module
->
url
;
if
(
$mod
->
completion
==
1
||
$mod
->
completion
==
2
)
{
$inner_completed
++
;
}
foreach
(
$modinfos_cms
as
$cm
)
{
if
(
$cm
->
id
==
$mod
->
coursemoduleid
)
{
$mod
->
name
=
$cm
->
name
;
$mod
->
url
=
"
$CFG->wwwroot
/mod/
$cm->modname
/view.php?id=
$cm->id
"
;
}
}
$inner_modules
[]
=
$mod
;
}
}
...
...
@@ -111,11 +97,6 @@ class course_format_iena_completion {
$progress
=
new
StdClass
();
$progress
->
total
=
number_format
(
100
*
$total_completed
/
$total_modules
,
0
);
$progress
->
sections
=
$sections
;
// echo "<pre>";
// var_dump($progress);
// echo "</pre>";
return
$progress
;
}
...
...
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