diff --git a/entity/course_format_iena_completion.php b/entity/course_format_iena_completion.php index 25f59446aa7fe6ab433a71b07508bfbb6abfbdb5..9df796923646327bcbe58a85304cc918d12db3da 100644 --- a/entity/course_format_iena_completion.php +++ b/entity/course_format_iena_completion.php @@ -34,7 +34,7 @@ class course_format_iena_completion { * @return type */ public static function get_completion_by_section($section_names, $idSection) { - + global $COURSE, $USER, $DB, $CFG; $completion = new \completion_info($COURSE); @@ -94,7 +94,9 @@ class course_format_iena_completion { $total_modules += count($inner_modules); array_push($sections, $section); } - + if($total_modules==0){ + return false; + } $progress = new StdClass(); $progress->total = number_format( 100 * $total_completed / $total_modules, 0); $progress->sections = $sections; diff --git a/format.php b/format.php index 3b82b0591d3b1285d04e9e0dfc8045af5a5f1637..1f0c83396b48f65adaa845cdef54e69482952d2a 100644 --- a/format.php +++ b/format.php @@ -31,6 +31,7 @@ require_once($CFG->libdir . '/completionlib.php'); require_once('entity/course_format_iena_section_ressources.php'); require_once('entity/course_format_iena_sections.php'); + require_once('entity/course_format_iena_completion.php'); require_once('entity/course_format_iena_cron_action.php'); require_once('entity/course_format_iena_groups.php'); require_once('entity/course_format_iena_attendance.php'); diff --git a/renderer.php b/renderer.php index 6e3b78cf4393fb3079cdb46241e29d303f2a69f3..c33830e80ba0bb2cf6776f78baa7333c83a652e9 100644 --- a/renderer.php +++ b/renderer.php @@ -142,7 +142,7 @@ class format_iena_renderer extends format_topics_renderer{ protected function get_section_header($section, $course, $onsectionpage, $mods, $sectionreturn = null, $iena = false, $groups=false){ global $PAGE, $CFG, $COURSE, $USER; - $section_entity = new course_format_iena_sections(); + $completion_entity = new course_format_iena_completion(); $o = ''; $currenttext = ''; $sectionstyle = ''; @@ -243,6 +243,15 @@ class format_iena_renderer extends format_topics_renderer{ } + } + else{ + //On va chercher la progression pour la section + $section_progress=$completion_entity->get_completion_by_section([$section->name], [$section->id]); + if($section_progress){ + $section->section_progress=$section_progress->total; + } + + } diff --git a/styles.css b/styles.css index 00722a397d9910ea11bde2b09d4a19a89c305bfa..e234da987e530a8da6d02863199ba5d6d94ff6db 100644 --- a/styles.css +++ b/styles.css @@ -224,6 +224,12 @@ ul.nav.navbar-nav.ml-auto { font-weight: 400; } +.label_item.sect-date.prog{ + background-color:#40aca3; + font-weight: bold; + color: white; +} + .iena-description { background: #EEE; color: #323232; @@ -695,6 +701,7 @@ th.th-rotate > div > span { .section-progress span.icon-progress::after, .iena-progress-legend span.icon-progress::after{ font-size: small; + line-height: 1rem!important; } @@ -826,7 +833,7 @@ tbody th{ } #caption-iena .icon-progress::after{ - line-height: 24px; + } .iena-icon-distance, .iena-icon-presence{ diff --git a/templates/section.mustache b/templates/section.mustache index c8109e88fe8b21ac218ef8a715053dad3604f35e..bd3717d07567811bb40bbfa6c30ff491b588f00f 100644 --- a/templates/section.mustache +++ b/templates/section.mustache @@ -35,6 +35,9 @@ </a> {{/link_suivi}} + {{#section_progress}} + <div class="label_item sect-date prog" >{{section_progress}}%</div> + {{/section_progress}} </div>