Maintenance Gitlab - Jeudi 09 Décembre 2021 à partir de 10h - Mises à jour de sécurité

Commit d5909453 authored by Thomas Fradet's avatar Thomas Fradet
Browse files

minor improvement

parent 0c7aaec4
# 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
...@@ -69,7 +69,7 @@ class block_career extends block_base ...@@ -69,7 +69,7 @@ class block_career extends block_base
$active = ""; $active = "";
$this->content = new stdClass; $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 = ""; // $image = "";
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
* *
* @return array<block_career_ressource> $ressources * @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; global $DB;
$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0', array($id_section)); $requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0', array($id_section));
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
* *
* @return array<block_career_section> $sections * @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; global $DB;
......
...@@ -63,6 +63,7 @@ class view_career_setting extends moodleform ...@@ -63,6 +63,7 @@ class view_career_setting extends moodleform
// $content = "<h1>" . get_string('title_plugin', 'block_career') . "</h1>"; // $content = "<h1>" . get_string('title_plugin', 'block_career') . "</h1>";
$content = "";
$content .= "<div class='alert alert-info'>" . get_string('heading_plugin', 'block_career') . "</div>"; $content .= "<div class='alert alert-info'>" . get_string('heading_plugin', 'block_career') . "</div>";
$temp = $mform->toHtml(); $temp = $mform->toHtml();
...@@ -70,6 +71,9 @@ class view_career_setting extends moodleform ...@@ -70,6 +71,9 @@ class view_career_setting extends moodleform
$temp = substr($temp,(strpos($temp,'>')+1)); $temp = substr($temp,(strpos($temp,'>')+1));
$temp = substr($temp,0, -7); $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 .= '<div class="row"><form class="col-12" action="career_setting.php?course=' . $course . '" method="post" enctype="multipart/form-data">';
$content .= $temp; $content .= $temp;
...@@ -85,10 +89,6 @@ class view_career_setting extends moodleform ...@@ -85,10 +89,6 @@ class view_career_setting extends moodleform
<div class="subject-info-box-1"> <div class="subject-info-box-1">
<select multiple="multiple" id="lstBox1" class="form-control">'; <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) foreach ($sections as $section)
{ {
$section->ressources = block_career_ressource::get_ressources_by_id_section($section->id); $section->ressources = block_career_ressource::get_ressources_by_id_section($section->id);
...@@ -122,14 +122,15 @@ class view_career_setting extends moodleform ...@@ -122,14 +122,15 @@ class view_career_setting extends moodleform
<div class="subject-info-box-2"> <div class="subject-info-box-2">
<select multiple="multiple" id="lstBox2" name="ressource[]" class="form-control" required>'; <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) if ($careerId != 0)
{ $content .= '<option label="'.$res->name.'" value ="'.$res->id.'">';
$res = new block_career_ressource(); }
$res->get_ressource_by_id($value);
if ($careerId != 0)
$content .= '<option label="'.$res->name.'" value ="'.$res->id.'">';
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment