Commit 0b9f4b14 authored by Thomas Fradet's avatar Thomas Fradet

bugs divers

parent cc8530fe
......@@ -18,10 +18,61 @@ Dans l'accordéon qui permet de visualiser les niveaux supérieur dans le réfé
## Bugs
### Block
#### 1
Variable non instanciée `$this->content->text = "";`.
[x] Solved
__#### 4__
La progression ne fonctionne plus. L'appel à la méthode suivante cause une suite d'erreur :
``` php
$apiComp = new \tool_lp\output\user_competency_summary_in_course($userID, $competenceId, $courseID);
try {
$data = $apiComp->export_for_template(new renderer_base(new moodle_page(), 'autre'));
}
```
__[ ] TODO__
### Page informations sur l'APC
#### 2
Notice: Trying to get property 'id' of non-object in /Applications/MAMP/htdocs/moodle37/blocks/competency_iena/view/view_competency_iena_competency_mgmt.php on line 83
Suppression de l'id du bouton qui fait appel à une propriété pas forcément présente (id du référentiel dont on provient si on arrive sur cette page depuis l'interface d'import d'une compétence dans le cours).
[x] Solved
### Page de gestion des compétences liées au cours
#### 3
Notice: Undefined variable: context in /Applications/MAMP/htdocs/moodle37/blocks/competency_iena/view/view_competency_iena_competencies_mgmt.php on line 422
Notice: Trying to get property 'id' of non-object in /Applications/MAMP/htdocs/moodle37/blocks/competency_iena/view/view_competency_iena_competencies_mgmt.php on line 422
Context manquant.
[x] Solved
## Améliorations
### JS
Suppressions de `console.log()` multiples.
### Nom du plugin
Changement du nom du plugin (fichiers de langue).
### Page de gestion des compétences liées au cours
[ ] Ajout d'un bouton pour ajouter les compétences en haut du tableau.
[ ] Si aucune compétence n'est liée au cours, au lieu d'afficher le tableau, afficher uniquement le bouton d'ajout d'une compétence (un seul sur les deux).
......@@ -51,6 +51,7 @@ class block_competency_iena extends block_base
}
$this->content = new stdClass;
$this->content->text = "";
if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id)) {
$this->content->text .= '<a href="' . $CFG->wwwroot . '/blocks/competency_iena/competency_iena_competencies.php?courseid=' . $COURSE->id . '" class="btn btn-primary w-100 mb-3" style="white-space: normal;">Acquisition des compétences</a>';
$this->content->text .= '<a href="' . $CFG->wwwroot . '/blocks/competency_iena/competency_iena_competencies_mgmt.php?courseid=' . $COURSE->id . '" type="button " class="btn btn-success w-100 mb-3" style="white-space: normal;">Gérer les compétences</a>';
......@@ -58,45 +59,32 @@ class block_competency_iena extends block_base
} else {
$this->content->text .= '<a href="' . $CFG->wwwroot . '/blocks/competency_iena/competency_iena_competencies.php?courseid=' . $COURSE->id . '" class="btn btn-primary w-100 mb-3">Mes Compétences</a>';
}
$competenceI = new block_competency_iena_competency();
$competences = $competenceI->get_competencies_by_userID($USER->id);
$nb_ok = 0;
$nb_total = count($competences);
// var_dump($competences);
foreach ($competences as $comp) {
if ($comp->proficiency == 1) {
$nb_ok++;
}
}
// $this->content->text .= "<p></p>";
if ($nb_total > 0) {
$progress_percentage = ceil($nb_ok*100/$nb_total);
$this->content->text .= "
<div class=\"progress\">
<div class=\"progress-bar\" role=\"progressbar\" style=\"width: $progress_percentage%;\" aria-valuenow=\"$nb_ok\" aria-valuemin=\"0\" aria-valuemax=\"$nb_total\">$nb_ok/$nb_total</div>
</div>
";
} else {
$progress_percentage = 0;
$this->content->text .= "
<div class=\"progress\">
<div class=\"progress-bar\" role=\"progressbar\" style=\"width: $progress_percentage%;\" aria-valuenow=\"$nb_ok\" aria-valuemin=\"0\" aria-valuemax=\"$nb_total\"></div>
</div>
";
}
// $this->content->text .= "
// <div class=\"thermo\">
// <div class=\"round_thermo\">
// <span class=\"text_round_thermo\">
// $nb_ok/$nb_total
// </span>
// </div>
// <div class=\"thermo_bar\">
// <progress class=\"progress\" max=\"$nb_total\" value=\"$nb_ok\"></progress>
// </div>
// </div>
// ";
// $competenceI = new block_competency_iena_competency();
// $competences = $competenceI->get_competencies_by_userID($USER->id);
// $nb_ok = 0;
// $nb_total = count($competences);
// foreach ($competences as $comp) {
// if ($comp->proficiency == 1) {
// $nb_ok++;
// }
// }
// // $this->content->text .= "<p></p>";
// if ($nb_total > 0) {
// $progress_percentage = ceil($nb_ok*100/$nb_total);
// $this->content->text .= "
// <div class=\"progress\">
// <div class=\"progress-bar\" role=\"progressbar\" style=\"width: $progress_percentage%;\" aria-valuenow=\"$nb_ok\" aria-valuemin=\"0\" aria-valuemax=\"$nb_total\">$nb_ok/$nb_total</div>
// </div>
// ";
// } else {
// $progress_percentage = 0;
// $this->content->text .= "
// <div class=\"progress\">
// <div class=\"progress-bar\" role=\"progressbar\" style=\"width: $progress_percentage%;\" aria-valuenow=\"$nb_ok\" aria-valuemin=\"0\" aria-valuemax=\"$nb_total\"></div>
// </div>
// ";
// }
return $this->content;
}
......
......@@ -57,7 +57,7 @@
echo $OUTPUT->header();
} catch (coding_exception $e) {
}
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
/*$cron_test = new block_competency_iena_cron_roles();
$cron_test->attribute_roles_iena_complete();*/
......
define(['core/ajax'],
function(ajax) {
console.log('hello you')
// console.log('hello you')
requests = ajax.call([
{methodname: 'core_competency_remove_competency_from_course',
......
......@@ -13,7 +13,7 @@ function filter() {
function updateTextComp(value, idcourse,wwwroot){
console.log(value);
// console.log(value);
$.ajax({
url: wwwroot+'/blocks/competency_iena/competency_iena_competencies_api.php?courseid='+idcourse,
type: 'POST',
......@@ -32,7 +32,7 @@ function updateTextComp(value, idcourse,wwwroot){
}
function updateTextRef(value, idcourse,wwwroot) {
console.log(value);
// console.log(value);
$.ajax({
url: wwwroot + '/blocks/competency_iena/competency_iena_competencies_api.php?courseid=' + idcourse,
type: 'POST',
......@@ -41,7 +41,7 @@ function updateTextRef(value, idcourse,wwwroot) {
data: {idref: value},
success: function (result) {
var json_res = JSON.parse(result);
console.log(json_res.id);
// console.log(json_res.id);
$('#btn-comp-iena').attr('disabled', 'disabled');
$('#name_ref_iena').html(json_res.shortname);
$('#desc_ref_iena').html(json_res.description);
......
......@@ -38,8 +38,14 @@ class view_competency_iena_competencies
// liste des compétences avec toutes les infos
// TODO : traduire l'évaluation numérique en échelle
$competencies = new block_competency_iena_competency();
$cpts = $competencies->get_competencies_by_userID($studentid);
// var_dump($cpts);
// entête de la table
......
......@@ -183,7 +183,6 @@ function supprimer_lien_cpt(cpt_id) {
info[0] = \"delete_cpt\" ;
info[1] = $COURSE->id ;
info[2] = cpt_id ;
console.log(cpt_id)
$.ajax({
type: \"POST\",
data: {info:info},
......@@ -270,7 +269,6 @@ alert(status);
function changeColor(obj)
{
console.log(obj)
// if (obj.getAttibute('class').indexOf('text-success') > -1) {
// obj.setAttibute('class', 'text-success');
// } else {
......@@ -404,7 +402,7 @@ $content .= "
";
// var_dump($COURSE->id);
// $context = context_module::instance($COURSE->id);
$context = context_module::instance($COURSE->id);
// var_dump($context);
// var_dump($context->_id);
// var_dump($context->id);
......
......@@ -80,7 +80,7 @@ class view_competency_iena_competency_mgmt extends moodleform
$content .= "
<div class='mt-3'>
<a onclick=\"window.history.go(-1); return false;\" class='btn btn-secondary' >".get_string('cancel', 'block_competency_iena')."</a>
<button type='submit' id='" . $ref[1]->id . "' class='btn btn-primary'>".get_string('send_demande', 'block_competency_iena')."</button>
<button type='submit' class='btn btn-primary'>".get_string('send_demande', 'block_competency_iena')."</button>
</div>
</form>";
......
......@@ -176,7 +176,7 @@ class view_competency_iena_competency_students
} );
$( '#filter-evaluation' ).on( 'change', function () {
console.log($(this).val());
// console.log($(this).val());
if ($(this).val()){
table.column(3).search('^'+$(this).val()+'$',true,false).draw();
} else {
......@@ -194,9 +194,9 @@ $( '#filter-module' ).on('change', function() {
if($('#browsers option').filter(function(){
return this.value === val;
}).length) {
console.log(this.value);
// console.log(this.value);
var value2send = document.querySelector(\"#browsers option[value='\"+this.value+\"']\").dataset.value;
console.log(value2send);
// console.log(value2send);
window.location.replace(value2send);
}
});
......
......@@ -243,17 +243,15 @@ class view_competency_iena_user
<script>
$(document).ready(function () {
$('#btn-eval-<?php echo $key_cpt; ?>').click(function () {
console.log(this);
console.log(
$("#courseid_iena_<?php echo $key_cpt; ?>").val()
);
// console.log(this);
// console.log($("#courseid_iena_<?php echo $key_cpt; ?>").val());
var data = {
eval_comp: $("#slc-eval_<?php echo $key_cpt; ?>").val(),
userid : $("#iduser_iena_<?php echo $key_cpt; ?>").val(),
compid : $("#compid_iena_<?php echo $key_cpt; ?>").val(),
eval_comp_note: "Evaluation données dans le cours « <?php echo $COURSE->fullname ?> » par <?php echo( $USER->firstname . " " . $USER->lastname ) ?>. " + $("#slc-eval-note_<?php echo $key_cpt; ?>").val()
}
console.log( data );
// console.log( data );
$.ajax({
url: $("#wwwroot_iena").val() + '/blocks/competency_iena/' +
'competency_iena_competencies_api.php?courseid=' + $("#courseid_iena_<?php echo $key_cpt; ?>").val(),
......@@ -850,8 +848,8 @@ class view_competency_iena_user
contentType: 'application/x-www-form-urlencoded',
success: function (data, status) {
if (status == "success") {
console.log(status);
console.log(data);
// console.log(status);
// console.log(data);
location.reload();
}
},
......@@ -889,25 +887,25 @@ class view_competency_iena_user
function write_comment(obj) {
var url = window.location.href;
console.log(url);
// console.log(url);
var input_message_id = obj.id;
console.log(input_message_id);
// console.log(input_message_id);
var idsender = input_message_id.split('-')[0];
idsender = idsender.replace(/[^\d.]/g, '');
console.log(idsender);
// console.log(idsender);
var idstudent = input_message_id.split('-')[1];
idstudent = idstudent.replace(/[^\d.]/g, '');
console.log(idstudent);
// console.log(idstudent);
var idcourse = input_message_id.split('-')[2];
idcourse = idcourse.replace(/[^\d.]/g, '');
console.log(idcourse);
// console.log(idcourse);
var idcompetency = input_message_id.split('-')[3];
idcompetency = idcompetency.replace(/[^\d.]/g, '');
console.log(idcompetency);
// console.log(idcompetency);
var message = document.getElementById("input_message").value;
console.log(message);
// console.log(message);
var date = new Date().getTime() / 1000;
console.log(date);
// console.log(date);
var info = [];
info[0] = "insert";
......@@ -926,8 +924,8 @@ class view_competency_iena_user
contentType: 'application/x-www-form-urlencoded',
success: function (data, status) {
if (status == "success") {
console.log(status);
console.log(data);
// console.log(status);
// console.log(data);
location.reload();
}
......
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