Commit aeaf3a5b authored by Thomas Fradet's avatar Thomas Fradet

bugs divers

parent c9080116
...@@ -286,6 +286,34 @@ NaN dans le tableau d'achèvement quand pas d'activité dans la section (divisio ...@@ -286,6 +286,34 @@ NaN dans le tableau d'achèvement quand pas d'activité dans la section (divisio
Le nombre d'activité est vérifié pour afficher 0 s'il n'y a pas d'activité. Le nombre d'activité est vérifié pour afficher 0 s'il n'y a pas d'activité.
[x] Solved.
### Paramétrage d'une section (date, modalité, etc.)
#### 15
Notice: Trying to get property 'date_rendu' of non-object in /Applications/MAMP/htdocs/moodle37/course/format/iena/view/view_param_section.php on line 85
Et autres erreur du même genre.
Raison : pas d'enregistrement existant pour cette section, donc le formulaire est rempli sur la base d'un objet qui n'existe pas (===false).
Des conditions sont ajoutées pour tester la présence de paramètres existants et agit en conséquence pour préremplir ou non le formulaire.
Suppression de la partie inutilisée du formulaire qui était utilisée pour cacher la section avant une certaine date.
[x] Solved.
#### 16
Erreurs lors du post du formulaire d'enregistrement des paramètres d'une section.
## Améliorations ## Améliorations
### Suivi des étudiants ### Suivi des étudiants
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
public function get_content($course, $dataSection) public function get_content($course, $dataSection)
{ {
global $DB, $CFG, $PAGE; global $DB, $CFG, $PAGE;
$mform = $this->_form; $mform = $this->_form;
$sectionId = required_param('sectionid', PARAM_INT); $sectionId = required_param('sectionid', PARAM_INT);
$courseID = required_param('courseid', PARAM_INT); $courseID = required_param('courseid', PARAM_INT);
...@@ -82,187 +82,163 @@ ...@@ -82,187 +82,163 @@
$mform->setDefault('summary', array('text' => $description)); $mform->setDefault('summary', array('text' => $description));
$mform->addElement('date_time_selector', 'date_iena', 'Date'); $mform->addElement('date_time_selector', 'date_iena', 'Date');
$dateUp = date_create($dataSection->date_rendu); if ($dataSection == false) {
$dateUp = date_create();
} else {
$dateUp = date_create($dataSection->date_rendu);
}
$mform->setDefault('date_iena', $dateUp->getTimestamp()); $mform->setDefault('date_iena', $dateUp->getTimestamp());
$mform->addElement('checkbox', 'date_render', get_string('form_not_defined', 'format_iena')); $mform->addElement('checkbox', 'date_render', get_string('form_not_defined', 'format_iena'));
if (!$dataSection->date_rendu) { if ($dataSection == false) {
$mform->setDefault('date_render', '1'); $mform->setDefault('date_render', true);
} else {
$mform->setDefault('date_render', false);
} }
//Adding elements to the form not included in moodle //Adding elements to the form not included in moodle
// <script src=\"".$CFG->wwwroot."/course/format/iena/js/param_section.js\"></script> // <script src=\"".$CFG->wwwroot."/course/format/iena/js/param_section.js\"></script>
$content = " $content = "
<h1>" . get_string('settings_section_form', 'format_iena') . " : " . $name . "</h1> <h1>" . get_string('settings_section_form', 'format_iena') . " : " . $name . "</h1>
<form class=\"form-horizontal\" action=\"param_section.php?courseid=" . $courseID . "&sectionid=" . $sectionId . "\" method=\"post\"> <form class=\"form-horizontal\" action=\"param_section.php?courseid=" . $courseID . "&sectionid=" . $sectionId . "\" method=\"post\">
<fieldset> <fieldset>
<div class=\"form-group\">"; <div class=\"form-group\">";
$temp = $mform->toHtml(); $temp = $mform->toHtml();
//Supprime le <form> //Supprime le <form>
$temp = substr($temp, (strpos($temp, '>') + 1)); $temp = substr($temp, (strpos($temp, '>') + 1));
$temp = substr($temp, 0, -7); $temp = substr($temp, 0, -7);
$content .= $temp; $content .= $temp;
$content .= " $content .= "
<div class=\"row\"> <div class=\"row\">
<!-- Multiple Radios --> <!-- Multiple Radios -->
<br> <br>
<label class=\"col-md-3 control-label\" for=\"radios\">" . get_string('modalite', 'format_iena') . "</label> <label class=\"col-md-3 control-label\" for=\"radios\">" . get_string('modalite', 'format_iena') . "</label>
<div class=\"col-md-4\"> <div class=\"col-md-4\">
<div class=\"radio\"> <div class=\"radio\">
<label for=\"radios-0\"> <label for=\"radios-0\">
<input type=\"radio\" name=\"presence\" id=\"presence-0\" value=\"1\" "; <input type=\"radio\" name=\"presence\" id=\"presence-0\" value=\"1\" ";
if ($dataSection->presence == 1) $content .= "checked=\"checked\""; if ($dataSection != false && $dataSection->presence == 1) {
$content .= "> $content .= "checked=\"checked\"";
" . get_string('in_presence', 'format_iena') . " }
$content .= ">
" . get_string('in_presence', 'format_iena') . "
</label> </label>
</div> </div>
<div class=\"radio\"> <div class=\"radio\">
<label for=\"radios-1\"> <label for=\"radios-1\">
<input type=\"radio\" name=\"presence\" id=\"presence-1\" value=\"2\" "; <input type=\"radio\" name=\"presence\" id=\"presence-1\" value=\"2\" ";
if ($dataSection->presence == 2) $content .= "checked=\"checked\""; if ($dataSection != false && $dataSection->presence == 2) {
$content .= "> $content .= "checked=\"checked\"";
" . get_string('not_presence', 'format_iena') . " }
$content .= ">
" . get_string('not_presence', 'format_iena') . "
</label> </label>
</div> </div>
<div class=\"radio\"> <div class=\"radio\">
<label for=\"radios-1\"> <label for=\"radios-1\">
<input type=\"radio\" name=\"presence\" id=\"presence-2\" value=\"0\" "; <input type=\"radio\" name=\"presence\" id=\"presence-2\" value=\"0\" ";
if (!$dataSection->presence) $content .= "checked=\"checked\""; if ($dataSection == false) {
$content .= "> $content .= "checked=\"checked\"";
" . get_string('form_not_defined', 'format_iena') . " }
$content .= ">
" . get_string('form_not_defined', 'format_iena') . "
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<!-- Multiple Checkboxes --> <!-- Multiple Checkboxes -->
<div class=\"\"> <div class=\"\">
<div class=\"form-group row\"> <div class=\"form-group row\">
<div class=\"col-md-3\"> <div class=\"col-md-3\">
<label class=\"control-label\" for=\"checkboxes\">" . get_string('notif', 'format_iena') . "</label> <label class=\"control-label\" for=\"checkboxes\">" . get_string('notif', 'format_iena') . "</label>
<p style=\"font-size: 12px;\">" . get_string('notif_summary', 'format_iena') . "</p> <p style=\"font-size: 12px;\">" . get_string('notif_summary', 'format_iena') . "</p>
</div>
<div class=\"col-md-6\" style=\"padding-top: 30px;\">
<div class=\"checkbox\">
<label for=\"day_before\">
<input type=\"checkbox\" name=\"day_before\" id=\"day_before\" value=\"1\" ";
if ($dataSection->day_before == 1) $content .= "checked=\"checked\"";
$content .= ">" . get_string('days_before', 'format_iena') . " :
<select class=\"form-control\" style=\"width: 55px; display: inline;\" id=\"nb_days_before\" name =\"nb_days_before\">
<option ";
if ($dataSection->nb_days_before == 1) $content .= "selected=\"selected\"";
$content .= " >1</option>
<option ";
if ($dataSection->nb_days_before == 2) $content .= "selected=\"selected\"";
$content .= " >2</option>
<option ";
if ($dataSection->nb_days_before == 3) $content .= "selected=\"selected\"";
$content .= " >3</option>
<option ";
if ($dataSection->nb_days_before == 4) $content .= "selected=\"selected\"";
$content .= " >4</option>
<option ";
if ($dataSection->nb_days_before == 5) $content .= "selected=\"selected\"";
$content .= " >5</option>
</select> " . get_string('nb_days_before', 'format_iena') . "
</label>
</div>
<div class=\"checkbox\">
<label for=\"day_same\">
<input type=\"checkbox\" name=\"day_same\" id=\"day_same\" value=\"1\" ";
if ($dataSection->day_same == 1) $content .= "checked=\"checked\"";
$content .= ">" . get_string('days_same', 'format_iena') . "
</label>
</div>
<div class=\"checkbox\">
<label for=\"checkboxes-2\">
<input type=\"checkbox\" name=\"day_after\" id=\"day_after\" value=\"1\" ";
if ($dataSection->day_after == 1) $content .= "checked=\"checked\"";
$content .= ">" . get_string('days_after', 'format_iena') . " :
<select class=\"form-control\" style=\"width: 55px; display: inline;\" id=\"nb_days_after\" name =\"nb_days_after\">
<option ";
if ($dataSection->nb_days_after == 1) $content .= "selected=\"selected\"";
$content .= " >1</option>
<option ";
if ($dataSection->nb_days_after == 2) $content .= "selected=\"selected\"";
$content .= " >2</option>
<option ";
if ($dataSection->nb_days_after == 3) $content .= "selected=\"selected\"";
$content .= " >3</option>
<option ";
if ($dataSection->nb_days_after == 4) $content .= "selected=\"selected\"";
$content .= " >4</option>
<option ";
if ($dataSection->nb_days_after == 5) $content .= "selected=\"selected\"";
$content .= " >5</option>
</select> " . get_string('nb_days_after', 'format_iena') . "
</label>
</div>
</div>
</div> </div>
</div> <div class=\"col-md-6\" style=\"padding-top: 30px;\">
<div class=\"checkbox\">
<!-- Multiple Radios --> <label for=\"day_before\">
<div class=\"row\" style=\"display: none;\"> <input type=\"checkbox\" name=\"day_before\" id=\"day_before\" value=\"1\" ";
<div class=\"form-group\"> if ($dataSection != false && $dataSection->day_before == 1) $content .= "checked=\"checked\"";
<div class=\"col-md-3\"> $content .= ">" . get_string('days_before', 'format_iena') . " :
<label class=\" control-label\" for=\"radios\">" . get_string('hide_section', 'format_iena') . "</label> <select class=\"form-control\" style=\"width: 55px; display: inline;\" id=\"nb_days_before\" name =\"nb_days_before\">
<p style=\"font-size: 12px;\">" . get_string('hide_section_summary', 'format_iena') . "</p> <option ";
</div> if ( ($dataSection != false && $dataSection->nb_days_before == 1) || $dataSection == false ) $content .= "selected=\"selected\"";
<div class=\"col-md-4\"> $content .= " >1</option>
<div class=\"radio\"> <option ";
<label for=\"radios-0\"> if ($dataSection != false && $dataSection->nb_days_before == 2) $content .= "selected=\"selected\"";
<input type=\"radio\" name=\"hide\" id=\"hide-0\" value=\"1\" "; $content .= " >2</option>
if ($dataSection->hide == 1 || !$dataSection->hide) $content .= "checked=\"checked\""; <option ";
$content .= "> if ($dataSection != false && $dataSection->nb_days_before == 3) $content .= "selected=\"selected\"";
" . get_string('hide_option_1', 'format_iena') . " $content .= " >3</option>
<option ";
if ($dataSection != false && $dataSection->nb_days_before == 4) $content .= "selected=\"selected\"";
$content .= " >4</option>
<option ";
if ($dataSection != false && $dataSection->nb_days_before == 5) $content .= "selected=\"selected\"";
$content .= " >5</option>
</select> " . get_string('nb_days_before', 'format_iena') . "
</label> </label>
</div> </div>
<div class=\"radio\"> <div class=\"checkbox\">
<label for=\"radios-1\"> <label for=\"day_same\">
<input type=\"radio\" name=\"hide\" id=\"hide-1\" value=\"2\" "; <input type=\"checkbox\" name=\"day_same\" id=\"day_same\" value=\"1\" ";
if ($dataSection->hide == 2) $content .= "checked=\"checked\""; if ($dataSection != false && $dataSection->day_same == 1) $content .= "checked=\"checked\"";
$content .= "> $content .= ">" . get_string('days_same', 'format_iena') . "
" . get_string('hide_option_2', 'format_iena') . "
</label> </label>
</div> </div>
<div class=\"radio\"> <div class=\"checkbox\">
<label for=\"radios-2\"> <label for=\"checkboxes-2\">
<input type=\"radio\" name=\"hide\" id=\"hide-2\" value=\"3\" "; <input type=\"checkbox\" name=\"day_after\" id=\"day_after\" value=\"1\" ";
if ($dataSection->hide == 3) $content .= "checked=\"checked\""; if ($dataSection != false && $dataSection->day_after == 1) $content .= "checked=\"checked\"";
$content .= "> $content .= ">" . get_string('days_after', 'format_iena') . " :
" . get_string('hide_option_3', 'format_iena') . " <select class=\"form-control\" style=\"width: 55px; display: inline;\" id=\"nb_days_after\" name =\"nb_days_after\">
<option ";
if ( ($dataSection != false && $dataSection->nb_days_after == 1) || $dataSection == false ) $content .= "selected=\"selected\"";
$content .= " >1</option>
<option ";
if ($dataSection != false && $dataSection->nb_days_after == 2) $content .= "selected=\"selected\"";
$content .= " >2</option>
<option ";
if ($dataSection != false && $dataSection->nb_days_after == 3) $content .= "selected=\"selected\"";
$content .= " >3</option>
<option ";
if ($dataSection != false && $dataSection->nb_days_after == 4) $content .= "selected=\"selected\"";
$content .= " >4</option>
<option ";
if ($dataSection != false && $dataSection->nb_days_after == 5) $content .= "selected=\"selected\"";
$content .= " >5</option>
</select> " . get_string('nb_days_after', 'format_iena') . "
</label> </label>
</div> </div>
</div> </div>
</div>
</div>
";
$link_annuler = $CFG->wwwroot . "/course/view.php?id=" . $courseID;
$content .= '<div class="">
<button type="submit" class="btn btn-primary">' . get_string('save', 'format_iena') . '</button> </div>
</div>
";
$link_annuler = $CFG->wwwroot . "/course/view.php?id=" . $courseID;
$content .= '<div class="">
<button type="submit" class="btn btn-primary">' . get_string('save', 'format_iena') . '</button>
<a href=\' ' . $link_annuler . ' \' class=\'btn btn-secondary\'>' . get_string('cancel', 'format_iena') . '</a>
<a href=\' ' . $link_annuler . ' \' class=\'btn btn-secondary\'>' . get_string('cancel', 'format_iena') . '</a>
</div>
</fieldset> </div>
'; </fieldset>
$content .= "</form> ';
<script type=\"text/javascript\" charset=\"utf8\" src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script> $content .= "</form>
<script> <script type=\"text/javascript\" charset=\"utf8\" src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>
$(document).ready(function () { <script>
$('.fdescription').hide(); $(document).ready(function () {
}); $('.fdescription').hide();
</script> });
"; </script>
";
return $content;
} return $content;
}
}
\ No newline at end of file }
\ No newline at end of file
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