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;
|
2023-11-16 23:34:47 +01:00
|
|
|
$(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();
|
2023-11-16 23:34:47 +01:00
|
|
|
delete url.param()["group_ids"]; // retire anciens groupes de l'URL
|
|
|
|
delete url.param()["curtab"]; // retire ancien tab actif
|
2020-09-26 16:19:37 +02:00
|
|
|
if (CURRENT_TAB_HASH) {
|
2023-11-16 23:34:47 +01:00
|
|
|
url.param()["curtab"] = CURRENT_TAB_HASH;
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
2023-11-16 23:34:47 +01:00
|
|
|
delete url.param()["formsemestre_id"];
|
|
|
|
url.param()["formsemestre_id"] =
|
|
|
|
$("#group_selector")[0].formsemestre_id.value;
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
var selected_groups = $("#group_selector select").val();
|
2023-11-16 23:34:47 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-11-16 23:34:47 +01:00
|
|
|
// Sélectionne le groupe "tous" et recharge la page:
|
|
|
|
function select_groupe_tous() {
|
2020-09-26 16:19:37 +02:00
|
|
|
var url = groups_view_url();
|
|
|
|
var default_group_id = $("#group_selector")[0].default_group_id.value;
|
2023-11-16 23:34:47 +01:00
|
|
|
delete url.param()["group_ids"];
|
|
|
|
url.param()["group_ids"] = [default_group_id];
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-11-16 23:34:47 +01:00
|
|
|
var query_string = $.param(url.param(), (traditional = true));
|
|
|
|
window.location = url.attr("base") + url.attr("path") + "?" + query_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Recharge la page sans arguments group_ids
|
|
|
|
function remove_group_filter() {
|
|
|
|
var url = groups_view_url();
|
|
|
|
delete url.param()["group_ids"];
|
|
|
|
var query_string = $.param(url.param(), (traditional = true));
|
|
|
|
window.location = url.attr("base") + url.attr("path") + "?" + query_string;
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// L'URL pour l'état courant de la page:
|
|
|
|
function get_current_url() {
|
|
|
|
var url = groups_view_url();
|
2023-11-16 23:34:47 +01:00
|
|
|
var query_string = $.param(url.param(), (traditional = true));
|
|
|
|
return url.attr("base") + url.attr("path") + "?" + query_string;
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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() {
|
2023-11-16 23:34:47 +01:00
|
|
|
if (document.getElementsByClassName("nav-tabs").length < 0) {
|
|
|
|
$('.nav-tabs [href="#' + CURRENT_TAB_HASH + '"]').tab("show");
|
|
|
|
}
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
2023-11-16 23:34:47 +01:00
|
|
|
var CURRENT_TAB_HASH = $.url().param()["curtab"];
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2023-11-16 23:34:47 +01:00
|
|
|
$(".nav-tabs a").on("shown.bs.tab", function (e) {
|
2020-09-26 16:19:37 +02:00
|
|
|
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();
|
2023-11-16 23:34:47 +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;
|
|
|
|
}
|
|
|
|
}
|
2023-11-16 23:34:47 +01:00
|
|
|
var query_string = $.param(url.param(), (traditional = true));
|
|
|
|
window.location = url.attr("base") + url.attr("path") + "?" + query_string;
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
2023-11-16 23:34:47 +01: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:
|
2023-11-16 23:34:47 +01: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")
|
2023-11-16 23:34:47 +01:00
|
|
|
)
|
|
|
|
.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 () {
|
2023-11-16 23:34:47 +01:00
|
|
|
$("#group_ids_sel").multiselect({
|
|
|
|
includeSelectAllOption: false,
|
|
|
|
nonSelectedText: "choisir...",
|
|
|
|
// buttonContainer: '<div id="group_ids_sel_container"/>',
|
|
|
|
onChange: function (element, checked) {
|
|
|
|
// Gestion du groupe "tous"
|
|
|
|
if (
|
|
|
|
checked == true &&
|
|
|
|
$("#group_ids_sel").hasClass("default_deselect_others")
|
|
|
|
) {
|
|
|
|
var default_group_id = $(".default_group")[0].value;
|
|
|
|
|
|
|
|
if (element.hasClass("default_group")) {
|
|
|
|
// click sur groupe "tous"
|
|
|
|
// deselectionne les autres
|
|
|
|
$("#group_ids_sel option:selected").each(function (
|
|
|
|
index,
|
|
|
|
opt
|
|
|
|
) {
|
|
|
|
if (opt.value != default_group_id) {
|
|
|
|
$("#group_ids_sel").multiselect(
|
|
|
|
"deselect",
|
|
|
|
opt.value
|
|
|
|
);
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
2023-11-16 23:34:47 +01: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;
|
|
|
|
$("#group_ids_sel option:selected").each(function (
|
|
|
|
index,
|
|
|
|
opt
|
|
|
|
) {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2023-11-16 23:34:47 +01:00
|
|
|
}
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-11-16 23:34:47 +01:00
|
|
|
toggle_visible_etuds();
|
|
|
|
// referme le menu apres chaque choix:
|
|
|
|
$("#group_selector .btn-group").removeClass("open");
|
2021-06-21 14:40:58 +02:00
|
|
|
|
2023-11-16 23:34:47 +01:00
|
|
|
if ($("#group_ids_sel").hasClass("submit_on_change")) {
|
|
|
|
submit_group_selector();
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
2023-11-16 23:34:47 +01:00
|
|
|
},
|
|
|
|
});
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
// 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++) {
|
2023-11-16 23:34:47 +01:00
|
|
|
$(elems[i]).qtip({
|
|
|
|
content: {
|
|
|
|
ajax: {
|
|
|
|
url:
|
|
|
|
SCO_URL +
|
|
|
|
"/etud_info_html?with_photo=0&etudid=" +
|
|
|
|
get_etudid_from_elem(elems[i]),
|
2021-06-21 14:40:58 +02:00
|
|
|
},
|
2023-11-16 23:34:47 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
});
|