diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c7eedded6e27a47c4e49f1b4c89493416aebc1c..843b92506f1c3a6d1b09752554404b1456eef037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ -# 19/02/19 +# 27/05/2019 + +## Bugs divers + +### Vue du block + +#### 1 + +[x] Notice PHP propriété non définie pour la génération de l'interface du block. + +#### 2 + +Notice: Undefined variable: content in /Applications/MAMP/htdocs/moodle37/blocks/career/view/view_career_setting.php on line 66 + +[x] Instantiation de $content avant une concaténation. + +### Vue settings + +#### 3 + +Deprecated: Non-static method block_career_section::get_sections_by_id_course() should not be called statically in /Applications/MAMP/htdocs/moodle37/blocks/career/view/view_career_setting.php on line 89 + +[x] La méthode est déclarée static + +#### 4 + +Deprecated: Non-static method block_career_ressource::get_ressources_by_id_section() should not be called statically in /Applications/MAMP/htdocs/moodle37/blocks/career/view/view_career_setting.php on line 95 + +[x] La méthode est déclarée static + diff --git a/block_career.php b/block_career.php index f839e5bc10237e4a1c1c9f34f2dfa9d787c50a1a..845f6c7ca71050b7b5b688da23460cdd8f8bbdad 100644 --- a/block_career.php +++ b/block_career.php @@ -69,7 +69,7 @@ class block_career extends block_base $active = ""; $this->content = new stdClass; - $this->content->text .= '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $COURSE->id . '" class="btn btn-success btn-career-block mb-3">Accueil du cours</a>'; + $this->content->text = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $COURSE->id . '" class="btn btn-success btn-career-block mb-3">Accueil du cours</a>'; // $image = ""; diff --git a/entity/block_career_ressource.php b/entity/block_career_ressource.php index 3a206676de4d64b01415c30ab9d0fdd5fde9493d..773a7145b64f2a2a4dd7f3d6e5149cbc7ec97663 100644 --- a/entity/block_career_ressource.php +++ b/entity/block_career_ressource.php @@ -76,7 +76,7 @@ * * @return array<block_career_ressource> $ressources */ - public function get_ressources_by_id_section($id_section) + public static function get_ressources_by_id_section($id_section) { global $DB; $requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0', array($id_section)); diff --git a/entity/block_career_section.php b/entity/block_career_section.php index a230abba0129e67beefe6bba5c84a15d57bcce2f..c0fc1b2e59d06ec0bd4ecb65b0bc4915b316c656 100644 --- a/entity/block_career_section.php +++ b/entity/block_career_section.php @@ -58,7 +58,7 @@ * * @return array<block_career_section> $sections */ - public function get_sections_by_id_course($id_course) + public static function get_sections_by_id_course($id_course) { global $DB; diff --git a/view/view_career_setting.php b/view/view_career_setting.php index 26d06de6f69085bbdd68a7170a29cc9a9fafa449..796ff15ebf4f988dc7658426935c24032cacbfff 100644 --- a/view/view_career_setting.php +++ b/view/view_career_setting.php @@ -63,6 +63,7 @@ class view_career_setting extends moodleform // $content = "<h1>" . get_string('title_plugin', 'block_career') . "</h1>"; + $content = ""; $content .= "<div class='alert alert-info'>" . get_string('heading_plugin', 'block_career') . "</div>"; $temp = $mform->toHtml(); @@ -70,6 +71,9 @@ class view_career_setting extends moodleform $temp = substr($temp,(strpos($temp,'>')+1)); $temp = substr($temp,0, -7); + + $sections = block_career_section::get_sections_by_id_course($course); + $content .= '<div class="row"><form class="col-12" action="career_setting.php?course=' . $course . '" method="post" enctype="multipart/form-data">'; $content .= $temp; @@ -85,10 +89,6 @@ class view_career_setting extends moodleform <div class="subject-info-box-1"> <select multiple="multiple" id="lstBox1" class="form-control">'; - $sections = block_career_section::get_sections_by_id_course($course); - - // var_dump($sections); - foreach ($sections as $section) { $section->ressources = block_career_ressource::get_ressources_by_id_section($section->id); @@ -122,14 +122,15 @@ class view_career_setting extends moodleform <div class="subject-info-box-2"> <select multiple="multiple" id="lstBox2" name="ressource[]" class="form-control" required>'; + if ($ressourcesId != "") { + foreach ($ressourcesId as $value) + { + $res = new block_career_ressource(); + $res->get_ressource_by_id($value); - foreach ($ressourcesId as $value) - { - $res = new block_career_ressource(); - $res->get_ressource_by_id($value); - - if ($careerId != 0) - $content .= '<option label="'.$res->name.'" value ="'.$res->id.'">'; + if ($careerId != 0) + $content .= '<option label="'.$res->name.'" value ="'.$res->id.'">'; + } }