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

Commit 4b6f19cf authored by Thomas Fradet's avatar Thomas Fradet
Browse files

user x cpts msg if no cpt in course

parent 51bb2c0a
......@@ -3,15 +3,14 @@
require_once('../../config.php');
// ENLEVER SI NON NECESSAIRE :
require_once('entity/block_competency_iena_competency.php');
require_once('entity/block_competency_iena_module.php');
require_once('entity/block_competency_iena_ressource.php');
require_once('entity/block_competency_iena_section.php');
// require_once('entity/block_competency_iena_competency.php');
// require_once('entity/block_competency_iena_module.php');
// require_once('entity/block_competency_iena_ressource.php');
// require_once('entity/block_competency_iena_section.php');
require_once('entity/block_competency_iena_student.php');
require_once('entity/block_competency_iena_cron_roles.php');
require_once('entity/block_competency_iena_cron_competency.php');
require_once('view/view_competency_iena_competencies.php');
// require_once('entity/block_competency_iena_cron_roles.php');
// require_once('entity/block_competency_iena_cron_competency.php');
// require_once('view/view_competency_iena_competencies.php');
global $COURSE, $DB, $USER, $CFG;
......@@ -23,50 +22,57 @@ $PAGE->set_url($url);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
require_login($course, false, NULL);
$PAGE->set_title(get_string('title_plugin', 'block_competency_iena'));
$PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline'));
$PAGE->requires->js("/blocks/competency_iena/js/datalist-polyfill.min.js");
$PAGE->requires->js("/blocks/competency_iena/js/stud-x-cpts.js");
echo $OUTPUT->header();
$course_cpts = \core_competency\course_competency::list_competencies($COURSE->id);
if (count($course_cpts) === 0) {
$PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline'));
echo $OUTPUT->header();
echo "<p class='alert alert-warning'>Pour le moment, aucune compétence n'a été liée à ce cours. Pour lier des compétences au cours et les associer à des activités, rendez-vous dans la page <a href='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competencies_mgmt.php?courseid={$courseid}'>Gestion des compétences</a>. </p>";
echo $OUTPUT->footer();
} else {
$PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline'));
$PAGE->requires->js("/blocks/competency_iena/js/datalist-polyfill.min.js");
$PAGE->requires->js("/blocks/competency_iena/js/stud-x-cpts.js");
echo $OUTPUT->header();
// Les étudiants.
$student = new block_competency_iena_student();
$students = $student->get_all_students_by_course($COURSE->id);
// Les compétences du cours.
// $course_cpts = \core_competency\course_competency::list_competencies($COURSE->id);
// L'état des compétences du cours pour un utilisateur
$user_course_competencies = \core_competency\api::list_user_competencies_in_course($COURSE->id, $studentid);
// L'étudiant
$student->get_student_by_id($studentid);
// Les étudiants.
$student = new block_competency_iena_student();
$students = $student->get_all_students_by_course($COURSE->id);
// Les compétences du cours.
// $course_cpts = \core_competency\course_competency::list_competencies($COURSE->id);
// L'étudiant
$student->get_student_by_id($studentid);
// L'état des compétences du cours pour un utilisateur
$user_course_competencies = \core_competency\api::list_user_competencies_in_course($COURSE->id, $studentid);
echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competencies_2.php' id='change_stud_form' class='form-inline m-b-1 alert alert-secondary'>";
echo "<input type='text' hidden name='courseid' value='{$courseid}'>";
echo "<span hidden id='studentid'>{$studentid}</span>";
echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competencies_2.php' id='change_stud_form' class='form-inline m-b-1 alert alert-secondary'>";
echo "<input type='text' hidden name='courseid' value='{$courseid}'>";
echo "<span hidden id='studentid'>{$studentid}</span>";
// https://github.com/mfranzke/datalist-polyfill
echo "<label class='m-y-1 m-r-1' for='studentid_sel' style='color: black;'>Etudiant</label>";
echo "<input type='text' name='studentid' id='studentid_sel' value='' list='student_list' class='form-control'>";
// https://github.com/mfranzke/datalist-polyfill
echo "<label class='m-y-1 m-r-1' for='studentid_sel' style='color: black;'>Etudiant</label>";
echo "<input type='text' name='studentid' id='studentid_sel' value='' list='student_list' class='form-control'>";
echo "<datalist id='student_list' title='Select student'>";
echo "<datalist id='student_list' title='Select student'>";
foreach ($students as $stud) {
foreach ($students as $stud) {
echo "<option value='{$stud->firstname} {$stud->lastname} ({$stud->id})' data-value='{$stud->id}'>{$stud->firstname} {$stud->lastname} ({$stud->id})</option>";
}
echo "</datalist>";
}
echo "</datalist>";
echo "<button class='btn btn-secondary m-l-1' id='prevStud'>Précédent</button>";
echo "<button class='btn btn-secondary m-l-1' id='nextStud'>Suivant</button>";
echo "<button class='btn btn-secondary m-l-1' id='prevStud'>Précédent</button>";
echo "<button class='btn btn-secondary m-l-1' id='nextStud'>Suivant</button>";
echo "</form>";
echo "</form>";
echo "<h2>{$student->firstname} {$student->lastname}</h2>";
echo "<h2>{$student->firstname} {$student->lastname}</h2>";
echo "<div class='list-group'>";
foreach ($user_course_competencies as $user_course_competency) {
echo "<div class='list-group'>";
foreach ($user_course_competencies as $user_course_competency) {
// Crée un obj cpt à partir de l'ID. Attention, id de compétence et course_competency sont différents.
$cpt = new \core_competency\competency($user_course_competency->get('competencyid'));
// Récupère les chaines de caractère de l'échelle d'évaluation
......@@ -87,8 +93,9 @@ foreach ($user_course_competencies as $user_course_competency) {
<p class='' style='margin-bottom: 0;'>Évaluation : <em>{$eval}</em></p>
<small class=''>Acquis : {$proficient_str}</small>
</a>";
}
echo "</div>";
}
echo "</div>";
echo $OUTPUT->footer();
echo $OUTPUT->footer();
} /* Fin else condition qu'il y ait des cpt liées au cours. */
\ 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