2020-09-26 16:19:37 +02:00
|
|
|
// Affichage progressif du trombinoscope html
|
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2023-11-17 13:53:17 +01:00
|
|
|
var spans = $(".unloaded_img");
|
|
|
|
for (var i = 0; i < spans.length; i++) {
|
|
|
|
var sp = spans[i];
|
|
|
|
var etudid = sp.id;
|
2024-04-10 18:40:32 +02:00
|
|
|
$(sp).load(SCO_URL + "etud_photo_html?etudid=" + etudid);
|
2023-11-17 13:53:17 +01:00
|
|
|
}
|
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() {
|
2023-11-17 13:53:17 +01:00
|
|
|
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;
|
|
|
|
|
2024-03-31 23:04:54 +02:00
|
|
|
var selected_groups = $("#group_selector select#group_ids_sel").val();
|
2023-11-17 13:53:17 +01:00
|
|
|
url.param()["group_ids"] = selected_groups; // remplace par groupes selectionnes
|
|
|
|
|
|
|
|
return url;
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
2023-11-16 23:34:47 +01:00
|
|
|
// Sélectionne le groupe "tous" et recharge la page:
|
|
|
|
function select_groupe_tous() {
|
2023-11-17 13:53:17 +01:00
|
|
|
var url = groups_view_url();
|
|
|
|
var default_group_id = $("#group_selector")[0].default_group_id.value;
|
|
|
|
delete url.param()["group_ids"];
|
|
|
|
url.param()["group_ids"] = [default_group_id];
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-11-17 13:53:17 +01:00
|
|
|
var query_string = $.param(url.param(), (traditional = true));
|
|
|
|
window.location = url.attr("base") + url.attr("path") + "?" + query_string;
|
2023-11-16 23:34:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Recharge la page sans arguments group_ids
|
|
|
|
function remove_group_filter() {
|
2023-11-17 13:53:17 +01:00
|
|
|
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() {
|
2023-11-17 13:53:17 +01:00
|
|
|
var url = groups_view_url();
|
|
|
|
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() {
|
2023-11-17 13:53:17 +01:00
|
|
|
window.location = get_current_url();
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function show_current_tab() {
|
2023-11-17 13:53:17 +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-17 13:53:17 +01:00
|
|
|
$(".nav-tabs a").on("shown.bs.tab", function (e) {
|
|
|
|
CURRENT_TAB_HASH = e.target.hash.slice(1); // sans le #
|
|
|
|
});
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-11-17 13:53:17 +01:00
|
|
|
show_current_tab();
|
2020-09-26 16:19:37 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
function change_list_options() {
|
2023-11-17 13:53:17 +01:00
|
|
|
var url = groups_view_url();
|
|
|
|
var selected_options = $("#group_list_options").val();
|
|
|
|
var options = [
|
|
|
|
"with_paiement",
|
|
|
|
"with_archives",
|
|
|
|
"with_annotations",
|
|
|
|
"with_codes",
|
|
|
|
"with_bourse",
|
|
|
|
];
|
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
var option = options[i];
|
|
|
|
delete url.param()[option];
|
|
|
|
if ($.inArray(option, selected_options) >= 0) {
|
|
|
|
url.param()[option] = 1;
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
2023-11-17 13:53:17 +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() {
|
2023-11-17 13:53:17 +01:00
|
|
|
//
|
|
|
|
$(".etud_elem").hide();
|
|
|
|
var qargs = "";
|
|
|
|
$("#group_ids_sel option:selected").each(function (index, opt) {
|
|
|
|
var group_id = opt.value;
|
|
|
|
$(".group-" + group_id).show();
|
|
|
|
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;
|
|
|
|
$("#menu_saisie_tableur a").attr(
|
|
|
|
"href",
|
|
|
|
"saisie_notes_tableur?evaluation_id=" + evaluation_id + qargs
|
|
|
|
);
|
|
|
|
// lien feuille excel:
|
|
|
|
$("#lnk_feuille_saisie").attr(
|
|
|
|
"href",
|
|
|
|
"feuille_saisie_notes?evaluation_id=" + evaluation_id + qargs
|
|
|
|
);
|
|
|
|
}
|
|
|
|
// 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 () {
|
2023-11-17 13:53:17 +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);
|
2023-11-16 23:34:47 +01:00
|
|
|
}
|
2023-11-17 13:53:17 +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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-11-17 13:53:17 +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-17 13:53:17 +01:00
|
|
|
if ($("#group_ids_sel").hasClass("submit_on_change")) {
|
|
|
|
submit_group_selector();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-11-17 13:53:17 +01:00
|
|
|
// initial setup
|
|
|
|
toggle_visible_etuds();
|
2020-09-26 16:19:37 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Trombinoscope
|
2021-06-21 14:40:58 +02:00
|
|
|
$().ready(function () {
|
2023-11-17 13:53:17 +01:00
|
|
|
var elems = $(".trombi-photo");
|
|
|
|
for (var i = 0; i < elems.length; i++) {
|
|
|
|
$(elems[i]).qtip({
|
|
|
|
content: {
|
|
|
|
ajax: {
|
|
|
|
url:
|
|
|
|
SCO_URL +
|
2024-04-10 18:40:32 +02:00
|
|
|
"etud_info_html?with_photo=0&etudid=" +
|
2023-11-17 13:53:17 +01:00
|
|
|
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
|
|
|
});
|