diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f900e28bc6fc948a353e9e89be8c8d69b7c396..886cdcb88369c3fbb214dc72ba214371755bce01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -177,6 +177,61 @@ Commenté : sert à rien et la property n'existe pas. Pas présent dans le code [x] Solved. +## 7 +Notice: Undefined property: stdClass::$sectionposition in /Applications/MAMP/htdocs/moodle37/course/format/iena/renderer.php on line 836 +Property sectionposition non définie dans une condition qui de plus requiert isset d'une variable non instanciée (code commenté). Dans le test d'une condition pour echo justement cette variable non instanciée (=== NULL). + +La condition et l'echo qu'elle contient sont commentés. + +[x] Solved. + +## 8 + +Notice: Undefined variable: completion_total in /Applications/MAMP/htdocs/moodle37/course/format/iena/view/view_course_header.php on line 13 + +Instantiation d'une propriété de la classe view_course_header d'après une variable n'existant pas en paramètre du constructeur. Cette propriété n'est plus utilisée (code commenté). + +La création de la propriété devenue inutile est commentée. + +[x] Solved. + +## 9 + +Notice: Undefined variable: USER in /Applications/MAMP/htdocs/moodle37/course/format/iena/view/view_course_header.php on line 370 + +Ajout de la global $USER dans la méthode. + +[x] Solved. + +## 10 + +Notice: Undefined variable: view in /Applications/MAMP/htdocs/moodle37/course/format/iena/renderer.php on line 413 + +Instanciation de la variable $view = ""; + +[x] Solved. + +## 11 + +Notice: Trying to get property 'presence' of non-object in /Applications/MAMP/htdocs/moodle37/course/format/iena/renderer.php on line 511 + +ET + +Idem pour date_rendu juste en dessous. + +Ajout d'une condition que la variable contenant l'objet ne soit pas === false dans le cas où aucun paramètre n'a été réglé pour la section (date, modalité, notifications). Sinon ce n'est pas un objet, mais false. + +[x] Solved. + +## 12 + +Notice: Undefined variable: date in /Applications/MAMP/htdocs/moodle37/course/format/iena/renderer.php on line 622 + +Après le correctif #11, une variable instanciée uniquement dans la condition où $param_section n'est pas false ne l'est plus quand il n'y a aucun paramétrage existant pour la section. + +Ajout d'un else à la condition pour que $date soit toujours instancié. + +[x] Solved. diff --git a/renderer.php b/renderer.php index a62b52e8aa629410bd02f512a0eee6276d4e8f0a..48ffcaa36fe6296db25fa7c5b46a24203e951a8c 100644 --- a/renderer.php +++ b/renderer.php @@ -405,6 +405,8 @@ // nouvelle génération du header + $view = ""; + require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_completion.php'); $cpl = course_format_iena_completion::get_completion_by_section($nameSection, $idSection); @@ -506,20 +508,25 @@ foreach ($htmlsection as $section) { continue; } $param_section = $section_entity->get_section_settings_by_id_section($idSection[$i]); - if ($param_section->presence && $i != 0) { - if ($param_section->presence == 1) { - $presence = "En présence"; - } else if ($param_section->presence == 2) { - $presence = "A distance"; + // dates, modality and notification section parameters : false if not set. + if ($param_section !== false) { + if ($param_section->presence && $i != 0) { + if ($param_section->presence == 1) { + $presence = "En présence"; + } else if ($param_section->presence == 2) { + $presence = "A distance"; + } } - } - if ($param_section->date_rendu) { - $dateUp = date_create($param_section->date_rendu); - $date = $dateUp->format("j/m H:i"); - $date_jour = $dateUp->format("j/m"); - $date_heure = $dateUp->format("H:i"); - $dateUp = $dateUp->getTimestamp(); + if ($param_section->date_rendu) { + $dateUp = date_create($param_section->date_rendu); + $date = $dateUp->format("j/m H:i"); + $date_jour = $dateUp->format("j/m"); + $date_heure = $dateUp->format("H:i"); + $dateUp = $dateUp->getTimestamp(); + } else { + $date = ""; + } } else { $date = ""; } @@ -831,11 +838,11 @@ public function print_iena_section_pages($course) echo $this->start_section_list(); } - if ($course->sectionposition == 0 and isset($htmlsection0)) { - if ($PAGE->user_is_editing()){ - echo html_writer::tag('span', $htmlsection0, ['class' => 'above']); - } - } + // if ($course->sectionposition == 0 and isset($htmlsection0)) { + // if ($PAGE->user_is_editing()){ + // echo html_writer::tag('span', $htmlsection0, ['class' => 'above']); + // } + // } //echo $this->get_button_section($course, $sectionvisible); //here all activities are displayed //If we are in etition mode then we display the "BASE" page Otherwise our model diff --git a/view/view_course_header.php b/view/view_course_header.php index 043cd74c84f8c2379d3b6b14ae05354b462e21c8..39018048be165b859919f6e5fa4cdaf88321070d 100644 --- a/view/view_course_header.php +++ b/view/view_course_header.php @@ -10,7 +10,7 @@ class view_course_header { $this->section_names = $section_names; $this->idSection = $idSection; - $this->completion_total = $completion_total; + // $this->completion_total = $completion_total; $this->course = $course; $this->create_view($progress); } @@ -338,7 +338,7 @@ class view_course_header { private function set_html($infos) { - global $CFG, $COURSE; + global $CFG, $COURSE, $USER; // $css = file_get_contents( $CFG->wwwroot.'/course/format/iena/course-header.css' ); // $this->_content .= '<style>'.$css.'</style>';