2020-09-26 16:19:37 +02:00
|
|
|
// Affichage progressif du trombinoscope html
|
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2020-09-26 16:19:37 +02:00
|
|
|
var spans = $(".unloaded_img");
|
2021-06-21 14:40:58 +02:00
|
|
|
for (var i = 0; i < spans.length; i++) {
|
|
|
|
var sp = spans[i];
|
|
|
|
var etudid = sp.id;
|
|
|
|
$(sp).load(SCO_URL + '/etud_photo_html?etudid=' + etudid);
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// L'URL pour recharger l'état courant de la page (groupes et tab selectionnes)
|
|
|
|
// (ne fonctionne que pour les requetes GET: manipule la query string)
|
|
|
|
|
|
|
|
function groups_view_url() {
|
|
|
|
var url = $.url();
|
|
|
|
delete url.param()['group_ids']; // retire anciens groupes de l'URL
|
|
|
|
delete url.param()['curtab']; // retire ancien tab actif
|
|
|
|
if (CURRENT_TAB_HASH) {
|
|
|
|
url.param()['curtab'] = CURRENT_TAB_HASH;
|
|
|
|
}
|
|
|
|
delete url.param()['formsemestre_id'];
|
|
|
|
url.param()['formsemestre_id'] = $("#group_selector")[0].formsemestre_id.value;
|
|
|
|
|
|
|
|
var selected_groups = $("#group_selector select").val();
|
|
|
|
url.param()['group_ids'] = selected_groups; // remplace par groupes selectionnes
|
2021-06-21 14:40:58 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Selectionne tous les etudiants et recharge la page:
|
|
|
|
function select_tous() {
|
|
|
|
var url = groups_view_url();
|
|
|
|
var default_group_id = $("#group_selector")[0].default_group_id.value;
|
|
|
|
delete url.param()['group_ids'];
|
2021-06-21 14:40:58 +02:00
|
|
|
url.param()['group_ids'] = [default_group_id];
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
var query_string = $.param(url.param(), traditional = true);
|
2020-09-26 16:19:37 +02:00
|
|
|
window.location = url.attr('base') + url.attr('path') + '?' + query_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// L'URL pour l'état courant de la page:
|
|
|
|
function get_current_url() {
|
|
|
|
var url = groups_view_url();
|
2021-06-21 14:40:58 +02:00
|
|
|
var query_string = $.param(url.param(), traditional = true);
|
2020-09-26 16:19:37 +02:00
|
|
|
return url.attr('base') + url.attr('path') + '?' + query_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Recharge la page en changeant les groupes selectionnés et en conservant le tab actif:
|
|
|
|
function submit_group_selector() {
|
|
|
|
window.location = get_current_url();
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_current_tab() {
|
2021-06-21 14:40:58 +02:00
|
|
|
$('.nav-tabs [href="#' + CURRENT_TAB_HASH + '"]').tab('show');
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var CURRENT_TAB_HASH = $.url().param()['curtab'];
|
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2020-09-26 16:19:37 +02:00
|
|
|
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
|
|
|
CURRENT_TAB_HASH = e.target.hash.slice(1); // sans le #
|
|
|
|
});
|
|
|
|
|
|
|
|
show_current_tab();
|
|
|
|
});
|
|
|
|
|
|
|
|
function change_list_options() {
|
|
|
|
var url = groups_view_url();
|
|
|
|
var selected_options = $("#group_list_options").val();
|
2022-12-07 15:52:50 +01:00
|
|
|
var options = ["with_paiement", "with_archives", "with_annotations", "with_codes", "with_bourse"];
|
2021-06-21 14:40:58 +02:00
|
|
|
for (var i = 0; i < options.length; i++) {
|
2020-09-26 16:19:37 +02:00
|
|
|
var option = options[i];
|
|
|
|
delete url.param()[option];
|
2021-06-21 14:40:58 +02:00
|
|
|
if ($.inArray(option, selected_options) >= 0) {
|
2020-09-26 16:19:37 +02:00
|
|
|
url.param()[option] = 1;
|
|
|
|
}
|
|
|
|
}
|
2021-06-21 14:40:58 +02:00
|
|
|
var query_string = $.param(url.param(), traditional = true);
|
2020-09-26 16:19:37 +02:00
|
|
|
window.location = url.attr('base') + url.attr('path') + '?' + query_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Menu choix groupe:
|
|
|
|
function toggle_visible_etuds() {
|
|
|
|
//
|
|
|
|
$(".etud_elem").hide();
|
|
|
|
var qargs = "";
|
2021-06-21 14:40:58 +02:00
|
|
|
$("#group_ids_sel option:selected").each(function (index, opt) {
|
2020-09-26 16:19:37 +02:00
|
|
|
var group_id = opt.value;
|
2021-08-11 13:01:37 +02:00
|
|
|
$(".group-" + group_id).show();
|
2020-09-26 16:19:37 +02:00
|
|
|
qargs += "&group_ids=" + group_id;
|
|
|
|
});
|
|
|
|
// Update url saisie tableur:
|
|
|
|
var input_eval = $("#formnotes_evaluation_id");
|
|
|
|
if (input_eval.length > 0) {
|
|
|
|
var evaluation_id = input_eval[0].value;
|
2021-06-21 14:40:58 +02:00
|
|
|
$("#menu_saisie_tableur a").attr("href", "saisie_notes_tableur?evaluation_id=" + evaluation_id + qargs);
|
2020-09-26 16:19:37 +02:00
|
|
|
// lien feuille excel:
|
2021-06-21 14:40:58 +02:00
|
|
|
$("#lnk_feuille_saisie").attr("href", "feuille_saisie_notes?evaluation_id=" + evaluation_id + qargs);
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
2022-12-25 03:27:28 +01:00
|
|
|
// Update champs form group_ids_str
|
|
|
|
let group_ids_str = Array.from(
|
|
|
|
document.querySelectorAll("#group_ids_sel option:checked")
|
|
|
|
).map(
|
|
|
|
function (elem) { return elem.value; }
|
|
|
|
).join();
|
|
|
|
document.querySelectorAll("input.group_ids_str").forEach(elem => elem.value = group_ids_str);
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2020-09-26 16:19:37 +02:00
|
|
|
$('#group_ids_sel').multiselect(
|
|
|
|
{
|
|
|
|
includeSelectAllOption: false,
|
2021-06-21 14:40:58 +02:00
|
|
|
nonSelectedText: 'choisir...',
|
2020-09-26 16:19:37 +02:00
|
|
|
// buttonContainer: '<div id="group_ids_sel_container"/>',
|
2021-06-21 14:40:58 +02:00
|
|
|
onChange: function (element, checked) {
|
2020-09-26 16:19:37 +02:00
|
|
|
if (checked == true) {
|
|
|
|
var default_group_id = $(".default_group")[0].value;
|
2021-06-21 14:40:58 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
if (element.hasClass("default_group")) {
|
|
|
|
// click sur groupe "tous"
|
|
|
|
// deselectionne les autres
|
2021-06-21 14:40:58 +02:00
|
|
|
$("#group_ids_sel option:selected").each(function (index, opt) {
|
2020-09-26 16:19:37 +02:00
|
|
|
if (opt.value != default_group_id) {
|
|
|
|
$("#group_ids_sel").multiselect('deselect', opt.value);
|
|
|
|
}
|
|
|
|
});
|
2021-06-21 14:40:58 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
} else {
|
|
|
|
// click sur un autre item
|
|
|
|
// si le groupe "tous" est selectionne et que l'on coche un autre, le deselectionner
|
|
|
|
var default_is_selected = false;
|
2021-06-21 14:40:58 +02:00
|
|
|
$("#group_ids_sel option:selected").each(function (index, opt) {
|
2020-09-26 16:19:37 +02:00
|
|
|
if (opt.value == default_group_id) {
|
|
|
|
default_is_selected = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (default_is_selected) {
|
|
|
|
$("#group_ids_sel").multiselect('deselect', default_group_id);
|
|
|
|
}
|
2021-06-21 14:40:58 +02:00
|
|
|
}
|
|
|
|
}
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
toggle_visible_etuds();
|
|
|
|
// referme le menu apres chaque choix:
|
|
|
|
$("#group_selector .btn-group").removeClass('open');
|
2021-06-21 14:40:58 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
if ($("#group_ids_sel").hasClass("submit_on_change")) {
|
|
|
|
submit_group_selector();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// initial setup
|
|
|
|
toggle_visible_etuds();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Trombinoscope
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
var elems = $(".trombi-photo");
|
2021-06-21 14:40:58 +02:00
|
|
|
for (var i = 0; i < elems.length; i++) {
|
|
|
|
$(elems[i]).qtip(
|
|
|
|
{
|
|
|
|
content: {
|
|
|
|
ajax: {
|
|
|
|
url: SCO_URL + "/etud_info_html?with_photo=0&etudid=" + get_etudid_from_elem(elems[i])
|
|
|
|
},
|
|
|
|
text: "Loading..."
|
|
|
|
},
|
|
|
|
position: {
|
|
|
|
at: "right",
|
|
|
|
my: "left top"
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
classes: 'qtip-etud'
|
|
|
|
},
|
|
|
|
// utile pour debugguer le css:
|
|
|
|
// hide: { event: 'unfocus' }
|
|
|
|
}
|
|
|
|
);
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
});
|