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

Bouton de suivi étudiant dans le header des sections

parent b6908e60
No related branches found
No related tags found
No related merge requests found
...@@ -136,7 +136,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -136,7 +136,7 @@ class format_iena_renderer extends format_topics_renderer{
* @param type|bool $iena * @param type|bool $iena
* @return type * @return type
*/ */
protected function get_section_header($section, $course, $onsectionpage, $sectionreturn = null, $iena = false){ protected function get_section_header($section, $course, $onsectionpage, $sectionreturn = null, $iena = false, $groups=false){
global $PAGE, $CFG, $COURSE, $USER; global $PAGE, $CFG, $COURSE, $USER;
$section_entity = new course_format_iena_sections(); $section_entity = new course_format_iena_sections();
...@@ -170,8 +170,6 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -170,8 +170,6 @@ class format_iena_renderer extends format_topics_renderer{
/* Paramètres */ /* Paramètres */
$presence = ""; $presence = "";
//$param_section = $section_entity->get_section_settings_by_id_section($section->id);
$format = course_get_format($course); $format = course_get_format($course);
$param_section = (object)$format->get_format_options($section); $param_section = (object)$format->get_format_options($section);
...@@ -188,12 +186,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -188,12 +186,7 @@ class format_iena_renderer extends format_topics_renderer{
} }
if (isset($param_section->daterendu) && $param_section->daterendu != 0) { if (isset($param_section->daterendu) && $param_section->daterendu != 0) {
//$section->dateUp = date_create($param_section->date_rendu);
$section->dateUp = new DateTime("@$param_section->daterendu"); $section->dateUp = new DateTime("@$param_section->daterendu");
//$section->dateUp = $unformattedDate;
$section->date = $section->dateUp->format("j/m H:i"); $section->date = $section->dateUp->format("j/m H:i");
$section->date_jour = $section->dateUp->format("j/m"); $section->date_jour = $section->dateUp->format("j/m");
$section->date_heure = $section->dateUp->format("H:i"); $section->date_heure = $section->dateUp->format("H:i");
...@@ -211,8 +204,22 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -211,8 +204,22 @@ class format_iena_renderer extends format_topics_renderer{
$section->date = ""; $section->date = "";
} }
if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id)) { //Bouton de suivi dans chaque section : si pas d'activités suivies on n'affiche pas le bouton
$section->link_param = $CFG->wwwroot . "/course/format/iena/param_section.php?courseid=" . $COURSE->id . "&sectionid=" . $section->id; if (has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)) {
$ressources_entity = new course_format_iena_section_ressources();
$modules = $ressources_entity->get_ressources_completion_on_by_id_section($section->id);
$nb_modules = count($modules);
if($nb_modules>0){
//si trop d'étudiants on va afficher le premier groupe dans le suivi
if($this->count_students($context)>299 && count($groups)>0){
$section->link_suivi = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id . "&sectionid=" . $section->id . "&groupid=".reset($groups)->id;
}
else{
$section->link_suivi = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id . "&sectionid=" . $section->id . "&groupid=0";
}
}
} }
...@@ -395,7 +402,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -395,7 +402,7 @@ class format_iena_renderer extends format_topics_renderer{
// fin recommenté // fin recommenté
// $groups = []; // $groups = [];
// var_dump($groups);
//$students_group = $course_format_iena_groups_instance->get_students_group($course->id); //$students_group = $course_format_iena_groups_instance->get_students_group($course->id);
...@@ -550,7 +557,6 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -550,7 +557,6 @@ class format_iena_renderer extends format_topics_renderer{
// } else if ($tab_section_indicateur[$section_ligne->id] == NULL) { // } else if ($tab_section_indicateur[$section_ligne->id] == NULL) {
// $tab_section_indicateur[$section_ligne->id] = 0; // $tab_section_indicateur[$section_ligne->id] = 0;
// } // }
// // var_dump($tab_section_indicateur[$section_ligne->id]);
// } // }
// $tab_group_indicateur['id_groupe0']=$tab_section_indicateur; // $tab_group_indicateur['id_groupe0']=$tab_section_indicateur;
// $view = ""; // $view = "";
...@@ -704,11 +710,6 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -704,11 +710,6 @@ class format_iena_renderer extends format_topics_renderer{
$view .= "<div class='iena-percent set_height'>" . $cpl->sections[$i]->completion . "%</div>"; $view .= "<div class='iena-percent set_height'>" . $cpl->sections[$i]->completion . "%</div>";
} }
// if ($compl_by_section != 999 && $completion->is_enabled()) { // if ($compl_by_section != 999 && $completion->is_enabled()) {
// $view .= "<div class=\"iena-percent set_height\"> // $view .= "<div class=\"iena-percent set_height\">
// " . floor($compl_by_section) . "% // " . floor($compl_by_section) . "%
...@@ -716,25 +717,18 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -716,25 +717,18 @@ class format_iena_renderer extends format_topics_renderer{
// } // }
// if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) { // if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) {
if (has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) { if (has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) {
$course_groups = groups_get_all_groups($COURSE->id); $course_groups = groups_get_all_groups($COURSE->id);
// var_dump($course_groups->id);
$group_indicateur = 0; $group_indicateur = 0;
$view .= "<a href='$link&sectionid=".$idSection[$i]."' style=\"color : white\">"; $view .= "<a href='$link&sectionid=".$idSection[$i]."style='color : white'>";
$view .="<div onclick='change_grouplink(this)' style=\"display:block;\" class=\"nb_pers set_height id_groupe0\">"; $view .="<div onclick='change_grouplink(this)' style='display:block' class='nb_pers set_height id_groupe0'>";
$view .= "Suivi étudiants"; $view .= "Suivi étudiants";
$view .= "</div>"; $view .= "</div>";
...@@ -752,9 +746,6 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -752,9 +746,6 @@ class format_iena_renderer extends format_topics_renderer{
// id_groupeXXX // id_groupeXXX
// var_dump($course_groups);
// var_dump($idSection[$i]);
// foreach($tab_group_indicateur as $group_indicateur => $val) { // foreach($tab_group_indicateur as $group_indicateur => $val) {
// $view .="<div onclick='change_grouplink(this)' style=\"display:none;\" class=\"nb_pers set_height ".$group_indicateur."\">"; // $view .="<div onclick='change_grouplink(this)' style=\"display:none;\" class=\"nb_pers set_height ".$group_indicateur."\">";
...@@ -890,7 +881,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -890,7 +881,7 @@ class format_iena_renderer extends format_topics_renderer{
echo $this->render_from_template('format_iena/course-header', $course_infos); echo $this->render_from_template('format_iena/course-header', $course_infos);
$i = 0; $i = 0;
$link = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id; //$link = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id;
...@@ -984,13 +975,14 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -984,13 +975,14 @@ class format_iena_renderer extends format_topics_renderer{
public function count_students(){ public function count_students($context){
$count = count_enrolled_users($COURSE->id); $count = count_enrolled_users($context);
echo "on compte les étudiants";
return $count; return $count;
} }
public function print_iena_section_pages($course){ public function print_iena_section_pages($course){
global $PAGE, $USER; global $PAGE, $USER;
...@@ -1026,7 +1018,6 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1026,7 +1018,6 @@ class format_iena_renderer extends format_topics_renderer{
$numsections = course_get_format($course)->get_last_section_number(); $numsections = course_get_format($course)->get_last_section_number();
// var_dump($numsections);
// if ($section > $numsections) { // if ($section > $numsections) {
// // if ($section > $course->numsections) { // // if ($section > $course->numsections) {
// // continue; // // continue;
...@@ -1085,8 +1076,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1085,8 +1076,7 @@ class format_iena_renderer extends format_topics_renderer{
//A ce stade on à toutes les activité déja prête en HTML par contre il manque le nom des sections //A ce stade on à toutes les activité déja prête en HTML par contre il manque le nom des sections
// Il se trouve dans : $thissection->name // Il se trouve dans : $thissection->name
//var_dump($htmlsection);
//var_dump($htmlsection0);
if ($PAGE->user_is_editing()) { if ($PAGE->user_is_editing()) {
// echo $completioninfo->display_help_icon(); // echo $completioninfo->display_help_icon();
echo $this->output->heading($this->page_title(), 2, 'accesshide'); echo $this->output->heading($this->page_title(), 2, 'accesshide');
...@@ -1148,6 +1138,8 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1148,6 +1138,8 @@ class format_iena_renderer extends format_topics_renderer{
$context = context_course::instance($course->id); $context = context_course::instance($course->id);
$course = course_get_format($course)->get_course(); $course = course_get_format($course)->get_course();
$completion = new \completion_info($course); $completion = new \completion_info($course);
$groups=groups_get_all_groups($course->id);
$modinfo = get_fast_modinfo($course); $modinfo = get_fast_modinfo($course);
...@@ -1170,7 +1162,6 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1170,7 +1162,6 @@ class format_iena_renderer extends format_topics_renderer{
//var_dump($modinfo->get_section_info_all());
foreach($modinfo->get_section_info_all() as $section => $thissection){ foreach($modinfo->get_section_info_all() as $section => $thissection){
if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) { if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) {
...@@ -1178,8 +1169,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1178,8 +1169,7 @@ class format_iena_renderer extends format_topics_renderer{
continue; continue;
} }
if (!$thissection->available && !empty($thissection->availableinfo)) { if (!$thissection->available && !empty($thissection->availableinfo)) {
echo "par là"; $thissection= $this->get_section_header($thissection, $course, false, 0, $groups);
$thissection= $this->get_section_header($thissection, $course, false, 0);
continue; continue;
} }
...@@ -1189,7 +1179,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1189,7 +1179,7 @@ class format_iena_renderer extends format_topics_renderer{
continue; continue;
} }
} }
$thissection=$this->get_section_header($thissection, $course, false, 0, true); $thissection=$this->get_section_header($thissection, $course, false, 0, true, $groups);
if ($thissection->uservisible) { if ($thissection->uservisible) {
......
...@@ -178,10 +178,12 @@ ul.nav.navbar-nav.ml-auto { ...@@ -178,10 +178,12 @@ ul.nav.navbar-nav.ml-auto {
float: right; float: right;
min-width: 4rem; min-width: 4rem;
padding: .6rem .6rem; padding: .6rem .6rem;
font-size: 1rem; font-size: 14px ;
border-radius: 5px; border-radius: 5px;
margin-top: 0.4rem; margin-top: 0.35rem;
margin-right: 0.4rem; line-height: 0.5rem;
margin-right: .4rem;
margin-left: .4rem;
} }
.nb_pers a { .nb_pers a {
color: white; color: white;
......
...@@ -15,13 +15,24 @@ ...@@ -15,13 +15,24 @@
{{string_date}} {{string_date}}
</div> </div>
{{/string_date}} {{/string_date}}
{{#link_param}}
<div class="titre_section set_height"> {{#link_suivi}}
<a href='{{link_suivi}}' style='color : white'>
<div style="display:block;" class="nb_pers set_height id_groupe0">Suivi étudiant</div>
</a>
{{/link_suivi}}
<!-- Not used anymore : c'était pour le formulaire avant-->
{{! #link_param}}
<!-- <div class="titre_section set_height">
<a href={{link_param}} style="color : white"> <a href={{link_param}} style="color : white">
<i class="fa fa-cog " aria-hidden="true" ></i> <i class="fa fa-cog " aria-hidden="true" ></i>
</a> </a>
</div> </div>-->
{{/link_param}} {{! /link_param}}
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment