Skip to content
Snippets Groups Projects
Commit 6f61e2f4 authored by Myriam Delaruelle's avatar Myriam Delaruelle
Browse files

only display uservisible activities in progress bar

parent d3cd4adb
No related branches found
No related tags found
Loading
...@@ -42,18 +42,6 @@ class course_format_iena_completion { ...@@ -42,18 +42,6 @@ class course_format_iena_completion {
return false; 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 = []; $sections = [];
...@@ -65,7 +53,9 @@ class course_format_iena_completion { ...@@ -65,7 +53,9 @@ class course_format_iena_completion {
$module = $completion->get_data($cm, true, $USER->id, $fast_modinfo); $module = $completion->get_data($cm, true, $USER->id, $fast_modinfo);
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id"; $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$module->section = $cm->section; $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; $modules[] = $module;
} }
} }
...@@ -81,19 +71,15 @@ class course_format_iena_completion { ...@@ -81,19 +71,15 @@ class course_format_iena_completion {
$inner_modules = []; $inner_modules = [];
$inner_completed = 0; $inner_completed = 0;
foreach ($modules as $module) { foreach ($modules as $module) {
if ( $module->section == $section_id ) { if ( $module->section == $section_id) {
$mod = new StdClass(); $mod = new StdClass();
$mod->coursemoduleid = $module->coursemoduleid; $mod->coursemoduleid = $module->coursemoduleid;
$mod->completion = $module->completionstate; $mod->completion = $module->completionstate;
$mod->name = $module->name;
$mod->url = $module->url;
if ( $mod->completion == 1 || $mod->completion == 2 ) { if ( $mod->completion == 1 || $mod->completion == 2 ) {
$inner_completed++; $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; $inner_modules[] = $mod;
} }
} }
...@@ -111,11 +97,6 @@ class course_format_iena_completion { ...@@ -111,11 +97,6 @@ class course_format_iena_completion {
$progress = new StdClass(); $progress = new StdClass();
$progress->total = number_format( 100 * $total_completed / $total_modules, 0); $progress->total = number_format( 100 * $total_completed / $total_modules, 0);
$progress->sections = $sections; $progress->sections = $sections;
// echo "<pre>";
// var_dump($progress);
// echo "</pre>";
return $progress; return $progress;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment