2020-09-26 16:19:37 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Gestion scolarite IUT
|
|
|
|
#
|
2023-12-31 23:04:06 +01:00
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
"""ScoDoc fiche_etud
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
Fiche description d'un étudiant et de son parcours
|
|
|
|
|
|
|
|
"""
|
2024-01-20 14:49:36 +01:00
|
|
|
from flask import url_for, g, render_template, request
|
2021-09-18 13:42:19 +02:00
|
|
|
from flask_login import current_user
|
2024-01-20 14:49:36 +01:00
|
|
|
import sqlalchemy as sa
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
from app import log
|
|
|
|
from app.auth.models import User
|
2024-02-21 17:47:54 +01:00
|
|
|
from app.but import cursus_but, validations_view
|
2024-07-06 23:28:20 +02:00
|
|
|
from app.models import (
|
|
|
|
Adresse,
|
|
|
|
EtudAnnotation,
|
|
|
|
FormSemestre,
|
|
|
|
Identite,
|
|
|
|
ScoDocSiteConfig,
|
|
|
|
ValidationDUT120,
|
|
|
|
)
|
2024-01-20 14:49:36 +01:00
|
|
|
from app.scodoc import (
|
|
|
|
codes_cursus,
|
|
|
|
htmlutils,
|
|
|
|
sco_archives_etud,
|
|
|
|
sco_bac,
|
|
|
|
sco_cursus,
|
|
|
|
sco_etud,
|
|
|
|
sco_groups,
|
|
|
|
sco_permissions_check,
|
|
|
|
sco_report,
|
|
|
|
)
|
2024-01-21 18:07:56 +01:00
|
|
|
from app.scodoc.html_sidebar import retreive_formsemestre_from_request
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.sco_bulletins import etud_descr_situation_semestre
|
|
|
|
from app.scodoc.sco_exceptions import ScoValueError
|
|
|
|
from app.scodoc.sco_formsemestre_validation import formsemestre_recap_parcours_table
|
|
|
|
from app.scodoc.sco_permissions import Permission
|
2023-07-11 06:57:38 +02:00
|
|
|
import app.scodoc.sco_utils as scu
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2023-06-30 17:26:41 +02:00
|
|
|
def _menu_scolarite(
|
|
|
|
authuser, formsemestre: FormSemestre, etudid: int, etat_inscription: str
|
|
|
|
):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""HTML pour menu "scolarite" pour un etudiant dans un semestre.
|
|
|
|
Le contenu du menu depend des droits de l'utilisateur et de l'état de l'étudiant.
|
|
|
|
"""
|
2023-06-30 17:26:41 +02:00
|
|
|
locked = not formsemestre.etat
|
2020-09-26 16:19:37 +02:00
|
|
|
if locked:
|
2021-02-04 20:02:44 +01:00
|
|
|
lockicon = scu.icontag("lock32_img", title="verrouillé", border="0")
|
2020-09-26 16:19:37 +02:00
|
|
|
return lockicon # no menu
|
|
|
|
if not authuser.has_permission(
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit
|
|
|
|
) and not authuser.has_permission(Permission.EtudChangeGroups):
|
2020-09-26 16:19:37 +02:00
|
|
|
return "" # no menu
|
|
|
|
|
2023-06-30 17:26:41 +02:00
|
|
|
args = {"etudid": etudid, "formsemestre_id": formsemestre.id}
|
|
|
|
|
|
|
|
if etat_inscription != scu.DEMISSION:
|
2020-09-26 16:19:37 +02:00
|
|
|
dem_title = "Démission"
|
2022-09-30 22:43:39 +02:00
|
|
|
dem_url = "scolar.form_dem"
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
dem_title = "Annuler la démission"
|
2022-09-30 22:43:39 +02:00
|
|
|
dem_url = "scolar.do_cancel_dem"
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
# Note: seul un etudiant inscrit (I) peut devenir défaillant.
|
2023-06-30 17:26:41 +02:00
|
|
|
if etat_inscription != codes_cursus.DEF:
|
2020-09-26 16:19:37 +02:00
|
|
|
def_title = "Déclarer défaillance"
|
2022-09-30 22:43:39 +02:00
|
|
|
def_url = "scolar.form_def"
|
2023-06-30 17:26:41 +02:00
|
|
|
elif etat_inscription == codes_cursus.DEF:
|
2020-09-26 16:19:37 +02:00
|
|
|
def_title = "Annuler la défaillance"
|
2022-09-30 22:43:39 +02:00
|
|
|
def_url = "scolar.do_cancel_def"
|
2020-09-26 16:19:37 +02:00
|
|
|
def_enabled = (
|
2023-06-30 17:26:41 +02:00
|
|
|
(etat_inscription != scu.DEMISSION)
|
2023-09-29 21:17:31 +02:00
|
|
|
and authuser.has_permission(Permission.EtudInscrit)
|
2020-09-26 16:19:37 +02:00
|
|
|
and not locked
|
|
|
|
)
|
|
|
|
items = [
|
|
|
|
{
|
|
|
|
"title": dem_title,
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": dem_url,
|
|
|
|
"args": args,
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit) and not locked,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Validation du semestre (jury)",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_validation_etud_form",
|
|
|
|
"args": args,
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit) and not locked,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2021-07-05 23:53:23 +02:00
|
|
|
{
|
|
|
|
"title": def_title,
|
|
|
|
"endpoint": def_url,
|
|
|
|
"args": args,
|
|
|
|
"enabled": def_enabled,
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
2024-07-10 00:53:09 +02:00
|
|
|
"title": "Désinscrire (en cas d'erreur)",
|
|
|
|
"endpoint": "notes.formsemestre_desinscription",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": args,
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit) and not locked,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
2024-07-10 00:53:09 +02:00
|
|
|
"title": "Inscrire à un module optionnel (ou au sport)",
|
|
|
|
"endpoint": "notes.formsemestre_inscription_option",
|
2021-07-05 23:53:23 +02:00
|
|
|
"args": args,
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit) and not locked,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2023-06-30 17:26:41 +02:00
|
|
|
{
|
|
|
|
"title": "Gérer les validations d'UEs antérieures",
|
|
|
|
"endpoint": "notes.formsemestre_validate_previous_ue",
|
|
|
|
"args": args,
|
|
|
|
"enabled": formsemestre.can_edit_jury(),
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Enregistrer un semestre effectué ailleurs",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_ext_create_form",
|
2021-07-05 23:53:23 +02:00
|
|
|
"args": args,
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EditFormSemestre),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2022-10-06 14:06:02 +02:00
|
|
|
{
|
|
|
|
"title": "Affecter les notes manquantes",
|
|
|
|
"endpoint": "notes.formsemestre_note_etuds_sans_notes",
|
|
|
|
"args": args,
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EditAllNotes),
|
2022-10-06 14:06:02 +02:00
|
|
|
},
|
2024-07-10 00:53:09 +02:00
|
|
|
{
|
|
|
|
"title": "Inscrire à un autre semestre",
|
|
|
|
"endpoint": "notes.formsemestre_inscription_with_modules_form",
|
|
|
|
"args": {"etudid": etudid},
|
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit),
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
|
2021-01-17 22:31:28 +01:00
|
|
|
return htmlutils.make_menu(
|
|
|
|
"Scolarité", items, css_class="direction_etud", alone=True
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
def fiche_etud(etudid=None):
|
2020-09-26 16:19:37 +02:00
|
|
|
"fiche d'informations sur un etudiant"
|
2024-01-20 14:49:36 +01:00
|
|
|
restrict_etud_data = not current_user.has_permission(Permission.ViewEtudData)
|
|
|
|
try:
|
|
|
|
etud = Identite.get_etud(etudid)
|
|
|
|
except Exception as exc:
|
|
|
|
log(f"fiche_etud: etudid={etudid!r} request.args={request.args!r}")
|
|
|
|
raise ScoValueError("Étudiant inexistant !") from exc
|
|
|
|
# la sidebar est differente s'il y a ou pas un etudid
|
|
|
|
# voir html_sidebar.sidebar()
|
|
|
|
g.etudid = etudid
|
|
|
|
info = etud.to_dict_scodoc7(restrict=restrict_etud_data)
|
2023-03-13 06:39:36 +01:00
|
|
|
if etud.prenom_etat_civil:
|
|
|
|
info["etat_civil"] = (
|
|
|
|
"<h3>Etat-civil: "
|
|
|
|
+ etud.civilite_etat_civil_str
|
|
|
|
+ " "
|
|
|
|
+ etud.prenom_etat_civil
|
|
|
|
+ " "
|
|
|
|
+ etud.nom
|
|
|
|
+ "</h3>"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
info["etat_civil"] = ""
|
2024-04-08 18:56:43 +02:00
|
|
|
info["ScoURL"] = url_for("scolar.index_html", scodoc_dept=g.scodoc_dept)
|
2024-01-20 14:49:36 +01:00
|
|
|
info["authuser"] = current_user
|
|
|
|
if restrict_etud_data:
|
|
|
|
info["info_naissance"] = ""
|
|
|
|
adresse = None
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2024-01-20 14:49:36 +01:00
|
|
|
info["info_naissance"] = info["date_naissance"]
|
|
|
|
if info["lieu_naissance"]:
|
|
|
|
info["info_naissance"] += " à " + info["lieu_naissance"]
|
|
|
|
if info["dept_naissance"]:
|
|
|
|
info["info_naissance"] += f" ({info['dept_naissance']})"
|
|
|
|
adresse = etud.adresses.first()
|
|
|
|
info.update(_format_adresse(adresse))
|
|
|
|
|
|
|
|
info.update(etud.inscription_descr())
|
|
|
|
info["etudfoto"] = etud.photo_html()
|
|
|
|
|
2022-05-09 19:56:40 +02:00
|
|
|
# Champ dépendant des permissions:
|
2024-01-20 17:37:24 +01:00
|
|
|
if current_user.has_permission(
|
|
|
|
Permission.EtudChangeAdr
|
|
|
|
) and current_user.has_permission(Permission.ViewEtudData):
|
2022-09-27 12:21:19 +02:00
|
|
|
info[
|
|
|
|
"modifadresse"
|
|
|
|
] = f"""<a class="stdlink" href="{
|
2023-12-06 23:05:23 +01:00
|
|
|
url_for("scolar.form_change_coordonnees",
|
2022-09-27 12:21:19 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid)
|
|
|
|
}">modifier adresse</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
info["modifadresse"] = ""
|
|
|
|
|
|
|
|
# Groupes:
|
2024-01-20 14:49:36 +01:00
|
|
|
inscription_courante = etud.inscription_courante()
|
2022-03-05 12:47:08 +01:00
|
|
|
sco_groups.etud_add_group_infos(
|
2022-05-09 19:56:40 +02:00
|
|
|
info,
|
2024-01-20 14:49:36 +01:00
|
|
|
inscription_courante.formsemestre.id if inscription_courante else None,
|
2022-05-09 19:56:40 +02:00
|
|
|
only_to_show=True,
|
2022-03-05 12:47:08 +01:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
# Parcours de l'étudiant
|
2024-01-22 16:30:18 +01:00
|
|
|
last_formsemestre = None
|
2024-01-20 14:49:36 +01:00
|
|
|
inscriptions = etud.inscriptions()
|
|
|
|
info["last_formsemestre_id"] = (
|
|
|
|
inscriptions[0].formsemestre.id if inscriptions else ""
|
|
|
|
)
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
sem_info = {}
|
2024-01-20 14:49:36 +01:00
|
|
|
for inscription in inscriptions:
|
|
|
|
formsemestre = inscription.formsemestre
|
|
|
|
if inscription.etat != scu.INSCRIT:
|
2021-02-04 20:02:44 +01:00
|
|
|
descr, _ = etud_descr_situation_semestre(
|
2020-09-26 16:19:37 +02:00
|
|
|
etudid,
|
2023-03-08 22:56:11 +01:00
|
|
|
formsemestre,
|
2024-01-20 14:49:36 +01:00
|
|
|
etud.e,
|
2020-09-26 16:19:37 +02:00
|
|
|
show_date_inscr=False,
|
|
|
|
)
|
2022-09-27 12:21:19 +02:00
|
|
|
grlink = f"""<span class="fontred">{descr["situation"]}</span>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2022-05-09 19:56:40 +02:00
|
|
|
e = {"etudid": etudid}
|
2024-01-20 14:49:36 +01:00
|
|
|
sco_groups.etud_add_group_infos(e, formsemestre.id, only_to_show=True)
|
2022-05-09 19:56:40 +02:00
|
|
|
|
|
|
|
grlinks = []
|
|
|
|
for partition in e["partitions"].values():
|
|
|
|
if partition["partition_name"]:
|
|
|
|
gr_name = partition["group_name"]
|
|
|
|
else:
|
|
|
|
gr_name = "tous"
|
|
|
|
|
|
|
|
grlinks.append(
|
|
|
|
f"""<a class="discretelink" href="{
|
2024-08-22 22:02:34 +02:00
|
|
|
url_for('scolar.groups_lists',
|
2022-05-09 19:56:40 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, group_ids=partition['group_id'])
|
|
|
|
}" title="Liste du groupe {gr_name}">{gr_name}</a>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
grlink = ", ".join(grlinks)
|
2020-09-26 16:19:37 +02:00
|
|
|
# infos ajoutées au semestre dans le parcours (groupe, menu)
|
2024-01-20 14:49:36 +01:00
|
|
|
menu = _menu_scolarite(current_user, formsemestre, etudid, inscription.etat)
|
2020-09-26 16:19:37 +02:00
|
|
|
if menu:
|
2024-01-20 14:49:36 +01:00
|
|
|
sem_info[formsemestre.id] = (
|
2020-09-26 16:19:37 +02:00
|
|
|
"<table><tr><td>" + grlink + "</td><td>" + menu + "</td></tr></table>"
|
|
|
|
)
|
|
|
|
else:
|
2024-01-20 14:49:36 +01:00
|
|
|
sem_info[formsemestre.id] = grlink
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
if inscriptions:
|
2024-06-07 17:58:02 +02:00
|
|
|
Se = sco_cursus.get_situation_etud_cursus(etud, info["last_formsemestre_id"])
|
2020-09-26 16:19:37 +02:00
|
|
|
info["liste_inscriptions"] = formsemestre_recap_parcours_table(
|
|
|
|
Se,
|
|
|
|
etudid,
|
|
|
|
with_links=False,
|
|
|
|
sem_info=sem_info,
|
|
|
|
with_all_columns=False,
|
|
|
|
)
|
2023-12-06 23:05:23 +01:00
|
|
|
info["link_bul_pdf"] = (
|
|
|
|
"""<span class="link_bul_pdf fontred">PDF interdits par l'admin.</span>"""
|
|
|
|
if ScoDocSiteConfig.is_bul_pdf_disabled()
|
|
|
|
else f"""
|
2023-07-16 19:59:45 +02:00
|
|
|
<span class="link_bul_pdf">
|
|
|
|
<a class="stdlink" href="{
|
|
|
|
url_for("notes.etud_bulletins_pdf", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2023-07-17 22:03:11 +02:00
|
|
|
}">Tous les bulletins</a>
|
2023-07-16 19:59:45 +02:00
|
|
|
</span>
|
|
|
|
"""
|
2023-12-06 23:05:23 +01:00
|
|
|
)
|
2024-01-20 14:49:36 +01:00
|
|
|
last_formsemestre: FormSemestre = inscriptions[0].formsemestre
|
2023-07-16 19:59:45 +02:00
|
|
|
if last_formsemestre.formation.is_apc() and last_formsemestre.semestre_id > 2:
|
|
|
|
info[
|
|
|
|
"link_bul_pdf"
|
|
|
|
] += f"""
|
|
|
|
<span class="link_bul_pdf">
|
|
|
|
<a class="stdlink" href="{
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("notes.validation_rcues",
|
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid, formsemestre_id=last_formsemestre.id)
|
2023-07-16 19:59:45 +02:00
|
|
|
}">Visualiser les compétences BUT</a>
|
|
|
|
</span>
|
|
|
|
"""
|
2024-07-15 13:45:02 +02:00
|
|
|
info["link_inscrire_ailleurs"] = (
|
|
|
|
f"""<span class="link_bul_pdf"><a class="stdlink" href="{
|
2023-12-06 23:05:23 +01:00
|
|
|
url_for("notes.formsemestre_inscription_with_modules_form",
|
2022-09-27 12:21:19 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2023-07-17 22:03:11 +02:00
|
|
|
}">Inscrire à un autre semestre</a></span>
|
2024-07-15 13:45:02 +02:00
|
|
|
"""
|
|
|
|
if current_user.has_permission(Permission.EtudInscrit)
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
can_edit_jury = current_user.has_permission(Permission.EtudInscrit)
|
|
|
|
info[
|
|
|
|
"link_inscrire_ailleurs"
|
|
|
|
] += f"""
|
2023-06-19 22:07:31 +02:00
|
|
|
<span class="link_bul_pdf"><a class="stdlink" href="{
|
2023-12-06 23:05:23 +01:00
|
|
|
url_for("notes.jury_delete_manual",
|
2024-07-15 13:45:02 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid,
|
|
|
|
read_only=not can_edit_jury)
|
|
|
|
}">{'Éditer' if can_edit_jury else 'Détail de'} toutes décisions de jury</a></span>
|
2023-06-19 22:07:31 +02:00
|
|
|
"""
|
|
|
|
|
2024-07-10 00:53:09 +02:00
|
|
|
info[
|
|
|
|
"link_bilan_ects"
|
|
|
|
] = f"""<span class="link_bul_pdf"><a class="stdlink" href="{
|
|
|
|
url_for("notes.etud_bilan_ects",
|
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid)
|
|
|
|
}">ECTS</a></span>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
# non inscrit
|
2024-01-20 14:49:36 +01:00
|
|
|
l = [f"""<p><b>Étudiant{etud.e} non inscrit{etud.e}"""]
|
|
|
|
if current_user.has_permission(Permission.EtudInscrit):
|
2020-09-26 16:19:37 +02:00
|
|
|
l.append(
|
2022-09-27 12:21:19 +02:00
|
|
|
f"""<a href="{
|
|
|
|
url_for("notes.formsemestre_inscription_with_modules_form",
|
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid)
|
|
|
|
}">inscrire</a></li>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
l.append("</b></b>")
|
|
|
|
info["liste_inscriptions"] = "\n".join(l)
|
|
|
|
info["link_bul_pdf"] = ""
|
2021-09-25 15:12:38 +02:00
|
|
|
info["link_inscrire_ailleurs"] = ""
|
2024-07-10 00:53:09 +02:00
|
|
|
info["link_bilan_ects"] = ""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
# Liste des annotations
|
2024-02-10 15:02:18 +01:00
|
|
|
html_annotations_list = "\n".join(
|
|
|
|
[] if restrict_etud_data else get_html_annotations_list(etud)
|
2024-01-20 14:49:36 +01:00
|
|
|
)
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
# fiche admission
|
2024-03-19 09:34:03 +01:00
|
|
|
if etud.admission:
|
|
|
|
infos_admission = _infos_admission(etud, restrict_etud_data)
|
|
|
|
has_adm_notes = any(
|
|
|
|
infos_admission[k] for k in ("math", "physique", "anglais", "francais")
|
2024-01-20 14:49:36 +01:00
|
|
|
)
|
2024-03-19 09:34:03 +01:00
|
|
|
has_bac_info = any(
|
|
|
|
infos_admission[k]
|
|
|
|
for k in (
|
|
|
|
"bac_specialite",
|
|
|
|
"annee_bac",
|
|
|
|
"rapporteur",
|
|
|
|
"commentaire",
|
|
|
|
"classement",
|
|
|
|
"type_admission",
|
|
|
|
"rap",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if has_bac_info or has_adm_notes:
|
|
|
|
adm_tmpl = """<!-- Donnees admission -->
|
|
|
|
<div class="fichetitre">Informations admission</div>
|
|
|
|
"""
|
|
|
|
if has_adm_notes:
|
|
|
|
adm_tmpl += """
|
2020-09-26 16:19:37 +02:00
|
|
|
<table>
|
|
|
|
<tr><th>Bac</th><th>Année</th><th>Rg</th>
|
|
|
|
<th>Math</th><th>Physique</th><th>Anglais</th><th>Français</th></tr>
|
|
|
|
<tr>
|
2024-01-20 14:49:36 +01:00
|
|
|
<td>%(bac_specialite)s</td>
|
2020-09-26 16:19:37 +02:00
|
|
|
<td>%(annee_bac)s </td>
|
|
|
|
<td>%(classement)s</td>
|
|
|
|
<td>%(math)s</td><td>%(physique)s</td><td>%(anglais)s</td><td>%(francais)s</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2024-03-19 09:34:03 +01:00
|
|
|
"""
|
|
|
|
adm_tmpl += """
|
|
|
|
<div>Bac %(bac_specialite)s obtenu en %(annee_bac)s </div>
|
|
|
|
<div class="info_lycee">%(info_lycee)s</div>"""
|
|
|
|
if infos_admission["type_admission"] or infos_admission["classement"]:
|
|
|
|
adm_tmpl += """<div class="vadmission">"""
|
|
|
|
if infos_admission["type_admission"]:
|
|
|
|
adm_tmpl += """<span>Voie d'admission: <span class="etud_type_admission">%(type_admission)s</span></span> """
|
|
|
|
if infos_admission["classement"]:
|
|
|
|
adm_tmpl += """<span>Rang admission: <span class="etud_type_admission">%(classement)s</span></span>"""
|
|
|
|
if infos_admission["type_admission"] or infos_admission["classement"]:
|
|
|
|
adm_tmpl += "</div>"
|
|
|
|
if infos_admission["rap"]:
|
|
|
|
adm_tmpl += """<div class="note_rapporteur">%(rap)s</div>"""
|
|
|
|
adm_tmpl += """</div>"""
|
|
|
|
else:
|
|
|
|
adm_tmpl = "" # pas de boite "info admission"
|
|
|
|
info["adm_data"] = adm_tmpl % infos_admission
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2024-03-19 09:34:03 +01:00
|
|
|
info["adm_data"] = ""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
# Fichiers archivés:
|
|
|
|
info["fichiers_archive_htm"] = (
|
2024-01-20 17:37:24 +01:00
|
|
|
""
|
|
|
|
if restrict_etud_data
|
|
|
|
else (
|
|
|
|
'<div class="fichetitre">Fichiers associés</div>'
|
|
|
|
+ sco_archives_etud.etud_list_archives_html(etud)
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Devenir de l'étudiant:
|
2021-08-15 21:33:47 +02:00
|
|
|
has_debouche = True
|
2021-07-29 16:31:15 +02:00
|
|
|
if sco_permissions_check.can_edit_suivi():
|
2020-09-26 16:19:37 +02:00
|
|
|
suivi_readonly = "0"
|
|
|
|
link_add_suivi = """<li class="adddebouche">
|
|
|
|
<a id="adddebouchelink" class="stdlink" href="#">ajouter une ligne</a>
|
|
|
|
</li>"""
|
|
|
|
else:
|
|
|
|
suivi_readonly = "1"
|
|
|
|
link_add_suivi = ""
|
|
|
|
if has_debouche:
|
|
|
|
info[
|
|
|
|
"debouche_html"
|
2024-01-20 14:49:36 +01:00
|
|
|
] = f"""<div id="fichedebouche"
|
|
|
|
data-readonly="{suivi_readonly}"
|
|
|
|
data-etudid="{info['etudid']}">
|
2020-09-26 16:19:37 +02:00
|
|
|
<span class="debouche_tit">Devenir:</span>
|
|
|
|
<div><form>
|
|
|
|
<ul class="listdebouches">
|
2024-01-20 14:49:36 +01:00
|
|
|
{link_add_suivi}
|
2020-09-26 16:19:37 +02:00
|
|
|
</ul>
|
|
|
|
</form></div>
|
2024-01-20 14:49:36 +01:00
|
|
|
</div>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
info["debouche_html"] = "" # pas de boite "devenir"
|
2024-02-10 15:02:18 +01:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
# Inscriptions
|
|
|
|
info[
|
|
|
|
"inscriptions_mkup"
|
2022-10-06 14:06:02 +02:00
|
|
|
] = f"""<div class="ficheinscriptions" id="ficheinscriptions">
|
2023-06-01 20:13:29 +02:00
|
|
|
<div class="fichetitre">Cursus</div>{info["liste_inscriptions"]}
|
2024-07-10 00:53:09 +02:00
|
|
|
{info["link_bul_pdf"]}
|
|
|
|
{info["link_inscrire_ailleurs"]}
|
|
|
|
{info["link_bilan_ects"]}
|
2022-10-06 14:06:02 +02:00
|
|
|
</div>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
if info["groupes"].strip():
|
2022-05-09 19:56:40 +02:00
|
|
|
info[
|
|
|
|
"groupes_row"
|
|
|
|
] = f"""<tr>
|
|
|
|
<td class="fichetitre2">Groupes :</td><td>{info['groupes']}</td>
|
|
|
|
</tr>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
info["groupes_row"] = ""
|
2021-09-27 10:20:10 +02:00
|
|
|
info["menus_etud"] = menus_etud(etudid)
|
2024-01-20 14:49:36 +01:00
|
|
|
if info["boursier"] and not restrict_etud_data:
|
2022-12-07 15:52:50 +01:00
|
|
|
info["bourse_span"] = """<span class="boursier">boursier</span>"""
|
|
|
|
else:
|
|
|
|
info["bourse_span"] = ""
|
2022-06-29 18:16:37 +02:00
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
# Liens vers compétences BUT
|
|
|
|
if last_formsemestre and last_formsemestre.formation.is_apc():
|
2024-07-12 18:40:33 +02:00
|
|
|
try:
|
|
|
|
but_cursus = cursus_but.EtudCursusBUT(etud, last_formsemestre.formation)
|
|
|
|
except ScoValueError:
|
|
|
|
but_cursus = None
|
2024-02-21 17:47:54 +01:00
|
|
|
refcomp = last_formsemestre.formation.referentiel_competence
|
|
|
|
if refcomp:
|
|
|
|
ue_validation_by_niveau = validations_view.get_ue_validation_by_niveau(
|
|
|
|
refcomp, etud
|
|
|
|
)
|
|
|
|
ects_total = sum((v.ects() for v in ue_validation_by_niveau.values()))
|
|
|
|
else:
|
|
|
|
ects_total = ""
|
2024-07-06 23:28:20 +02:00
|
|
|
|
|
|
|
validation_dut120 = ValidationDUT120.query.filter_by(etudid=etudid).first()
|
|
|
|
validation_dut120_html = (
|
|
|
|
f"""Diplôme DUT décerné
|
|
|
|
en <a class="stdlink" href="{
|
|
|
|
url_for("notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=validation_dut120.formsemestre.id)
|
|
|
|
}">S{validation_dut120.formsemestre.semestre_id}</a>
|
|
|
|
"""
|
|
|
|
if validation_dut120
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
info[
|
|
|
|
"but_cursus_mkup"
|
|
|
|
] = f"""
|
|
|
|
<div class="section_but">
|
|
|
|
{render_template(
|
|
|
|
"but/cursus_etud.j2",
|
|
|
|
cursus=but_cursus,
|
|
|
|
scu=scu,
|
2024-07-06 23:28:20 +02:00
|
|
|
validation_dut120_html=validation_dut120_html,
|
2024-07-12 18:40:33 +02:00
|
|
|
) if but_cursus else '<span class="pb-config">problème configuration formation BUT</span>'}
|
2024-02-21 17:47:54 +01:00
|
|
|
<div class="fiche_but_col2">
|
|
|
|
<div class="link_validation_rcues">
|
|
|
|
<a class="stdlink" href="{url_for("notes.validation_rcues",
|
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid,
|
|
|
|
formsemestre_id=last_formsemestre.id)}"
|
|
|
|
title="Visualiser les compétences BUT"
|
|
|
|
>
|
2024-07-06 23:28:20 +02:00
|
|
|
<img src="/ScoDoc/static/icons/parcours-but.png" alt="validation_rcues" height="132px"/>
|
2024-02-21 17:47:54 +01:00
|
|
|
<div style="text-align: center;">Compétences BUT</div>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="fiche_total_etcs">
|
|
|
|
Total ECTS BUT: {ects_total:g}
|
|
|
|
</div>
|
2023-07-17 22:03:11 +02:00
|
|
|
</div>
|
2024-01-20 14:49:36 +01:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
else:
|
|
|
|
info["but_cursus_mkup"] = ""
|
|
|
|
|
|
|
|
adresse_template = (
|
|
|
|
""
|
|
|
|
if restrict_etud_data
|
|
|
|
else """
|
|
|
|
<!-- Adresse -->
|
|
|
|
<div class="ficheadresse" id="ficheadresse">
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td class="fichetitre2">Adresse :</td>
|
|
|
|
<td> %(domicile)s %(codepostaldomicile)s %(villedomicile)s %(paysdomicile)s
|
|
|
|
%(modifadresse)s
|
|
|
|
%(telephones)s
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
|
|
|
|
info_naissance = (
|
2024-02-10 15:02:18 +01:00
|
|
|
f"""<tr><td class="fichetitre2">Né{etud.e} le :</td>
|
|
|
|
<td>{info["info_naissance"]}</td></tr>
|
|
|
|
"""
|
2024-01-20 14:49:36 +01:00
|
|
|
if info["info_naissance"]
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
situation_template = (
|
|
|
|
f"""
|
|
|
|
<div class="fichesituation">
|
|
|
|
<div class="fichetablesitu">
|
|
|
|
<table>
|
|
|
|
<tr><td class="fichetitre2">Situation :</td><td>%(situation)s %(bourse_span)s</td></tr>
|
|
|
|
%(groupes_row)s
|
|
|
|
{info_naissance}
|
|
|
|
</table>
|
|
|
|
"""
|
|
|
|
+ adresse_template
|
|
|
|
+ """
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
)
|
2023-01-17 01:05:48 +01:00
|
|
|
|
2024-02-10 15:02:18 +01:00
|
|
|
info["annotations_mkup"] = (
|
|
|
|
f"""
|
|
|
|
<div class="ficheannotations">
|
|
|
|
<div class="fichetitre">Annotations</div>
|
|
|
|
<table id="etudannotations">{html_annotations_list}</table>
|
|
|
|
|
|
|
|
<form action="doAddAnnotation" method="GET" class="noprint">
|
|
|
|
<input type="hidden" name="etudid" value="{etudid}">
|
|
|
|
<b>Ajouter une annotation sur {etud.nomprenom}: </b>
|
|
|
|
<div>
|
|
|
|
<textarea name="comment" rows="4" cols="50" value=""></textarea>
|
|
|
|
<div style="font-size: small; font-style: italic;">
|
|
|
|
<div>Ces annotations sont lisibles par tous les utilisateurs ayant la permission
|
|
|
|
<tt>ViewEtudData</tt> dans ce département (souvent les enseignants et le
|
|
|
|
secrétariat).
|
|
|
|
</div>
|
|
|
|
<div>L'annotation commençant par "PE:" est un avis de poursuite d'études.</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<input type="hidden" name="author" width=12 value="{current_user}">
|
|
|
|
<input type="submit" value="Ajouter annotation">
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
if not restrict_etud_data
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
tmpl = (
|
|
|
|
"""<div class="menus_etud">%(menus_etud)s</div>
|
|
|
|
<div class="fiche_etud" id="fiche_etud"><table>
|
2020-09-26 16:19:37 +02:00
|
|
|
<tr><td>
|
|
|
|
<h2>%(nomprenom)s (%(inscription)s)</h2>
|
2023-03-13 06:39:36 +01:00
|
|
|
%(etat_civil)s
|
2024-01-20 14:49:36 +01:00
|
|
|
<span>%(email_link)s</span>
|
2020-09-26 16:19:37 +02:00
|
|
|
</td><td class="photocell">
|
2024-06-21 19:13:53 +02:00
|
|
|
<a href="etud_photo_orig_page/%(etudid)s">%(etudfoto)s</a>
|
2020-09-26 16:19:37 +02:00
|
|
|
</td></tr></table>
|
2024-01-20 14:49:36 +01:00
|
|
|
"""
|
|
|
|
+ situation_template
|
|
|
|
+ """
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
%(inscriptions_mkup)s
|
|
|
|
|
2023-01-17 01:05:48 +01:00
|
|
|
%(but_cursus_mkup)s
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
<div class="ficheadmission">
|
|
|
|
%(adm_data)s
|
|
|
|
|
|
|
|
%(fichiers_archive_htm)s
|
|
|
|
</div>
|
|
|
|
|
|
|
|
%(debouche_html)s
|
|
|
|
|
2024-02-10 15:02:18 +01:00
|
|
|
%(annotations_mkup)s
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
<div class="code_nip">code NIP: %(code_nip)s</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
"""
|
2024-01-20 14:49:36 +01:00
|
|
|
)
|
2024-08-18 18:40:11 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
content=tmpl % info,
|
|
|
|
title=f"Fiche étudiant {etud.nomprenom}",
|
2023-01-17 01:05:48 +01:00
|
|
|
cssstyles=[
|
|
|
|
"libjs/jQuery-tagEditor/jquery.tag-editor.css",
|
|
|
|
"css/jury_but.css",
|
|
|
|
"css/cursus_but.css",
|
|
|
|
],
|
2020-09-26 16:19:37 +02:00
|
|
|
javascripts=[
|
|
|
|
"libjs/jinplace-1.2.1.min.js",
|
|
|
|
"js/ue_list.js",
|
|
|
|
"libjs/jQuery-tagEditor/jquery.tag-editor.min.js",
|
|
|
|
"libjs/jQuery-tagEditor/jquery.caret.min.js",
|
|
|
|
"js/recap_parcours.js",
|
|
|
|
"js/etud_debouche.js",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
def _format_adresse(adresse: Adresse | None) -> dict:
|
|
|
|
"""{ "telephonestr" : ..., "telephonemobilestr" : ... } (formats html)"""
|
|
|
|
d = {
|
2024-02-10 15:02:18 +01:00
|
|
|
"telephonestr": (
|
|
|
|
("<b>Tél.:</b> " + scu.format_telephone(adresse.telephone))
|
|
|
|
if (adresse and adresse.telephone)
|
|
|
|
else ""
|
|
|
|
),
|
2024-01-20 14:49:36 +01:00
|
|
|
"telephonemobilestr": (
|
2024-02-10 15:02:18 +01:00
|
|
|
("<b>Mobile:</b> " + scu.format_telephone(adresse.telephonemobile))
|
|
|
|
if (adresse and adresse.telephonemobile)
|
|
|
|
else ""
|
|
|
|
),
|
2024-01-20 14:49:36 +01:00
|
|
|
# e-mail:
|
2024-02-10 15:02:18 +01:00
|
|
|
"email_link": (
|
|
|
|
", ".join(
|
|
|
|
[
|
|
|
|
f"""<a class="stdlink" href="mailto:{m}">{m}</a>"""
|
|
|
|
for m in [adresse.email, adresse.emailperso]
|
|
|
|
if m
|
|
|
|
]
|
|
|
|
)
|
|
|
|
if adresse and (adresse.email or adresse.emailperso)
|
|
|
|
else ""
|
|
|
|
),
|
|
|
|
"domicile": (
|
|
|
|
(adresse.domicile or "")
|
|
|
|
if adresse
|
|
|
|
and (
|
|
|
|
adresse.domicile or adresse.codepostaldomicile or adresse.villedomicile
|
|
|
|
)
|
|
|
|
else "<em>inconnue</em>"
|
|
|
|
),
|
|
|
|
"paysdomicile": (
|
|
|
|
f"{sco_etud.format_pays(adresse.paysdomicile)}"
|
|
|
|
if adresse and adresse.paysdomicile
|
|
|
|
else ""
|
|
|
|
),
|
2024-01-20 14:49:36 +01:00
|
|
|
}
|
|
|
|
d["telephones"] = (
|
|
|
|
f"<br>{d['telephonestr']} {d['telephonemobilestr']}"
|
|
|
|
if adresse and (adresse.telephone or adresse.telephonemobile)
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
|
def _infos_admission(etud: Identite, restrict_etud_data: bool) -> dict:
|
2024-03-19 09:34:03 +01:00
|
|
|
"""dict with admission data, restricted or not"""
|
2024-01-20 14:49:36 +01:00
|
|
|
# info sur rapporteur et son commentaire
|
|
|
|
rap = ""
|
|
|
|
if not restrict_etud_data:
|
|
|
|
if etud.admission.rapporteur or etud.admission.commentaire:
|
|
|
|
rap = "Note du rapporteur"
|
|
|
|
if etud.admission.rapporteur:
|
|
|
|
rap += f" ({etud.admission.rapporteur})"
|
|
|
|
rap += ": "
|
|
|
|
if etud.admission.commentaire:
|
|
|
|
rap += f"<em>{etud.admission.commentaire}</em>"
|
|
|
|
# nom du lycée
|
|
|
|
if restrict_etud_data:
|
|
|
|
info_lycee = ""
|
|
|
|
elif etud.admission.nomlycee:
|
|
|
|
info_lycee = "Lycée " + sco_etud.format_lycee(etud.admission.nomlycee)
|
|
|
|
if etud.admission.villelycee:
|
|
|
|
info_lycee += f" ({etud.admission.villelycee})"
|
|
|
|
info_lycee += "<br>"
|
|
|
|
elif etud.admission.codelycee:
|
|
|
|
info_lycee = sco_etud.format_lycee_from_code(etud.admission.codelycee)
|
|
|
|
else:
|
|
|
|
info_lycee = ""
|
|
|
|
|
|
|
|
return {
|
|
|
|
# infos accessibles à tous:
|
|
|
|
"bac_specialite": f"{etud.admission.bac or ''}{(' '+(etud.admission.specialite or '')) if etud.admission.specialite else ''}",
|
|
|
|
"annee_bac": etud.admission.annee_bac or "",
|
|
|
|
# infos protégées par ViewEtudData:
|
|
|
|
"info_lycee": info_lycee,
|
|
|
|
"rapporteur": etud.admission.rapporteur if not restrict_etud_data else "",
|
|
|
|
"rap": rap,
|
2024-02-10 15:02:18 +01:00
|
|
|
"commentaire": (
|
|
|
|
(etud.admission.commentaire or "") if not restrict_etud_data else ""
|
|
|
|
),
|
|
|
|
"classement": (
|
|
|
|
(etud.admission.classement or "") if not restrict_etud_data else ""
|
|
|
|
),
|
|
|
|
"type_admission": (
|
|
|
|
(etud.admission.type_admission or "") if not restrict_etud_data else ""
|
|
|
|
),
|
2024-01-20 14:49:36 +01:00
|
|
|
"math": (etud.admission.math or "") if not restrict_etud_data else "",
|
|
|
|
"physique": (etud.admission.physique or "") if not restrict_etud_data else "",
|
|
|
|
"anglais": (etud.admission.anglais or "") if not restrict_etud_data else "",
|
|
|
|
"francais": (etud.admission.francais or "") if not restrict_etud_data else "",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-02-10 15:02:18 +01:00
|
|
|
def get_html_annotations_list(etud: Identite) -> list[str]:
|
|
|
|
"""Liste de chaînes html décrivant les annotations."""
|
|
|
|
html_annotations_list = []
|
|
|
|
annotations = EtudAnnotation.query.filter_by(etudid=etud.id).order_by(
|
|
|
|
sa.desc(EtudAnnotation.date)
|
|
|
|
)
|
|
|
|
for annot in annotations:
|
|
|
|
del_link = (
|
|
|
|
f"""<td class="annodel"><a href="{
|
|
|
|
url_for("scolar.doSuppressAnnotation",
|
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etud.id, annotation_id=annot.id)}">{
|
|
|
|
scu.icontag(
|
|
|
|
"delete_img",
|
|
|
|
border="0",
|
|
|
|
alt="suppress",
|
|
|
|
title="Supprimer cette annotation",
|
|
|
|
)
|
|
|
|
}</a></td>"""
|
|
|
|
if sco_permissions_check.can_suppress_annotation(annot.id)
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
|
|
|
|
author = User.query.filter_by(user_name=annot.author).first()
|
|
|
|
html_annotations_list.append(
|
|
|
|
f"""<tr><td><span class="annodate">Le {
|
2024-04-02 23:37:23 +02:00
|
|
|
annot.date.strftime(scu.DATE_FMT) if annot.date else "?"}
|
2024-02-10 15:02:18 +01:00
|
|
|
par {author.get_prenomnom() if author else "?"} :
|
|
|
|
</span><span class="annoc">{annot.comment or ""}</span></td>{del_link}</tr>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
return html_annotations_list
|
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def menus_etud(etudid):
|
2021-01-01 18:40:47 +01:00
|
|
|
"""Menu etudiant (operations sur l'etudiant)"""
|
2021-09-18 13:42:19 +02:00
|
|
|
authuser = current_user
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
menuEtud = [
|
|
|
|
{
|
|
|
|
"title": etud["nomprenom"],
|
2024-01-20 14:49:36 +01:00
|
|
|
"endpoint": "scolar.fiche_etud",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"etudid": etud["etudid"]},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "Fiche étudiant",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Changer la photo",
|
2022-09-30 22:43:39 +02:00
|
|
|
"endpoint": "scolar.form_change_photo",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"etudid": etud["etudid"]},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudChangeAdr),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Changer les données identité/admission",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "scolar.etudident_edit_form",
|
|
|
|
"args": {"etudid": etud["etudid"]},
|
2024-01-20 17:37:24 +01:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit)
|
|
|
|
and authuser.has_permission(Permission.ViewEtudData),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2023-09-25 23:51:38 +02:00
|
|
|
{
|
|
|
|
"title": "Copier dans un autre département...",
|
|
|
|
"endpoint": "scolar.etud_copy_in_other_dept",
|
|
|
|
"args": {"etudid": etud["etudid"]},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit),
|
2023-09-25 23:51:38 +02:00
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Supprimer cet étudiant...",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "scolar.etudident_delete",
|
|
|
|
"args": {"etudid": etud["etudid"]},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": authuser.has_permission(Permission.EtudInscrit),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Voir le journal...",
|
2024-07-08 23:13:45 +02:00
|
|
|
"endpoint": "scolar.show_etud_log",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"etudid": etud["etudid"]},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2023-09-25 23:51:38 +02:00
|
|
|
return htmlutils.make_menu(
|
|
|
|
"Étudiant", menuEtud, alone=True, css_class="menu-etudiant"
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def etud_info_html(etudid, with_photo="1", debug=False):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""An HTML div with basic information and links about this etud.
|
|
|
|
Used for popups information windows.
|
|
|
|
"""
|
2024-01-21 18:07:56 +01:00
|
|
|
formsemestre_id = retreive_formsemestre_from_request()
|
2020-09-26 16:19:37 +02:00
|
|
|
with_photo = int(with_photo)
|
2024-01-20 14:49:36 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-20 17:37:24 +01:00
|
|
|
photo_html = etud.photo_html(title="fiche de " + etud.nomprenom)
|
2024-01-20 14:49:36 +01:00
|
|
|
code_cursus, _ = sco_report.get_code_cursus_etud(
|
|
|
|
etud, formsemestres=etud.get_formsemestres(), prefix="S", separator=", "
|
|
|
|
)
|
2024-03-19 09:34:03 +01:00
|
|
|
if etud.admission:
|
|
|
|
bac = sco_bac.Baccalaureat(etud.admission.bac, etud.admission.specialite)
|
|
|
|
bac_abbrev = bac.abbrev()
|
|
|
|
else:
|
|
|
|
bac_abbrev = "-"
|
2022-11-03 14:14:30 +01:00
|
|
|
H = f"""<div class="etud_info_div">
|
2020-09-26 16:19:37 +02:00
|
|
|
<div class="eid_left">
|
2023-10-18 15:15:49 +02:00
|
|
|
<div class="eid_nom"><div><a class="stdlink" target="_blank" href="{
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2024-01-20 17:37:24 +01:00
|
|
|
}">{etud.nomprenom}</a></div></div>
|
2022-11-03 14:14:30 +01:00
|
|
|
<div class="eid_info eid_bac">Bac: <span class="eid_bac">{bac_abbrev}</span></div>
|
2023-02-12 13:36:47 +01:00
|
|
|
<div class="eid_info eid_parcours">{code_cursus}</div>
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
# Informations sur l'etudiant dans le semestre courant:
|
|
|
|
if formsemestre_id: # un semestre est spécifié par la page
|
2024-01-20 14:49:36 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2024-01-20 17:37:24 +01:00
|
|
|
else:
|
|
|
|
# le semestre "en cours" pour l'étudiant
|
|
|
|
inscription_courante = etud.inscription_courante()
|
|
|
|
formsemestre = (
|
|
|
|
inscription_courante.formsemestre if inscription_courante else None
|
|
|
|
)
|
|
|
|
|
2024-01-20 14:49:36 +01:00
|
|
|
if formsemestre:
|
|
|
|
groups = sco_groups.get_etud_groups(etudid, formsemestre.id)
|
2020-09-26 16:19:37 +02:00
|
|
|
grc = sco_groups.listgroups_abbrev(groups)
|
2024-01-20 14:49:36 +01:00
|
|
|
H += f"""<div class="eid_info">En <b>S{formsemestre.semestre_id}</b>: {grc}</div>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
H += "</div>" # fin partie gauche (eid_left)
|
|
|
|
if with_photo:
|
|
|
|
H += '<span class="eid_right">' + photo_html + "</span>"
|
|
|
|
|
|
|
|
H += "</div>"
|
|
|
|
if debug:
|
2024-08-18 18:40:11 +02:00
|
|
|
return render_template("sco_page.j2", title="debug", content=H)
|
|
|
|
|
|
|
|
return H
|