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
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Module "Avis de poursuite d'étude"
|
|
|
|
# conçu et développé par Cléo Baras (IUT de Grenoble)
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
|
|
|
|
"""ScoDoc : interface des fonctions de gestion des avis de poursuites d'étude
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2024-01-27 12:21:21 +01:00
|
|
|
from flask import flash, g, redirect, request, send_file, url_for
|
2024-01-16 09:21:02 +01:00
|
|
|
|
|
|
|
from app.models import FormSemestre
|
2022-03-01 10:21:15 +01:00
|
|
|
from app.scodoc.sco_exceptions import ScoValueError
|
2021-08-31 20:18:50 +02:00
|
|
|
|
2021-06-19 23:21:37 +02:00
|
|
|
import app.scodoc.sco_utils as scu
|
|
|
|
from app.scodoc import html_sco_header
|
|
|
|
|
2024-01-25 19:42:22 +01:00
|
|
|
from app.pe import pe_comp
|
|
|
|
from app.pe import pe_jury
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-08-31 20:18:50 +02:00
|
|
|
def _pe_view_sem_recap_form(formsemestre_id):
|
2024-01-20 09:31:02 +01:00
|
|
|
sem_base = FormSemestre.get_formsemestre(formsemestre_id)
|
|
|
|
if not sem_base.formation.is_apc() or sem_base.formation.get_cursus().NB_SEM < 6:
|
|
|
|
H = [
|
|
|
|
html_sco_header.sco_header(page_title="Avis de poursuite d'études"),
|
2024-01-25 22:07:24 +01:00
|
|
|
"""<h2 class="formsemestre">Génération des avis de poursuites d'études (V2 BUT EXPERIMENTALE)</h2>
|
2024-01-20 09:31:02 +01:00
|
|
|
<p class="help">
|
|
|
|
Cette fonction génère un ensemble de fichiers permettant d'éditer des avis de
|
|
|
|
poursuites d'études.
|
|
|
|
<br>
|
|
|
|
De nombreux aspects sont paramétrables:
|
|
|
|
<a href="https://scodoc.org/AvisPoursuiteEtudes"
|
|
|
|
target="_blank" rel="noopener noreferrer">
|
2024-01-25 22:07:24 +01:00
|
|
|
voir la documentation (en cours de révision)
|
2024-01-20 09:31:02 +01:00
|
|
|
</a>.
|
2024-01-25 21:54:22 +01:00
|
|
|
Cette fonction (en Scodoc9) n'est prévue que pour le BUT.
|
2024-01-20 09:31:02 +01:00
|
|
|
<br>
|
|
|
|
Rendez-vous donc sur un semestre de BUT.
|
|
|
|
</p>
|
|
|
|
""",
|
|
|
|
]
|
|
|
|
return "\n".join(H) + html_sco_header.sco_footer()
|
|
|
|
|
|
|
|
# L'année du diplome
|
2024-01-25 19:42:22 +01:00
|
|
|
diplome = pe_comp.get_annee_diplome_semestre(sem_base)
|
2024-01-20 09:31:02 +01:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
H = [
|
2021-07-29 16:31:15 +02:00
|
|
|
html_sco_header.sco_header(page_title="Avis de poursuite d'études"),
|
2024-01-25 22:07:24 +01:00
|
|
|
f"""<h2 class="formsemestre">Génération des avis de poursuites d'études (V2 BUT EXPERIMENTALE)</h2>
|
|
|
|
|
|
|
|
<div class="alert-warning">
|
|
|
|
Fonction expérimentale pour le BUT : travaux en cours, merci de tester
|
|
|
|
et de faire part de vos expériences sur le Discord.
|
|
|
|
</div>
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
<p class="help">
|
2022-04-02 10:56:10 +02:00
|
|
|
Cette fonction génère un ensemble de fichiers permettant d'éditer des avis de
|
2024-01-20 09:31:02 +01:00
|
|
|
poursuites d'études pour les étudiants diplômés en {diplome}.
|
2022-10-02 23:43:29 +02:00
|
|
|
<br>
|
2022-04-02 10:56:10 +02:00
|
|
|
De nombreux aspects sont paramétrables:
|
2023-08-26 16:34:56 +02:00
|
|
|
<a href="https://scodoc.org/AvisPoursuiteEtudes"
|
|
|
|
target="_blank" rel="noopener noreferrer">
|
|
|
|
voir la documentation
|
2024-01-25 22:07:24 +01:00
|
|
|
</a> (en cours de révision).
|
2020-09-26 16:19:37 +02:00
|
|
|
</p>
|
2022-04-02 10:56:10 +02:00
|
|
|
<form method="post" action="pe_view_sem_recap" id="pe_view_sem_recap_form"
|
|
|
|
enctype="multipart/form-data">
|
2020-09-26 16:19:37 +02:00
|
|
|
<div class="pe_template_up">
|
2022-04-02 10:56:10 +02:00
|
|
|
Les templates sont généralement installés sur le serveur ou dans le
|
|
|
|
paramétrage de ScoDoc.
|
2022-10-02 23:43:29 +02:00
|
|
|
<br>
|
2022-04-02 10:56:10 +02:00
|
|
|
Au besoin, vous pouvez spécifier ici votre propre fichier de template
|
|
|
|
(<tt>un_avis.tex</tt>):
|
|
|
|
<div class="pe_template_upb">Template:
|
|
|
|
<input type="file" size="30" name="avis_tmpl_file"/>
|
|
|
|
</div>
|
|
|
|
<div class="pe_template_upb">Pied de page:
|
|
|
|
<input type="file" size="30" name="footer_tmpl_file"/>
|
|
|
|
</div>
|
2020-09-26 16:19:37 +02:00
|
|
|
</div>
|
|
|
|
<input type="submit" value="Générer les documents"/>
|
|
|
|
<input type="hidden" name="formsemestre_id" value="{formsemestre_id}">
|
|
|
|
</form>
|
2022-04-02 10:56:10 +02:00
|
|
|
""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + html_sco_header.sco_footer()
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-08-31 20:18:50 +02:00
|
|
|
# called from the web, POST or GET
|
2020-09-26 16:19:37 +02:00
|
|
|
def pe_view_sem_recap(
|
|
|
|
formsemestre_id,
|
|
|
|
avis_tmpl_file=None,
|
|
|
|
footer_tmpl_file=None,
|
|
|
|
):
|
2021-08-31 20:18:50 +02:00
|
|
|
"""Génération des avis de poursuite d'étude"""
|
|
|
|
if request.method == "GET":
|
|
|
|
return _pe_view_sem_recap_form(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-16 09:21:02 +01:00
|
|
|
sem_base = FormSemestre.get_formsemestre(formsemestre_id)
|
|
|
|
if not sem_base.formation.is_apc():
|
2024-01-16 15:51:22 +01:00
|
|
|
raise ScoValueError(
|
|
|
|
"Le module de Poursuites d'Etudes avec Scodoc 9 n'est disponible que pour des formations BUT"
|
|
|
|
)
|
2024-01-16 09:21:02 +01:00
|
|
|
|
2024-01-20 09:31:02 +01:00
|
|
|
if sem_base.formation.get_cursus().NB_SEM < 6:
|
|
|
|
raise ScoValueError(
|
|
|
|
"Le module de Poursuites d'Etudes avec Scodoc 9 n'est pas prévu pour une formation de moins de 6 semestres"
|
|
|
|
)
|
|
|
|
|
|
|
|
# L'année du diplome
|
2024-01-25 19:42:22 +01:00
|
|
|
diplome = pe_comp.get_annee_diplome_semestre(sem_base)
|
2024-01-20 09:31:02 +01:00
|
|
|
|
2024-01-25 19:42:22 +01:00
|
|
|
jury = pe_jury.JuryPE(diplome, sem_base.formation.formation_id)
|
2024-01-27 12:21:21 +01:00
|
|
|
if not jury.diplomes_ids:
|
|
|
|
flash("aucun étudiant à considérer !")
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.pe_view_sem_recap",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
data = jury.get_zipped_data()
|
|
|
|
|
2021-08-31 20:18:50 +02:00
|
|
|
return send_file(
|
|
|
|
data,
|
|
|
|
mimetype="application/zip",
|
2024-01-20 09:31:02 +01:00
|
|
|
download_name=scu.sanitize_filename(jury.nom_export_zip + ".zip"),
|
2021-08-31 20:18:50 +02:00
|
|
|
as_attachment=True,
|
|
|
|
)
|