...
 
Commits (4)
...@@ -45,8 +45,7 @@ if ($count_course_cpts === 0) { ...@@ -45,8 +45,7 @@ if ($count_course_cpts === 0) {
$student->get_student_by_id($studentid); $student->get_student_by_id($studentid);
$PAGE->set_heading($OUTPUT->heading($student->firstname . " " . $student->lastname, 2, 'headingblock header outline')); $PAGE->set_heading($OUTPUT->heading($student->firstname . " " . $student->lastname, 2, 'headingblock header outline'));
$PAGE->requires->js("/blocks/competency_iena/js/datalist-polyfill.min.js"); $PAGE->requires->js("/blocks/competency_iena/js/dropdown.js");
$PAGE->requires->js("/blocks/competency_iena/js/stud-x-cpts.js");
echo $OUTPUT->header(); echo $OUTPUT->header();
/* Les demandes de validation de compétence (review) prises dans le cptuser car n'existent pas dans le contexte restreint à un cours. */ /* Les demandes de validation de compétence (review) prises dans le cptuser car n'existent pas dans le contexte restreint à un cours. */
...@@ -81,19 +80,20 @@ if ($count_course_cpts === 0) { ...@@ -81,19 +80,20 @@ if ($count_course_cpts === 0) {
echo "<h2 class='h3'>{$student->firstname} {$student->lastname}</h2>"; echo "<h2 class='h3'>{$student->firstname} {$student->lastname}</h2>";
if ( !$is_student ) { if ( !$is_student ) {
echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competencies_2.php' id='change_stud_form' class='form-inline'>"; echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competencies_2.php' id='change_stud_form' class='form-inline' autocomplete='off' style='display: block;height: 1.5rem;'>";
echo "<input type='text' hidden name='courseid' value='{$courseid}'>"; echo "<input type='text' hidden name='courseid' value='{$courseid}'>";
echo "<span hidden id='studentid'>{$studentid}</span>"; 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 "<div id='student_dropdown' class='iena-dropdown' style='z-index: 10;'>";
echo "<input type='text' name='studentid' id='studentid_sel' value='' list='student_list' class='form-control m-r-1'>"; echo "<input type='text' hidden name='studentid' id='studentid_sel' class='iena-drop-input-value' value=''>";
echo "<datalist id='student_list' title='Select student'>"; echo "<input type='text' value='' class='form-control iena-drop-input' style='font-size: .7rem; line-height: 1; width: 300px;' placeholder='{$student->firstname} {$student->lastname}'><button class='btn btn-secondary' id='prevStud' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Précédent</button><button class='btn btn-secondary' id='nextStud' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Suivant</button>";
echo "<div class='iena-droplist' id='student_list'>";
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 "<a href='#' data-value='{$stud->id}' class='iena-drop-item' style='display: none;'>{$stud->firstname} {$stud->lastname}</a>";
} }
echo "</datalist>"; echo "</div>";
echo "<div><button class='btn btn-secondary' id='prevStud'>Précédent</button>"; echo "</div>";
echo "<button class='btn btn-secondary m-l-1' id='nextStud'>Suivant</button></div>";
echo "</form>"; echo "</form>";
} }
...@@ -124,6 +124,9 @@ if ($count_course_cpts === 0) { ...@@ -124,6 +124,9 @@ if ($count_course_cpts === 0) {
foreach ($user_course_competencies as $user_course_competency) { 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. // 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')); $cpt = new \core_competency\competency($user_course_competency->get('competencyid'));
/* Visuel indentation to reflect levels in cpt framework */
$cpt_level_in_framework = substr_count($cpt->get('path'), '/') - 1; /* start at 1 */
$level_indentation = $cpt_level_in_framework * 1.5;
// Récupère les chaines de caractère de l'échelle d'évaluation // Récupère les chaines de caractère de l'échelle d'évaluation
$cpt_scale = $cpt->get_scale()->scale_items; $cpt_scale = $cpt->get_scale()->scale_items;
$eval = "-"; $eval = "-";
...@@ -133,9 +136,9 @@ if ($count_course_cpts === 0) { ...@@ -133,9 +136,9 @@ if ($count_course_cpts === 0) {
$proficient_class = $user_course_competency->get('proficiency') == 1 ? " list-group-item-success" : ""; $proficient_class = $user_course_competency->get('proficiency') == 1 ? " list-group-item-success" : "";
$proficient_str = $user_course_competency->get('proficiency') == 1 ? "Oui" : "Non"; $proficient_str = $user_course_competency->get('proficiency') == 1 ? "Oui" : "Non";
echo " echo "
<a href='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php?courseid={$courseid}&studentid={$studentid}&competencyid={$cpt->get('id')}' class='list-group-item list-group-item-action{$proficient_class}'> <a href='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php?courseid={$courseid}&studentid={$studentid}&competencyid={$cpt->get('id')}' class='list-group-item list-group-item-action{$proficient_class}' style='padding-left: {$level_indentation}rem;'>
<div class='d-flex w-100 justify-content-between'> <div class='d-flex w-100 justify-content-between'>
<h3 class='mb-1 iena-cpt-action-title'>{$cpt->get('shortname')}</h3>"; <h3 class='mb-1 iena-cpt-action-title h5'>{$cpt->get('shortname')}</h3>";
foreach ($reviews_data as $review) { foreach ($reviews_data as $review) {
if ( $review->competencyid == $cpt->get('id') ) { if ( $review->competencyid == $cpt->get('id') ) {
echo "<div><small class='review-badge'>Évaluation demandée</small></div>"; echo "<div><small class='review-badge'>Évaluation demandée</small></div>";
...@@ -143,8 +146,7 @@ if ($count_course_cpts === 0) { ...@@ -143,8 +146,7 @@ if ($count_course_cpts === 0) {
} }
} }
echo "</div> echo "</div>
<p class='' style='margin-bottom: 0;'>Évaluation : <em>{$eval}</em></p> <p class='small' style='margin-bottom: 0;'>Évaluation : {$eval} / Acquis : {$proficient_str}</p>
<small class=''>Acquis : {$proficient_str}</small>
</a>"; </a>";
} }
echo "</div>"; echo "</div>";
......
...@@ -14,20 +14,12 @@ ...@@ -14,20 +14,12 @@
global $COURSE, $DB, $CFG; global $COURSE, $DB, $CFG;
try {
$courseid = required_param('courseid', PARAM_INT); $courseid = required_param('courseid', PARAM_INT);
} catch (coding_exception $e) {
}
try {
$url = new moodle_url('/blocks/competency_iena/competency_iena_competencies_mgmt.php', array('courseid' => $courseid)); $url = new moodle_url('/blocks/competency_iena/competency_iena_competencies_mgmt.php', array('courseid' => $courseid));
} catch (moodle_exception $e) {
}
//$requete = $DB->get_record_sql('SELECT course FROM {block_competency_iena} WHERE id = ?', array($courseid)); //$requete = $DB->get_record_sql('SELECT course FROM {block_competency_iena} WHERE id = ?', array($courseid));
try {
$PAGE->set_url($url); $PAGE->set_url($url);
} catch (coding_exception $e) {
}
if ($_POST) { if ($_POST) {
...@@ -129,40 +121,17 @@ ...@@ -129,40 +121,17 @@
exit; exit;
} }
try {
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
} catch (dml_exception $e) {
}
try {
require_login($course, false, NULL); require_login($course, false, NULL);
} catch (coding_exception $e) {
} catch (require_login_exception $e) {
} catch (moodle_exception $e) {
}
try {
$PAGE->set_title(get_string('title_plugin', 'block_competency_iena')); $PAGE->set_title(get_string('title_plugin', 'block_competency_iena'));
} catch (coding_exception $e) {
}
try {
$PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline')); $PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline'));
} catch (coding_exception $e) {
}
try {
echo $OUTPUT->header(); echo $OUTPUT->header();
} catch (coding_exception $e) {
}
//$PAGE->requires->js("/blocks/competency_iena/js/jquery.min.js");
$PAGE->requires->js("/blocks/competency_iena/js/file.js"); $PAGE->requires->js("/blocks/competency_iena/js/file.js");
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
$view = new view_competency_iena_competencies_mgmt(); $view = new view_competency_iena_competencies_mgmt();
echo $view->get_content(htmlspecialchars($courseid)); echo $view->get_content(htmlspecialchars($courseid));
try {
echo $OUTPUT->footer(); echo $OUTPUT->footer();
} catch (coding_exception $e) {
}
...@@ -52,8 +52,7 @@ if (count($course_cpts) === 0) { ...@@ -52,8 +52,7 @@ if (count($course_cpts) === 0) {
} }
$PAGE->set_heading($OUTPUT->heading($current_cpt->shortname, 2, 'headingblock header outline')); $PAGE->set_heading($OUTPUT->heading($current_cpt->shortname, 2, 'headingblock header outline'));
$PAGE->requires->js("/blocks/competency_iena/js/datalist-polyfill.min.js"); $PAGE->requires->js("/blocks/competency_iena/js/dropdown.js");
$PAGE->requires->js("/blocks/competency_iena/js/cpt-x-studs.js");
echo $OUTPUT->header(); echo $OUTPUT->header();
/* Les étudiants. */ /* Les étudiants. */
...@@ -72,7 +71,7 @@ if (count($course_cpts) === 0) { ...@@ -72,7 +71,7 @@ if (count($course_cpts) === 0) {
echo "<div class='alert row' style='padding: 0; background-color: inherit; color: inherit;'>"; /* Début change competency. */ echo "<div class='alert row' style='padding: 0; background-color: inherit; color: inherit;'>"; /* Début change competency. */
echo "<div class='col-12' style='padding-left: 0;'>"; echo "<div class='col-12' style='padding-left: 0;'>";
echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competency_students_2.php' id='change_cpt_form' class='form-inline'>"; echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/competency_iena_competency_students_2.php' id='change_cpt_form' class='form-inline' autocomplete='off' style='display: block;height: 1.5rem;'>";
echo "<input type='text' hidden name='courseid' value='{$COURSE->id}'>"; echo "<input type='text' hidden name='courseid' value='{$COURSE->id}'>";
if ( isset($_GET['grade']) ) { if ( isset($_GET['grade']) ) {
echo "<input type='text' hidden name='grade' value='{$_GET['grade']}'>"; echo "<input type='text' hidden name='grade' value='{$_GET['grade']}'>";
...@@ -84,15 +83,26 @@ if (count($course_cpts) === 0) { ...@@ -84,15 +83,26 @@ if (count($course_cpts) === 0) {
echo "<input type='text' hidden name='review' value='{$_GET['review']}'>"; echo "<input type='text' hidden name='review' value='{$_GET['review']}'>";
} }
echo "<span hidden id='competencyid'>{$current_cpt->id}</span>"; echo "<span hidden id='competencyid'>{$current_cpt->id}</span>";
echo "<label class='m-r-1' for='competencyid_sel' style=''>Changer de compétence</label>";
echo "<input type='text' name='competencyid' id='competencyid_sel' value='' list='competency_list' class='form-control'>"; // echo "<input type='text' name='competencyid' id='competencyid_sel' value='' list='competency_list' class='form-control'>";
echo "<datalist id='competency_list' title='Select competency'>"; // echo "<datalist id='competency_list' title='Select competency'>";
// foreach ($course_cpts as $course_cpt) {
// echo "<option value='{$course_cpt->get('shortname')} ({$course_cpt->get('id')})' data-value='{$course_cpt->get('id')}'>{$course_cpt->get('shortname')} ({$course_cpt->get('id')})</option>";
// }
// echo "</datalist>";
// echo "<button class='btn btn-secondary m-l-1' id='prevCpt'>Précédent</button>";
// echo "<button class='btn btn-secondary m-l-1' id='nextCpt'>Suivant</button>";
echo "<div id='student_dropdown' class='iena-dropdown' style='z-index: 1;'>";
echo "<input type='text' hidden name='competencyid' id='competencyid_sel' class='iena-drop-input-value' value=''>";
echo "<input type='text' value='' class='form-control iena-drop-input' style='font-size: .7rem; line-height: 1; width: 300px;' placeholder='{$current_cpt->shortname}' autocomplete='nope'><button class='btn btn-secondary' id='prevCpt' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Précédent</button><button class='btn btn-secondary' id='nextCpt' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Suivant</button>";
echo "<div class='iena-droplist' id='competency_list'>";
foreach ($course_cpts as $course_cpt) { foreach ($course_cpts as $course_cpt) {
echo "<option value='{$course_cpt->get('shortname')} ({$course_cpt->get('id')})' data-value='{$course_cpt->get('id')}'>{$course_cpt->get('shortname')} ({$course_cpt->get('id')})</option>"; echo "<a href='#' data-value='{$course_cpt->get('id')}' class='iena-drop-item' style='display: none;'>{$course_cpt->get('shortname')}</a>";
} }
echo "</datalist>"; echo "</div>";
echo "<button class='btn btn-secondary m-l-1' id='prevCpt'>Précédent</button>"; echo "</div>";
echo "<button class='btn btn-secondary m-l-1' id='nextCpt'>Suivant</button>";
echo "</form>"; echo "</form>";
echo "</div>"; echo "</div>";
echo "</div>"; /* Fin change competency. */ echo "</div>"; /* Fin change competency. */
...@@ -312,13 +322,12 @@ if (count($course_cpts) === 0) { ...@@ -312,13 +322,12 @@ if (count($course_cpts) === 0) {
echo " echo "
<a href='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php?courseid={$courseid}&studentid={$cpt_stud->id}&competencyid={$current_cpt->id}' class='list-group-item list-group-item-action{$proficient_class}'> <a href='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php?courseid={$courseid}&studentid={$cpt_stud->id}&competencyid={$current_cpt->id}' class='list-group-item list-group-item-action{$proficient_class}'>
<div class='d-flex w-100 justify-content-between'> <div class='d-flex w-100 justify-content-between'>
<h3 class='mb-1 iena-cpt-action-title'>{$cpt_stud->firstname} {$cpt_stud->lastname}</h3>"; <h3 class='mb-1 iena-cpt-action-title h5'>{$cpt_stud->firstname} {$cpt_stud->lastname}</h3>";
if ($cpt_stud->review == 1) { if ($cpt_stud->review == 1) {
echo "<div><small class='review-badge'>Évaluation demandée</small></div>"; echo "<div><small class='review-badge'>Évaluation demandée</small></div>";
} }
echo "</div> echo "</div>
<p class='' style='margin-bottom: 0;'>Évaluation : <em>{$grade_d}</em></p> <p class='small' style='margin-bottom: 0;'>Évaluation : {$grade_d} / Acquis : {$proficiency_d}</p>
<small class=''>Acquis : {$proficiency_d}</small>
</a>"; </a>";
} }
} }
......
...@@ -16,9 +16,7 @@ require_login($courseid, false, NULL); ...@@ -16,9 +16,7 @@ require_login($courseid, false, NULL);
$PAGE->set_pagelayout('course'); $PAGE->set_pagelayout('course');
$PAGE->set_title(get_string('title_plugin', 'block_competency_iena')); $PAGE->set_title(get_string('title_plugin', 'block_competency_iena'));
$PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline')); $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/dropdown.js");
$PAGE->requires->js("/blocks/competency_iena/js/stud-x-cpts.js");
$PAGE->requires->js("/blocks/competency_iena/js/cpt-x-studs.js");
$PAGE->requires->js("/blocks/competency_iena/js/cpt-stud-course.js"); $PAGE->requires->js("/blocks/competency_iena/js/cpt-stud-course.js");
/* <<< GESTION DROITS D'ACCÈS >>> */ /* <<< GESTION DROITS D'ACCÈS >>> */
...@@ -133,10 +131,6 @@ $course_cpts = \core_competency\course_competency::list_competencies($COURSE->id ...@@ -133,10 +131,6 @@ $course_cpts = \core_competency\course_competency::list_competencies($COURSE->id
/* <<< PAGE >>> */ /* <<< PAGE >>> */
// echo "<pre>";
// var_dump($cpt_scale);
// echo "</pre>";
/* STUDENT NAME */ /* STUDENT NAME */
_html("h2", $student->firstname . " " . $student->lastname, "h3' style='margin-bottom: 0.3rem;'"); _html("h2", $student->firstname . " " . $student->lastname, "h3' style='margin-bottom: 0.3rem;'");
...@@ -144,19 +138,21 @@ _html("h2", $student->firstname . " " . $student->lastname, "h3' style='margin-b ...@@ -144,19 +138,21 @@ _html("h2", $student->firstname . " " . $student->lastname, "h3' style='margin-b
/* SWITCH STUDENT FORM */ /* SWITCH STUDENT FORM */
if ( $is_teacher && $students != NULL && count($students) != 0 ) { if ( $is_teacher && $students != NULL && count($students) != 0 ) {
echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php' id='change_stud_form' class='form-inline m-b-1'>"; echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php' id='change_student' class='form-inline m-b-1' autocomplete='off' style='display: block;height: 1.5rem;'>";
echo "<input type='text' hidden name='courseid' value='{$courseid}'>"; echo "<input type='text' hidden name='courseid' value='{$courseid}'>";
echo "<input type='text' hidden name='competencyid' value='{$competencyid}'>"; echo "<input type='text' hidden name='competencyid' value='{$competencyid}'>";
echo "<span hidden id='studentid'>{$studentid}</span>"; echo "<span hidden id='studentid'>{$studentid}</span>";
/*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' style='font-size: .7rem; line-height: 1;'>"; echo "<div id='student_dropdown' class='iena-dropdown' style='z-index: 10;'>";
echo "<datalist id='student_list' title='Select student'>"; echo "<input type='text' hidden name='studentid' id='studentid_sel' class='iena-drop-input-value' value=''>";
echo "<input type='text' value='' class='form-control iena-drop-input' style='font-size: .7rem; line-height: 1; width: 300px;' placeholder='{$student->firstname} {$student->lastname}'><button class='btn btn-secondary' id='prevStud' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Précédent</button><button class='btn btn-secondary' id='nextStud' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Suivant</button>";
echo "<div class='iena-droplist' id='student_list'>";
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 "<a href='#' data-value='{$stud->id}' class='iena-drop-item' style='display: none;'>{$stud->firstname} {$stud->lastname}</a>";
} }
echo "</datalist>"; echo "</div>";
echo "<div><button class='btn btn-secondary' id='prevStud' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Précédent</button>"; echo "</div>";
echo "<button class='btn btn-secondary' id='nextStud' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Suivant</button></div>";
echo "</form>"; echo "</form>";
} }
...@@ -184,19 +180,21 @@ echo "<div style='margin-bottom: 0.7rem;'>" . $cpt_path_link . "</div>"; ...@@ -184,19 +180,21 @@ echo "<div style='margin-bottom: 0.7rem;'>" . $cpt_path_link . "</div>";
/* SWITCH COMPETENCY FORM */ /* SWITCH COMPETENCY FORM */
echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php' id='change_cpt_form' class='form-inline m-b-1'>"; echo "<form action='{$CFG->wwwroot}/blocks/competency_iena/course_competency.php' id='change_cpt_form' class='form-inline m-b-1' autocomplete='off' style='display: block;height: 1.5rem;'>";
echo "<input type='text' hidden name='courseid' value='{$courseid}'>"; echo "<input type='text' hidden name='courseid' value='{$courseid}'>";
echo "<input type='text' hidden name='studentid' value='{$studentid}'>"; echo "<input type='text' hidden name='studentid' value='{$studentid}'>";
echo "<span hidden id='competencyid'>{$competencyid}</span>"; echo "<span hidden id='competencyid'>{$competencyid}</span>";
/*echo "<label class='m-r-1' for='competencyid_sel' style=''>Changer de compétence</label>";*/
echo "<input type='text' name='competencyid' id='competencyid_sel' value='' list='competency_list' class='form-control' style='font-size: .7rem; line-height: 1;'>"; echo "<div id='student_dropdown' class='iena-dropdown' style='z-index: 1;'>";
echo "<datalist id='competency_list' title='Select competency'>"; echo "<input type='text' hidden name='competencyid' id='competencyid_sel' class='iena-drop-input-value' value=''>";
echo "<input type='text' value='' class='form-control iena-drop-input' style='font-size: .7rem; line-height: 1; width: 300px;' placeholder='{$cpt->get('shortname')}' autocomplete='nope'><button class='btn btn-secondary' id='prevCpt' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Précédent</button><button class='btn btn-secondary' id='nextCpt' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Suivant</button>";
echo "<div class='iena-droplist' id='competency_list'>";
foreach ($course_cpts as $course_cpt) { foreach ($course_cpts as $course_cpt) {
echo "<option value='{$course_cpt->get('shortname')} ({$course_cpt->get('id')})' data-value='{$course_cpt->get('id')}'>{$course_cpt->get('shortname')} ({$course_cpt->get('id')})</option>"; echo "<a href='#' data-value='{$course_cpt->get('id')}' class='iena-drop-item' style='display: none;'>{$course_cpt->get('shortname')}</a>";
} }
echo "</datalist>"; echo "</div>";
echo "<button class='btn btn-secondary' id='prevCpt' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Précédent</button>"; echo "</div>";
echo "<button class='btn btn-secondary' id='nextCpt' style='font-size: .8rem;line-height: 1.09; margin-left: 0.5rem;'>Suivant</button>";
echo "</form>"; echo "</form>";
/* END switch competency form */ /* END switch competency form */
...@@ -398,7 +396,12 @@ if ( count($cm_ids) !== 0 ) { ...@@ -398,7 +396,12 @@ if ( count($cm_ids) !== 0 ) {
$modinfo = get_fast_modinfo($courseid); $modinfo = get_fast_modinfo($courseid);
echo "<div class='list-group'>"; echo "<div class='list-group'>";
foreach ($cm_ids as $cm_id) { foreach ($cm_ids as $cm_id) {
echo "<a href='{$modinfo->cms[$cm_id]->url->out()}' target='_blank' class='list-group-item list-group-item-action'><img src='$CFG->wwwroot/theme/image.php/boost/{$modinfo->cms[$cm_id]->modname}/1/icon>' style='height: 1.3rem;'><span class='align-middle'> {$modinfo->cms[$cm_id]->name}</span></a>"; $url = $modinfo->cms[$cm_id]->url->out();
$is_assign = strpos($url, '/mod/assign') !== false;
if ($is_teacher && $is_assign) {
$url = $url . "&rownum=0&action=grader&userid=" . $studentid;
}
echo "<a href='{$url}' target='_blank' class='list-group-item list-group-item-action'><img src='$CFG->wwwroot/theme/image.php/boost/{$modinfo->cms[$cm_id]->modname}/1/icon>' style='height: 1.3rem;'><span class='align-middle'> {$modinfo->cms[$cm_id]->name}</span></a>";
} }
echo "</div>"; echo "</div>";
} else { } else {
......
(function() {
/* Submit datalist selector to change current competency
on the dashboard listing avery student status regarding a particular competency. */
window.addEventListener('load', function () {
var opts = document.getElementById('competency_list').childNodes;
var competencyid = document.getElementById('competencyid').innerHTML;
for (var i = 0; i < opts.length; i++) {
if (opts[i].dataset.value === competencyid) {
var prev = opts[i - 1] === undefined ? false : opts[i - 1].dataset.value;
var next = opts[i + 1] === undefined ? false : opts[i + 1].dataset.value;
if (prev === false) {
document.getElementById('prevCpt').setAttribute('disabled', 'disabled');
} else {
// document.getElementById('prevCpt').href += prev;
document.getElementById('prevCpt').dataset.prev = prev;
document.getElementById('prevCpt').onclick = function () {
document.getElementById('competencyid_sel').value = document.getElementById('prevCpt').dataset.prev;
}
}
if (next === false) {
document.getElementById('nextCpt').setAttribute('disabled', 'disabled');
} else {
// document.getElementById('nextCpt').href += next;
document.getElementById('nextCpt').dataset.next = next;
document.getElementById('nextCpt').onclick = function () {
document.getElementById('competencyid_sel').value = document.getElementById('nextCpt').dataset.next;
}
}
}
}
/* remplace le nom de l'étu par son id dans la valeur de l'input puis soumet le formulaire */
document.getElementById('competencyid_sel').oninput = function (e) {
var val = document.getElementById('competencyid_sel').value;
var opts = document.getElementById('competency_list').childNodes;
for (var i = 0; i < opts.length; i++) {
if (opts[i].value === val) {
document.getElementById('competencyid_sel').value = opts[i].dataset.value;
document.getElementById('change_cpt_form').submit();
}
}
};
});
})()
\ No newline at end of file
(function() {
function filter (e) {
let filter = e.target.value.toUpperCase();
let a = e.target.parentNode.querySelectorAll('a');
for (let k = 0; k < a.length; k++) {
let txtValue = a[k].textContent || a[k].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
a[k].style.display = "block";
} else {
a[k].style.display = "none";
}
}
}
window.addEventListener('load', function () {
/* Activation of dropdowns in the page */
let drops = document.querySelectorAll('.iena-dropdown');
for (var i = 0; i < drops.length; i++) {
drops[i].querySelector('.iena-drop-input').addEventListener('focus', function(e) {
let a = e.target.parentNode.querySelectorAll('a');
for (var i = 0; i < a.length; i++) {
a[i].style.display = "block";
}
filter(e);
});
let a = drops[i].querySelectorAll('a');
for (var j = 0; j < a.length; j++) {
a[j].onmousedown = function(e) {
e.preventDefault();
let true_input = e.target.parentNode.parentNode.querySelector('.iena-drop-input-value');
let value = e.target.dataset.value;
true_input.value = value;
let input = e.target.parentNode.parentNode.querySelector('.iena-drop-input')
input.value = e.target.innerText;
let a = e.target.parentNode.querySelectorAll('a');
for (var i = 0; i < a.length; i++) {
a[i].style.display = "none";
}
e.target.parentNode.parentNode.parentNode.submit();
};
}
drops[i].querySelector('.iena-drop-input').addEventListener('blur', function(e) {
let a = e.target.parentNode.querySelectorAll('a');
for (var i = 0; i < a.length; i++) {
a[i].style.display = "none";
}
});
drops[i].querySelector('.iena-drop-input').addEventListener('keyup', function(e) {
filter(e);
});
}
/* Activation of previous and next buttons for dropdowns */
if (document.getElementById('student_list') !== null) {
var opts = document.getElementById('student_list').childNodes;
var studentid = document.getElementById('studentid').innerHTML;
for (var i = 0; i < opts.length; i++) {
if (opts[i].dataset.value === studentid) {
var prev = opts[i - 1] === undefined ? false : opts[i - 1].dataset.value;
var next = opts[i + 1] === undefined ? false : opts[i + 1].dataset.value;
if (prev === false) {
document.getElementById('prevStud').setAttribute('disabled', 'disabled');
} else {
document.getElementById('prevStud').dataset.prev = prev;
document.getElementById('prevStud').onclick = function () {
document.getElementById('studentid_sel').value = document.getElementById('prevStud').dataset.prev;
}
}
if (next === false) {
document.getElementById('nextStud').setAttribute('disabled', 'disabled');
} else {
document.getElementById('nextStud').dataset.next = next;
document.getElementById('nextStud').onclick = function () {
document.getElementById('studentid_sel').value = document.getElementById('nextStud').dataset.next;
}
}
}
}
}
if (document.getElementById('competency_list') !== null) {
var opts = document.getElementById('competency_list').childNodes;
var competencyid = document.getElementById('competencyid').innerHTML;
for (var i = 0; i < opts.length; i++) {
if (opts[i].dataset.value === competencyid) {
var prev = opts[i - 1] === undefined ? false : opts[i - 1].dataset.value;
var next = opts[i + 1] === undefined ? false : opts[i + 1].dataset.value;
if (prev === false) {
document.getElementById('prevCpt').setAttribute('disabled', 'disabled');
} else {
document.getElementById('prevCpt').dataset.prev = prev;
document.getElementById('prevCpt').onclick = function () {
document.getElementById('competencyid_sel').value = document.getElementById('prevCpt').dataset.prev;
}
}
if (next === false) {
document.getElementById('nextCpt').setAttribute('disabled', 'disabled');
} else {
document.getElementById('nextCpt').dataset.next = next;
document.getElementById('nextCpt').onclick = function () {
document.getElementById('competencyid_sel').value = document.getElementById('nextCpt').dataset.next;
}
}
}
}
}
});
})()
\ No newline at end of file
(function() {
window.addEventListener('load', function () {
var opts = document.getElementById('student_list').childNodes;
var studentid = document.getElementById('studentid').innerHTML;
for (var i = 0; i < opts.length; i++) {
if (opts[i].dataset.value === studentid) {
var prev = opts[i - 1] === undefined ? false : opts[i - 1].dataset.value;
var next = opts[i + 1] === undefined ? false : opts[i + 1].dataset.value;
if (prev === false) {
document.getElementById('prevStud').setAttribute('disabled', 'disabled');
} else {
// document.getElementById('prevStud').href += prev;
document.getElementById('prevStud').dataset.prev = prev;
document.getElementById('prevStud').onclick = function () {
document.getElementById('studentid_sel').value = document.getElementById('prevStud').dataset.prev;
}
}
if (next === false) {
document.getElementById('nextStud').setAttribute('disabled', 'disabled');
} else {
// document.getElementById('nextStud').href += next;
document.getElementById('nextStud').dataset.next = next;
document.getElementById('nextStud').onclick = function () {
document.getElementById('studentid_sel').value = document.getElementById('nextStud').dataset.next;
}
}
}
}
/* remplace le nom de l'étu par son id dans la valeur de l'input puis soumet le formulaire */
document.getElementById('studentid_sel').oninput = function (e) {
var val = document.getElementById('studentid_sel').value;
var opts = document.getElementById('student_list').childNodes;
for (var i = 0; i < opts.length; i++) {
if (opts[i].value === val) {
document.getElementById('studentid_sel').value = opts[i].dataset.value;
document.getElementById('change_stud_form').submit();
}
}
};
});
})()
\ No newline at end of file
...@@ -78,3 +78,23 @@ ...@@ -78,3 +78,23 @@
background-color: #008090; background-color: #008090;
color: white; color: white;
} }
/* Dropdown selectors */
.iena-dropdown {
position: absolute;
}
.iena-dropdown a:hover { background-color: #ddd; }
.iena-droplist {
max-height: 250px;
overflow:scroll;
width: 300px;
background-color: #f6f6f6;
}
.iena-drop-item {
text-decoration: none !important;
padding: 0.25rem 0.5rem;
}