2020-09-26 16:19:37 +02:00
# -*- mode: python -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Gestion scolarite IUT
#
2021-01-01 17:51:08 +01:00
# Copyright (c) 1999 - 2021 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
#
##############################################################################
""" Tableau de bord semestre
"""
# Rewritten from ancient DTML code
from notes_log import log
2021-01-17 22:31:28 +01:00
import sco_utils as scu
2021-06-15 13:59:56 +02:00
import notesdb as ndb
2021-01-17 22:31:28 +01:00
from sco_permissions import (
ScoImplement ,
ScoChangeFormation ,
ScoEtudInscrit ,
ScoView ,
ScoEtudChangeAdr ,
)
from sco_exceptions import ScoValueError
import VERSION
import htmlutils
2020-09-26 16:19:37 +02:00
from sco_formsemestre_custommenu import formsemestre_custommenu_html
from gen_tables import GenTable
import sco_archives
import sco_groups
import sco_evaluations
import sco_formsemestre
import sco_formsemestre_edit
2021-01-17 22:31:28 +01:00
import sco_moduleimpl
2020-09-26 16:19:37 +02:00
import sco_compute_moy
import sco_codes_parcours
import sco_bulletins
# H = [ """<span class="barrenav"><ul class="nav">
# <li onmouseover="MenuDisplay(this)" onmouseout="MenuHide(this)"><a href="#" class="menu %s">%s</a><ul>""" % (cssclass, title)
# ]
# for item in items:
# if item.get('enabled', True):
# if base_url:
# item['urlq'] = urllib.quote(item['url'])
# else:
# item['urlq'] = item['url']
# H.append('<li><a href="' + base_url + '%(urlq)s">%(title)s</a></li>' % item)
# else:
# H.append('<li><span class="disabled_menu_item">%(title)s</span></li>' % item)
# H.append('</ul></li></ul></%s>' % elem)
# return ''.join(H)
def defMenuStats ( context , formsemestre_id ) :
" Définition du menu ' Statistiques ' "
return [
{
" title " : " Statistiques... " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_report_counts " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Suivi de cohortes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_suivi_cohorte " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
} ,
{
" title " : " Graphe des parcours " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_graph_parcours " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-01-17 22:31:28 +01:00
" enabled " : scu . WITH_PYDOT ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Codes des parcours " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_suivi_parcours " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
} ,
{
" title " : " Lycées d ' origine " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_etuds_lycees " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
} ,
{
" title " : ' Table " poursuite " ' ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_poursuite_report " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
} ,
{
" title " : " Documents Avis Poursuite Etudes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.pe_view_sem_recap " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
" enabled " : True ,
} ,
{
" title " : ' Table " débouchés " ' ,
" endpoint " : " notes.report_debouche_date " ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
} ,
{
" title " : " Estimation du coût de la formation " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_estim_cost?formsemestre_id " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
} ,
]
def formsemestre_status_menubar ( context , sem , REQUEST ) :
""" HTML to render menubar """
authuser = REQUEST . AUTHENTICATED_USER
uid = str ( authuser )
formsemestre_id = sem [ " formsemestre_id " ]
if int ( sem [ " etat " ] ) :
change_lock_msg = " Verrouiller "
else :
change_lock_msg = " Déverrouiller "
F = context . formation_list ( args = { " formation_id " : sem [ " formation_id " ] } ) [ 0 ]
menuSemestre = [
{
" title " : " Tableau de bord " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_status " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " Tableau de bord du semestre " ,
} ,
{
" title " : " Voir la formation %(acronyme)s (v %(version)s ) " % F ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.ue_list " ,
" args " : { " formation_id " : sem [ " formation_id " ] } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " Tableau de bord du semestre " ,
} ,
{
" title " : " Modifier le semestre " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_editwithmodules?formation_id= %(formation_id)s &formsemestre_id= %(formsemestre_id)s "
2020-09-26 16:19:37 +02:00
% sem ,
2021-06-14 18:08:52 +02:00
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : (
2021-06-15 15:38:38 +02:00
authuser . has_permission ( Permission . ScoImplement )
2020-09-26 16:19:37 +02:00
or (
str ( REQUEST . AUTHENTICATED_USER ) in sem [ " responsables " ]
and sem [ " resp_can_edit " ]
)
)
and ( sem [ " etat " ] == " 1 " ) ,
" helpmsg " : " Modifie le contenu du semestre (modules) " ,
} ,
{
" title " : " Préférences du semestre " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_edit_preferences " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : (
2021-06-15 15:38:38 +02:00
authuser . has_permission ( Permission . ScoImplement )
2020-09-26 16:19:37 +02:00
or (
str ( REQUEST . AUTHENTICATED_USER ) in sem [ " responsables " ]
and sem [ " resp_can_edit " ]
)
)
and ( sem [ " etat " ] == " 1 " ) ,
" helpmsg " : " Préférences du semestre " ,
} ,
{
" title " : " Réglages bulletins " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_edit_options " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : ( uid in sem [ " responsables " ] )
2021-06-15 15:38:38 +02:00
or authuser . has_permission ( Permission . ScoImplement ) ,
2020-09-26 16:19:37 +02:00
" helpmsg " : " Change les options " ,
} ,
{
" title " : change_lock_msg ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_change_lock " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : ( uid in sem [ " responsables " ] )
2021-06-15 15:38:38 +02:00
or authuser . has_permission ( Permission . ScoImplement ) ,
2020-09-26 16:19:37 +02:00
" helpmsg " : " " ,
} ,
{
" title " : " Description du semestre " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_description " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " " ,
} ,
{
" title " : " Vérifier absences aux évaluations " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_check_absences_html " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " " ,
} ,
{
" title " : " Lister tous les enseignants " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_enseignants_list " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " " ,
} ,
{
" title " : " Cloner ce semestre " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_clone " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoImplement ) ,
2020-09-26 16:19:37 +02:00
" helpmsg " : " " ,
} ,
{
" title " : " Associer à une nouvelle version du programme " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_associate_new_version " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoChangeFormation )
2020-09-26 16:19:37 +02:00
and ( sem [ " etat " ] == " 1 " ) ,
" helpmsg " : " " ,
} ,
{
" title " : " Supprimer ce semestre " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_delete " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoImplement ) ,
2020-09-26 16:19:37 +02:00
" helpmsg " : " " ,
} ,
]
# debug :
2021-06-14 18:08:52 +02:00
if app . config [ " ENV " ] == " development " :
2020-09-26 16:19:37 +02:00
menuSemestre . append (
{
" title " : " Check integrity " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.check_sem_integrity " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
}
)
menuInscriptions = [
{
" title " : " Voir les inscriptions aux modules " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.moduleimpl_inscriptions_stats " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
}
]
menuInscriptions + = [
{
" title " : " Passage des étudiants depuis d ' autres semestres " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_inscr_passage " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoEtudInscrit )
2020-09-26 16:19:37 +02:00
and ( sem [ " etat " ] == " 1 " ) ,
} ,
{
" title " : " Synchroniser avec étape Apogée " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_synchro_etuds " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoView )
2021-06-13 19:12:20 +02:00
and sco_preferences . get_preference ( context , " portal_url " )
2020-09-26 16:19:37 +02:00
and ( sem [ " etat " ] == " 1 " ) ,
} ,
{
" title " : " Inscrire un étudiant " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_inscription_with_modules_etud " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoEtudInscrit )
2020-09-26 16:19:37 +02:00
and ( sem [ " etat " ] == " 1 " ) ,
} ,
{
" title " : " Importer des étudiants dans ce semestre (table Excel) " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.form_students_import_excel " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoEtudInscrit )
2020-09-26 16:19:37 +02:00
and ( sem [ " etat " ] == " 1 " ) ,
} ,
{
" title " : " Import/export des données admission " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.form_students_import_infos_admissions " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoView ) ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Resynchroniser données identité " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_import_etud_admission " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 15:38:38 +02:00
" enabled " : authuser . has_permission ( Permission . ScoEtudChangeAdr )
2021-06-13 19:12:20 +02:00
and sco_preferences . get_preference ( context , " portal_url " ) ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Exporter table des étudiants " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.groups_view " ,
" args " : {
" format " : allxls ,
" group_ids " : sco_groups . get_default_group (
context , formsemestre_id , fix_if_missing = True , REQUEST = REQUEST
) ,
} ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Vérifier inscriptions multiples " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_inscrits_ailleurs " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
]
menuGroupes = [
{
" title " : " Listes, photos, feuilles... " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.groups_view " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " Accès aux listes des groupes d ' étudiants " ,
} ,
{
" title " : " Créer/modifier les partitions... " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.editPartitionForm " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-01-17 22:31:28 +01:00
" enabled " : sco_groups . can_change_groups ( context , REQUEST , formsemestre_id ) ,
2020-09-26 16:19:37 +02:00
} ,
]
# 1 item / partition:
partitions = sco_groups . get_partitions_list (
context , formsemestre_id , with_default = False
)
submenu = [ ]
2021-01-17 22:31:28 +01:00
enabled = (
sco_groups . can_change_groups ( context , REQUEST , formsemestre_id ) and partitions
)
2020-09-26 16:19:37 +02:00
for partition in partitions :
submenu . append (
{
" title " : " %s " % partition [ " partition_name " ] ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.affectGroups " ,
" args " : { " partition_id " : partition [ " partition_id " ] } ,
2020-09-26 16:19:37 +02:00
" enabled " : enabled ,
}
)
menuGroupes . append (
{ " title " : " Modifier les groupes " , " submenu " : submenu , " enabled " : enabled }
)
menuNotes = [
{
" title " : " Tableau des moyennes (et liens bulletins) " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_recapcomplet " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Saisie des notes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_status " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : True ,
" helpmsg " : " Tableau de bord du semestre " ,
} ,
{
" title " : " Classeur PDF des bulletins " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_bulletins_pdf_choice " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" helpmsg " : " PDF regroupant tous les bulletins " ,
} ,
{
" title " : " Envoyer à chaque étudiant son bulletin par e-mail " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_bulletins_mailetuds_choice " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : sco_bulletins . can_send_bulletin_by_mail (
context , formsemestre_id , REQUEST
) ,
} ,
{
" title " : " Calendrier des évaluations " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_evaluations_cal " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Lister toutes les saisies de notes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_list_saisies_notes " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
]
menuJury = [
{
" title " : " Voir les décisions du jury " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_pvjury " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Générer feuille préparation Jury " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.feuille_preparation_jury " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Saisie des décisions du jury " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_recapcomplet " ,
" args " : {
" formsemestre_id " : formsemestre_id ,
" modejury " : 1 ,
" hidemodules " : 1 ,
" hidebac " : 1 ,
" pref_override " : 0 ,
} ,
2021-06-15 12:34:33 +02:00
" enabled " : sco_permissions . can_validate_sem (
context , REQUEST , formsemestre_id
) ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Editer les PV et archiver les résultats " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_archive " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2021-06-15 12:34:33 +02:00
" enabled " : sco_permissions . can_edit_pv ( context , REQUEST , formsemestre_id ) ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Documents archivés " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.formsemestre_list_archives " ,
" args " : { " formsemestre_id " : formsemestre_id } ,
2020-09-26 16:19:37 +02:00
" enabled " : sco_archives . PVArchive . list_obj_archives (
context , formsemestre_id
) ,
} ,
]
menuStats = defMenuStats ( context , formsemestre_id )
H = [
# <table><tr><td>',
' <ul id= " sco_menu " > ' ,
2021-06-14 18:08:52 +02:00
htmlutils . make_menu ( " Semestre " , menuSemestre ) ,
htmlutils . make_menu ( " Inscriptions " , menuInscriptions ) ,
htmlutils . make_menu ( " Groupes " , menuGroupes ) ,
htmlutils . make_menu ( " Notes " , menuNotes ) ,
htmlutils . make_menu ( " Jury " , menuJury ) ,
htmlutils . make_menu ( " Statistiques " , menuStats ) ,
formsemestre_custommenu_html ( context , formsemestre_id ) ,
2020-09-26 16:19:37 +02:00
" </ul> " ,
#'</td></tr></table>'
]
return " \n " . join ( H )
def retreive_formsemestre_from_request ( context , REQUEST ) :
""" Cherche si on a de quoi déduire le semestre affiché à partir des
2020-10-14 15:28:09 +02:00
arguments de la requête :
2020-09-26 16:19:37 +02:00
formsemestre_id ou moduleimpl ou evaluation ou group_id ou partition_id
"""
# Search formsemestre
group_ids = REQUEST . form . get ( " group_ids " , [ ] )
if REQUEST . form . has_key ( " formsemestre_id " ) :
formsemestre_id = REQUEST . form [ " formsemestre_id " ]
elif REQUEST . form . has_key ( " moduleimpl_id " ) :
2021-01-17 22:31:28 +01:00
modimpl = sco_moduleimpl . do_moduleimpl_list (
context , moduleimpl_id = REQUEST . form [ " moduleimpl_id " ]
2020-09-26 16:19:37 +02:00
)
if not modimpl :
return None # suppressed ?
modimpl = modimpl [ 0 ]
formsemestre_id = modimpl [ " formsemestre_id " ]
elif REQUEST . form . has_key ( " evaluation_id " ) :
E = context . do_evaluation_list ( { " evaluation_id " : REQUEST . form [ " evaluation_id " ] } )
if not E :
return None # evaluation suppressed ?
E = E [ 0 ]
2021-01-17 22:31:28 +01:00
modimpl = sco_moduleimpl . do_moduleimpl_list (
context , moduleimpl_id = E [ " moduleimpl_id " ]
) [ 0 ]
2020-09-26 16:19:37 +02:00
formsemestre_id = modimpl [ " formsemestre_id " ]
elif REQUEST . form . has_key ( " group_id " ) :
group = sco_groups . get_group ( context , REQUEST . form [ " group_id " ] )
formsemestre_id = group [ " formsemestre_id " ]
elif group_ids :
if group_ids :
if type ( group_ids ) == str :
group_id = group_ids
else :
# prend le semestre du 1er groupe de la liste:
group_id = group_ids [ 0 ]
group = sco_groups . get_group ( context , group_id )
formsemestre_id = group [ " formsemestre_id " ]
elif REQUEST . form . has_key ( " partition_id " ) :
partition = sco_groups . get_partition ( context , REQUEST . form [ " partition_id " ] )
formsemestre_id = partition [ " formsemestre_id " ]
else :
return None # no current formsemestre
return formsemestre_id
# Element HTML decrivant un semestre (barre de menu et infos)
def formsemestre_page_title ( context , REQUEST ) :
""" Element HTML decrivant un semestre (barre de menu et infos)
Cherche dans REQUEST si un semestre est défini ( formsemestre_id ou moduleimpl ou evaluation ou group )
"""
try :
context = context . Notes
except :
pass
formsemestre_id = retreive_formsemestre_from_request ( context , REQUEST )
#
if not formsemestre_id :
return " "
try :
sem = sco_formsemestre . get_formsemestre ( context , formsemestre_id ) . copy ( )
except :
log ( " can ' t find formsemestre_id %s " % formsemestre_id )
return " "
fill_formsemestre ( context , sem , REQUEST = REQUEST )
H = [
""" <div class= " formsemestre_page_title " > """ ,
""" <div class= " infos " >
< span class = " semtitle " > < a class = " stdlink " title = " %(session_id)s " href = " %(notes_url)s /formsemestre_status?formsemestre_id= %(formsemestre_id)s " > % ( titre ) s < / a > < a title = " %(etape_apo_str)s " > % ( num_sem ) s < / a > % ( modalitestr ) s < / span > < span class = " dates " > < a title = " du %(date_debut)s au %(date_fin)s " > % ( mois_debut ) s - % ( mois_fin ) s < / a > < / span > < span class = " resp " > < a title = " %(nomcomplet)s " > % ( resp ) s < / a > < / span > < span class = " nbinscrits " > < a class = " discretelink " href = " %(notes_url)s /formsemestre_lists?formsemestre_id= %(formsemestre_id)s " > % ( nbinscrits ) d inscrits < / a > < / span > < span class = " lock " > % ( locklink ) s < / span > < span class = " eye " > % ( eyelink ) s < / span > < / div > """
% sem ,
formsemestre_status_menubar ( context , sem , REQUEST ) ,
""" </div> """ ,
]
return " \n " . join ( H )
def fill_formsemestre ( context , sem , REQUEST = None ) :
2020-10-14 15:28:09 +02:00
""" Add some useful fields to help display formsemestres """
2021-06-15 12:34:33 +02:00
notes_url = scu . NotesURL ( )
2020-09-26 16:19:37 +02:00
sem [ " notes_url " ] = notes_url
formsemestre_id = sem [ " formsemestre_id " ]
if sem [ " etat " ] != " 1 " :
2020-10-14 15:28:09 +02:00
sem [
" locklink "
] = """ <a href= " %s /formsemestre_change_lock?formsemestre_id= %s " > %s </a> """ % (
notes_url ,
sem [ " formsemestre_id " ] ,
2021-01-17 22:31:28 +01:00
scu . icontag ( " lock_img " , border = " 0 " , title = " Semestre verrouillé " ) ,
2020-09-26 16:19:37 +02:00
)
else :
sem [ " locklink " ] = " "
2021-06-13 23:37:14 +02:00
if sco_preferences . get_preference (
context , " bul_display_publication " , formsemestre_id
) :
2020-09-26 16:19:37 +02:00
if sem [ " bul_hide_xml " ] != " 0 " :
2021-01-17 22:31:28 +01:00
eyeicon = scu . icontag ( " hide_img " , border = " 0 " , title = " Bulletins NON publiés " )
2020-09-26 16:19:37 +02:00
else :
2021-01-17 22:31:28 +01:00
eyeicon = scu . icontag ( " eye_img " , border = " 0 " , title = " Bulletins publiés " )
2020-09-26 16:19:37 +02:00
sem [ " eyelink " ] = (
""" <a href= " %s /formsemestre_change_publication_bul?formsemestre_id= %s " > %s </a> """
% ( notes_url , sem [ " formsemestre_id " ] , eyeicon )
)
else :
sem [ " eyelink " ] = " "
2021-06-16 10:15:46 +02:00
F = context . formation_list ( args = { " formation_id " : sem [ " formation_id " ] } ) [ 0 ]
2020-09-26 16:19:37 +02:00
sem [ " formation " ] = F
parcours = sco_codes_parcours . get_parcours_from_code ( F [ " type_parcours " ] )
if sem [ " semestre_id " ] != - 1 :
sem [ " num_sem " ] = " , %s %s " % ( parcours . SESSION_NAME , sem [ " semestre_id " ] )
else :
sem [ " num_sem " ] = " " # formation sans semestres
if sem [ " modalite " ] :
sem [ " modalitestr " ] = " en %s " % sem [ " modalite " ]
else :
sem [ " modalitestr " ] = " "
sem [ " etape_apo_str " ] = " Code étape Apogée: " + (
sco_formsemestre . formsemestre_etape_apo_str ( sem ) or " Pas de code étape "
)
inscrits = context . Notes . do_formsemestre_inscription_list (
args = { " formsemestre_id " : formsemestre_id }
)
sem [ " nbinscrits " ] = len ( inscrits )
uresps = [
context . Users . user_info ( responsable_id )
for responsable_id in sem [ " responsables " ]
]
sem [ " resp " ] = " , " . join ( [ u [ " prenomnom " ] for u in uresps ] )
sem [ " nomcomplet " ] = " , " . join ( [ u [ " nomcomplet " ] for u in uresps ] )
# Description du semestre sous forme de table exportable
def formsemestre_description_table (
context , formsemestre_id , REQUEST = None , with_evals = False
) :
""" Description du semestre sous forme de table exportable
Liste des modules et de leurs coefficients
"""
sem = sco_formsemestre . get_formsemestre ( context , formsemestre_id )
2021-06-13 23:37:14 +02:00
nt = sco_core . get_notes_cache ( context ) . get_NotesTable (
2020-09-26 16:19:37 +02:00
context , formsemestre_id
) # > liste evaluations
2021-06-13 23:37:14 +02:00
use_ue_coefs = sco_preferences . get_preference (
context , " use_ue_coefs " , formsemestre_id
)
2020-09-26 16:19:37 +02:00
F = context . formation_list ( args = { " formation_id " : sem [ " formation_id " ] } ) [ 0 ]
parcours = sco_codes_parcours . get_parcours_from_code ( F [ " type_parcours " ] )
2021-01-17 22:31:28 +01:00
Mlist = sco_moduleimpl . do_moduleimpl_withmodule_list (
context , formsemestre_id = formsemestre_id
)
2020-09-26 16:19:37 +02:00
R = [ ]
sum_coef = 0
sum_ects = 0
last_ue_id = None
for M in Mlist :
# Ligne UE avec ECTS:
ue = M [ " ue " ]
if ue [ " ue_id " ] != last_ue_id :
last_ue_id = ue [ " ue_id " ]
if ue [ " ects " ] is None :
ects_str = " - "
else :
sum_ects + = ue [ " ects " ]
ects_str = ue [ " ects " ]
ue_info = {
" UE " : ue [ " acronyme " ] ,
" ects " : ects_str ,
" Module " : ue [ " titre " ] ,
" _css_row_class " : " table_row_ue " ,
}
if use_ue_coefs :
ue_info [ " Coef. " ] = ue [ " coefficient " ]
ue_info [ " Coef._class " ] = " ue_coef "
R . append ( ue_info )
2021-01-17 22:31:28 +01:00
ModInscrits = sco_moduleimpl . do_moduleimpl_inscription_list (
context , moduleimpl_id = M [ " moduleimpl_id " ]
2020-09-26 16:19:37 +02:00
)
2020-12-24 01:00:41 +01:00
enseignants = " , " . join (
[
context . Users . user_info ( m [ " ens_id " ] , REQUEST ) [ " nomprenom " ]
for m in M [ " ens " ]
]
)
2020-09-26 16:19:37 +02:00
l = {
" UE " : M [ " ue " ] [ " acronyme " ] ,
" Code " : M [ " module " ] [ " code " ] ,
" Module " : M [ " module " ] [ " abbrev " ] or M [ " module " ] [ " titre " ] ,
" _Module_class " : " scotext " ,
" Inscrits " : len ( ModInscrits ) ,
" Responsable " : context . Users . user_info ( M [ " responsable_id " ] ) [ " nomprenom " ] ,
" _Responsable_class " : " scotext " ,
2020-12-24 01:00:41 +01:00
" Enseignants " : enseignants ,
" _Enseignants_class " : " scotext " ,
2020-09-26 16:19:37 +02:00
" Coef. " : M [ " module " ] [ " coefficient " ] ,
# 'ECTS' : M['module']['ects'],
# Lien sur titre -> module
" _Module_target " : " moduleimpl_status?moduleimpl_id= " + M [ " moduleimpl_id " ] ,
" _Code_target " : " moduleimpl_status?moduleimpl_id= " + M [ " moduleimpl_id " ] ,
}
R . append ( l )
if M [ " module " ] [ " coefficient " ] :
sum_coef + = M [ " module " ] [ " coefficient " ]
if with_evals :
# Ajoute lignes pour evaluations
evals = nt . get_mod_evaluation_etat_list ( M [ " moduleimpl_id " ] )
evals . reverse ( ) # ordre chronologique
# Ajoute etat:
for e in evals :
# Cosmetic: conversions pour affichage
if e [ " etat " ] [ " evalcomplete " ] :
e [ " evalcomplete_str " ] = " Oui "
e [ " _evalcomplete_str_td_attrs " ] = ' style= " color: green; " '
else :
e [ " evalcomplete_str " ] = " Non "
e [ " _evalcomplete_str_td_attrs " ] = ' style= " color: red; " '
if int ( e [ " publish_incomplete " ] ) :
e [ " publish_incomplete_str " ] = " Oui "
e [ " _publish_incomplete_str_td_attrs " ] = ' style= " color: green; " '
else :
e [ " publish_incomplete_str " ] = " Non "
e [ " _publish_incomplete_str_td_attrs " ] = ' style= " color: red; " '
R + = evals
sums = { " _css_row_class " : " moyenne sortbottom " , " ects " : sum_ects , " Coef. " : sum_coef }
R . append ( sums )
columns_ids = [ " UE " , " Code " , " Module " , " Coef. " ]
2021-06-13 19:12:20 +02:00
if sco_preferences . get_preference ( context , " bul_show_ects " , formsemestre_id ) :
2020-09-26 16:19:37 +02:00
columns_ids + = [ " ects " ]
2020-12-24 01:00:41 +01:00
columns_ids + = [ " Inscrits " , " Responsable " , " Enseignants " ]
2020-09-26 16:19:37 +02:00
if with_evals :
columns_ids + = [
" jour " ,
" description " ,
" coefficient " ,
" evalcomplete_str " ,
" publish_incomplete_str " ,
]
titles = { title : title for title in columns_ids }
titles [ " ects " ] = " ECTS "
titles [ " jour " ] = " Evaluation "
titles [ " description " ] = " "
titles [ " coefficient " ] = " Coef. éval. "
titles [ " evalcomplete_str " ] = " Complète "
titles [ " publish_incomplete_str " ] = " Toujours Utilisée "
2021-01-17 22:31:28 +01:00
title = " %s %s " % ( scu . strcapitalize ( parcours . SESSION_NAME ) , sem [ " titremois " ] )
2020-09-26 16:19:37 +02:00
return GenTable (
columns_ids = columns_ids ,
rows = R ,
titles = titles ,
2021-01-17 22:31:28 +01:00
origin = " Généré par %s le " % VERSION . SCONAME + scu . timedate_human_repr ( ) + " " ,
2020-09-26 16:19:37 +02:00
caption = title ,
html_caption = title ,
html_class = " table_leftalign formsemestre_description " ,
2021-05-11 11:48:32 +02:00
base_url = " %s ?formsemestre_id= %s &with_evals= %s "
2020-09-26 16:19:37 +02:00
% ( REQUEST . URL0 , formsemestre_id , with_evals ) ,
page_title = title ,
2021-06-13 19:12:20 +02:00
html_title = html_sco_header . html_sem_header (
context , REQUEST , " Description du semestre " , sem , with_page_header = False
2020-09-26 16:19:37 +02:00
) ,
pdf_title = title ,
2021-06-13 19:12:20 +02:00
preferences = sco_preferences . SemPreferences ( context , formsemestre_id ) ,
2020-09-26 16:19:37 +02:00
)
def formsemestre_description (
context , formsemestre_id , format = " html " , with_evals = False , REQUEST = None
) :
""" Description du semestre sous forme de table exportable
Liste des modules et de leurs coefficients
"""
with_evals = int ( with_evals )
tab = formsemestre_description_table (
context , formsemestre_id , REQUEST , with_evals = with_evals
)
tab . html_before_table = """ <form name= " f " method= " get " action= " %s " >
< input type = " hidden " name = " formsemestre_id " value = " %s " > < / input >
< input type = " checkbox " name = " with_evals " value = " 1 " onchange = " document.f.submit() " """ % (
REQUEST . URL0 ,
formsemestre_id ,
)
if with_evals :
tab . html_before_table + = " checked "
tab . html_before_table + = " >indiquer les évaluations</input></form> "
return tab . make_page ( context , format = format , REQUEST = REQUEST )
2021-06-02 22:40:34 +02:00
# genere liste html pour accès aux groupes de ce semestre
def _make_listes_sem ( context , sem , REQUEST = None , with_absences = True ) :
context = context
authuser = REQUEST . AUTHENTICATED_USER
2021-06-15 12:34:33 +02:00
r = scu . ScoURL ( ) # root url
2021-06-02 22:40:34 +02:00
# construit l'URL "destination"
# (a laquelle on revient apres saisie absences)
query_args = cgi . parse_qs ( REQUEST . QUERY_STRING )
if " head_message " in query_args :
del query_args [ " head_message " ]
destination = " %s ? %s " % ( REQUEST . URL , urllib . urlencode ( query_args , True ) )
destination = destination . replace (
" % " , " %% "
) # car ici utilisee dans un format string !
#
H = [ ]
# pas de menu absences si pas autorise:
2021-06-15 15:38:38 +02:00
if with_absences and not authuser . has_permission ( Permission . ScoAbsChange ) :
2021-06-02 22:40:34 +02:00
with_absences = False
#
H . append (
' <h3>Listes de %(titre)s <span class= " infostitresem " >( %(mois_debut)s - %(mois_fin)s )</span></h3> '
% sem
)
formsemestre_id = sem [ " formsemestre_id " ]
# calcule dates 1er jour semaine pour absences
try :
if with_absences :
first_monday = sco_abs . ddmmyyyy ( sem [ " date_debut " ] ) . prev_monday ( )
FA = [ ] # formulaire avec menu saisi absences
FA . append (
' <td><form action= " Absences/SignaleAbsenceGrSemestre " method= " get " > '
)
FA . append (
' <input type= " hidden " name= " datefin " value= " %(date_fin)s " /> ' % sem
)
FA . append ( ' <input type= " hidden " name= " group_ids " value= " %(group_id)s " /> ' )
FA . append (
' <input type= " hidden " name= " destination " value= " %s " /> ' % destination
)
FA . append ( ' <input type= " submit " value= " Saisir absences du " /> ' )
FA . append ( ' <select name= " datedebut " class= " noprint " > ' )
date = first_monday
for jour in sco_abs . day_names ( context ) :
FA . append ( ' <option value= " %s " > %s </option> ' % ( date , jour ) )
date = date . next ( )
FA . append ( " </select> " )
FA . append (
' <a href= " Absences/EtatAbsencesGr?group_ids= %% (group_id)s&debut= %(date_debut)s &fin= %(date_fin)s " >état</a> '
% sem
)
FA . append ( " </form></td> " )
FormAbs = " \n " . join ( FA )
else :
FormAbs = " "
except ScoInvalidDateError : # dates incorrectes dans semestres ?
FormAbs = " "
#
H . append ( ' <div id= " grouplists " > ' )
# Genere liste pour chaque partition (categorie de groupes)
for partition in sco_groups . get_partitions_list ( context , sem [ " formsemestre_id " ] ) :
if not partition [ " partition_name " ] :
H . append ( " <h4>Tous les étudiants</h4> " % partition )
else :
H . append ( " <h4>Groupes de %(partition_name)s </h4> " % partition )
groups = sco_groups . get_partition_groups ( context , partition )
if groups :
H . append ( " <table> " )
for group in groups :
n_members = len (
sco_groups . get_group_members ( context , group [ " group_id " ] )
)
group [ " url " ] = r
if group [ " group_name " ] :
group [ " label " ] = " groupe %(group_name)s " % group
else :
group [ " label " ] = " liste "
H . append ( ' <tr class= " listegroupelink " > ' )
H . append (
""" <td>
< a href = " %(url)s /groups_view?group_ids= %(group_id)s " > % ( label ) s < / a >
< / td > < td >
( < a href = " %(url)s /groups_view?group_ids= %(group_id)s &format=xls " > format tableur < / a > )
< a href = " %(url)s /groups_view?curtab=tab-photos&group_ids= %(group_id)s &etat=I " > Photos < / a >
< / td > """
% group
)
H . append ( " <td>( %d étudiants)</td> " % n_members )
if with_absences :
H . append ( FormAbs % group )
H . append ( " </tr> " )
H . append ( " </table> " )
else :
H . append ( ' <p class= " help indent " >Aucun groupe dans cette partition ' )
if sco_groups . can_change_groups ( context , REQUEST , formsemestre_id ) :
H . append (
' (<a href= " affectGroups?partition_id= %s " class= " stdlink " >créer</a>) '
% partition [ " partition_id " ]
)
H . append ( " </p> " )
if sco_groups . can_change_groups ( context , REQUEST , formsemestre_id ) :
H . append (
' <h4><a href= " editPartitionForm?formsemestre_id= %s " >Ajouter une partition</a></h4> '
% formsemestre_id
)
H . append ( " </div> " )
return " \n " . join ( H )
2020-09-26 16:19:37 +02:00
def html_expr_diagnostic ( context , diagnostics ) :
""" Affiche messages d ' erreur des formules utilisateurs """
H = [ ]
H . append ( ' <div class= " ue_warning " >Erreur dans des formules utilisateurs:<ul> ' )
last_id , last_msg = None , None
for diag in diagnostics :
if " moduleimpl_id " in diag :
2021-01-17 22:31:28 +01:00
mod = sco_moduleimpl . do_moduleimpl_withmodule_list (
context , moduleimpl_id = diag [ " moduleimpl_id " ]
2020-09-26 16:19:37 +02:00
) [ 0 ]
H . append (
' <li>module <a href= " moduleimpl_status?moduleimpl_id= %s " > %s </a>: %s </li> '
% (
diag [ " moduleimpl_id " ] ,
mod [ " module " ] [ " abbrev " ] or mod [ " module " ] [ " code " ] or " ? " ,
diag [ " msg " ] ,
)
)
else :
if diag [ " ue_id " ] != last_id or diag [ " msg " ] != last_msg :
ue = context . do_ue_list ( { " ue_id " : diag [ " ue_id " ] } ) [ 0 ]
H . append (
' <li>UE " %s " : %s </li> '
% ( ue [ " acronyme " ] or ue [ " titre " ] or " ? " , diag [ " msg " ] )
)
last_id , last_msg = diag [ " ue_id " ] , diag [ " msg " ]
H . append ( " </ul></div> " )
return " " . join ( H )
def formsemestre_status_head (
context , formsemestre_id = None , REQUEST = None , page_title = None
) :
2020-10-14 15:28:09 +02:00
""" En-tête HTML des pages " semestre " """
2020-09-26 16:19:37 +02:00
semlist = sco_formsemestre . do_formsemestre_list (
context , args = { " formsemestre_id " : formsemestre_id }
)
if not semlist :
raise ScoValueError ( " Session inexistante (elle a peut être été supprimée ?) " )
sem = semlist [ 0 ]
F = context . formation_list ( args = { " formation_id " : sem [ " formation_id " ] } ) [ 0 ]
parcours = sco_codes_parcours . get_parcours_from_code ( F [ " type_parcours " ] )
page_title = page_title or " Modules de "
H = [
2021-06-13 19:12:20 +02:00
html_sco_header . html_sem_header (
context , REQUEST , page_title , sem , with_page_header = False , with_h2 = False
2020-09-26 16:19:37 +02:00
) ,
""" <table>
< tr > < td class = " fichetitre2 " > Formation : < / td > < td >
< a href = " Notes/ue_list?formation_id= %(formation_id)s " class = " discretelink " title = " Formation %(acronyme)s , v %(version)s " > % ( titre ) s < / a > """
% F ,
]
if sem [ " semestre_id " ] > = 0 :
H . append ( " , %s %s " % ( parcours . SESSION_NAME , sem [ " semestre_id " ] ) )
if sem [ " modalite " ] :
H . append ( " en %(modalite)s " % sem )
if sem [ " etapes " ] :
H . append (
" (étape <b><tt> %s </tt></b>) "
% ( sem [ " etapes_apo_str " ] or " - " )
)
H . append ( " </td></tr> " )
evals = sco_evaluations . do_evaluation_etat_in_sem ( context , formsemestre_id )
H . append (
' <tr><td class= " fichetitre2 " >Evaluations: </td><td> %(nb_evals_completes)s ok, %(nb_evals_en_cours)s en cours, %(nb_evals_vides)s vides '
% evals
)
if evals [ " last_modif " ] :
H . append (
" <em>(dernière note saisie le %s )</em> "
% evals [ " last_modif " ] . strftime ( " %d / % m/ % Y à % Hh % M " )
)
H . append ( " </td></tr> " )
if evals [ " attente " ] :
H . append (
""" <tr><td class= " fichetitre2 " ></td><td class= " redboldtext " >
Il y a des notes en attente ! Le classement des étudiants n ' a qu ' une valeur indicative .
< / td > < / tr > """
)
H . append ( " </table> " )
if sem [ " bul_hide_xml " ] != " 0 " :
H . append (
' <p class= " fontorange " ><em>Bulletins non publiés sur le portail</em></p> '
)
if sem [ " semestre_id " ] > = 0 and not sco_formsemestre . sem_une_annee ( context , sem ) :
H . append (
' <p class= " fontorange " ><em>Attention: ce semestre couvre plusieurs années scolaires !</em></p> '
)
2021-06-13 19:12:20 +02:00
# elif sco_preferences.get_preference(context, 'bul_display_publication', formsemestre_id):
2020-09-26 16:19:37 +02:00
# H.append('<p><em>Bulletins publiés sur le portail</em></p>')
return " " . join ( H )
def formsemestre_status ( context , formsemestre_id = None , REQUEST = None ) :
""" Tableau de bord semestre HTML """
# porté du DTML
2021-06-15 13:59:56 +02:00
cnx = ndb . GetDBConnexion ( )
2020-09-26 16:19:37 +02:00
sem = sco_formsemestre . get_formsemestre ( context , formsemestre_id )
2021-01-17 22:31:28 +01:00
Mlist = sco_moduleimpl . do_moduleimpl_withmodule_list (
context , formsemestre_id = formsemestre_id
2020-09-26 16:19:37 +02:00
)
2021-01-17 22:31:28 +01:00
# inscrits = context.do_formsemestre_inscription_list(
# args={"formsemestre_id": formsemestre_id}
# )
2020-09-26 16:19:37 +02:00
prev_ue_id = None
can_edit = sco_formsemestre_edit . can_edit_sem (
context , REQUEST , formsemestre_id , sem = sem
)
H = [
2021-06-13 18:29:53 +02:00
html_sco_header . sco_header (
context , REQUEST , page_title = " Semestre %s " % sem [ " titreannee " ]
) ,
2020-09-26 16:19:37 +02:00
' <div class= " formsemestre_status " > ' ,
formsemestre_status_head (
context , formsemestre_id = formsemestre_id , page_title = " Tableau de bord "
) ,
""" <p><b style= " font-size: 130 % " >Tableau de bord: </b><span class= " help " >cliquez sur un module pour saisir des notes</span></p> """ ,
]
2021-06-13 23:37:14 +02:00
nt = sco_core . get_notes_cache (
context ,
) . get_NotesTable ( context , formsemestre_id )
2020-09-26 16:19:37 +02:00
if nt . expr_diagnostics :
H . append ( html_expr_diagnostic ( context , nt . expr_diagnostics ) )
H . append (
"""
< p >
< table class = " formsemestre_status " >
< tr >
< th class = " formsemestre_status " > Code < / th >
< th class = " formsemestre_status " > Module < / th >
< th class = " formsemestre_status " > Inscrits < / th >
< th class = " resp " > Responsable < / th >
< th class = " evals " > Evaluations < / th > < / tr > """
)
2020-12-24 01:29:50 +01:00
mails_enseignants = set (
[
context . Users . user_info ( ens_id , REQUEST ) [ " email " ]
for ens_id in sem [ " responsables " ]
]
) # adr. mail des enseignants
2020-09-26 16:19:37 +02:00
for M in Mlist :
Mod = M [ " module " ]
ModDescr = (
" Module "
+ M [ " module " ] [ " titre " ]
+ " , coef. "
+ str ( M [ " module " ] [ " coefficient " ] )
)
ModEns = context . Users . user_info ( M [ " responsable_id " ] ) [ " nomcomplet " ]
if M [ " ens " ] :
ModEns + = " (resp.), " + " , " . join (
[ context . Users . user_info ( e [ " ens_id " ] ) [ " nomcomplet " ] for e in M [ " ens " ] ]
)
2021-01-17 22:31:28 +01:00
ModInscrits = sco_moduleimpl . do_moduleimpl_inscription_list (
context , moduleimpl_id = M [ " moduleimpl_id " ]
2020-09-26 16:19:37 +02:00
)
2020-12-24 01:29:50 +01:00
mails_enseignants . add (
context . Users . user_info ( M [ " responsable_id " ] , REQUEST ) [ " email " ]
)
mails_enseignants | = set (
[ context . Users . user_info ( m [ " ens_id " ] , REQUEST ) [ " email " ] for m in M [ " ens " ] ]
)
2020-09-26 16:19:37 +02:00
ue = M [ " ue " ]
if prev_ue_id != ue [ " ue_id " ] :
prev_ue_id = ue [ " ue_id " ]
acronyme = ue [ " acronyme " ]
titre = ue [ " titre " ]
2021-06-13 19:12:20 +02:00
if sco_preferences . get_preference ( context , " use_ue_coefs " , formsemestre_id ) :
2020-09-26 16:19:37 +02:00
titre + = " <b>(coef. %s )</b> " % ( ue [ " coefficient " ] or 0.0 )
H . append (
""" <tr class= " formsemestre_status_ue " ><td colspan= " 4 " >
< span class = " status_ue_acro " > % s < / span >
< span class = " status_ue_title " > % s < / span >
< / td > < td > """
% ( acronyme , titre )
)
expr = sco_compute_moy . get_ue_expression (
formsemestre_id , ue [ " ue_id " ] , cnx , html_quote = True
)
if can_edit :
H . append (
2021-05-11 11:48:32 +02:00
' <a href= " edit_ue_expr?formsemestre_id= %s &ue_id= %s " > '
2020-09-26 16:19:37 +02:00
% ( formsemestre_id , ue [ " ue_id " ] )
)
H . append (
2021-01-17 22:31:28 +01:00
scu . icontag (
2020-09-26 16:19:37 +02:00
" formula " ,
title = " Mode calcul moyenne d ' UE " ,
style = " vertical-align:middle " ,
)
)
if can_edit :
H . append ( " </a> " )
if expr :
H . append (
""" <span class= " formula " title= " mode de calcul de la moyenne d ' UE " > %s </span> """
% expr
)
H . append ( " </td></tr> " )
2021-01-17 22:31:28 +01:00
if M [ " ue " ] [ " type " ] != sco_codes_parcours . UE_STANDARD :
2020-09-26 16:19:37 +02:00
fontorange = " fontorange " # style css additionnel
else :
fontorange = " "
etat = sco_evaluations . do_evaluation_etat_in_mod (
context , nt , M [ " moduleimpl_id " ]
)
if (
etat [ " nb_evals_completes " ] > 0
and etat [ " nb_evals_en_cours " ] == 0
and etat [ " nb_evals_vides " ] == 0
) :
H . append ( ' <tr class= " formsemestre_status_green %s " > ' % fontorange )
else :
H . append ( ' <tr class= " formsemestre_status %s " > ' % fontorange )
H . append (
' <td class= " formsemestre_status_code " ><a href= " moduleimpl_status?moduleimpl_id= %s " title= " %s " class= " stdlink " > %s </a></td> '
% ( M [ " moduleimpl_id " ] , ModDescr , Mod [ " code " ] )
)
H . append (
' <td class= " scotext " ><a href= " moduleimpl_status?moduleimpl_id= %s " title= " %s " class= " formsemestre_status_link " > %s </a></td> '
% ( M [ " moduleimpl_id " ] , ModDescr , Mod [ " abbrev " ] or Mod [ " titre " ] )
)
H . append ( ' <td class= " formsemestre_status_inscrits " > %s </td> ' % len ( ModInscrits ) )
H . append (
' <td class= " resp scotext " ><a class= " discretelink " href= " moduleimpl_status?moduleimpl_id= %s " title= " %s " > %s </a></td> '
% (
M [ " moduleimpl_id " ] ,
ModEns ,
context . Users . user_info ( M [ " responsable_id " ] ) [ " prenomnom " ] ,
)
)
2021-01-17 22:31:28 +01:00
if Mod [ " module_type " ] == scu . MODULE_STANDARD :
2020-09-26 16:19:37 +02:00
H . append ( ' <td class= " evals " > ' )
nb_evals = (
etat [ " nb_evals_completes " ]
+ etat [ " nb_evals_en_cours " ]
+ etat [ " nb_evals_vides " ]
)
if nb_evals != 0 :
H . append (
' <a href= " moduleimpl_status?moduleimpl_id= %s " class= " formsemestre_status_link " > %s prévues, %s ok</a> '
% ( M [ " moduleimpl_id " ] , nb_evals , etat [ " nb_evals_completes " ] )
)
if etat [ " nb_evals_en_cours " ] > 0 :
H . append (
' , <span><a class= " redlink " href= " moduleimpl_status?moduleimpl_id= %s " title= " Il manque des notes " > %s en cours</a></span> '
% ( M [ " moduleimpl_id " ] , etat [ " nb_evals_en_cours " ] )
)
if etat [ " attente " ] :
H . append (
' <span><a class= " redlink " href= " moduleimpl_status?moduleimpl_id= %s " title= " Il y a des notes en attente " >[en attente]</a></span> '
% M [ " moduleimpl_id " ]
)
2021-01-17 22:31:28 +01:00
elif Mod [ " module_type " ] == scu . MODULE_MALUS :
2020-09-26 16:19:37 +02:00
nb_malus_notes = sum (
[
e [ " etat " ] [ " nb_notes " ]
for e in nt . get_mod_evaluation_etat_list ( M [ " moduleimpl_id " ] )
]
)
H . append (
""" <td class= " malus " >
< a href = " moduleimpl_status?moduleimpl_id= %s " class = " formsemestre_status_link " > malus ( % d notes ) < / a >
"""
% ( M [ " moduleimpl_id " ] , nb_malus_notes )
)
else :
raise ValueError ( " Invalid module_type " ) # a bug
H . append ( " </td></tr> " )
H . append ( " </table></p> " )
2021-06-13 19:12:20 +02:00
if sco_preferences . get_preference ( context , " use_ue_coefs " , formsemestre_id ) :
2020-09-26 16:19:37 +02:00
H . append (
"""
< p class = " infop " > utilise les coefficients d ' UE pour calculer la moyenne générale.</p>
"""
)
# --- LISTE DES ETUDIANTS
2021-06-13 18:29:53 +02:00
H + = [
' <div id= " groupes " > ' ,
_make_listes_sem ( context , sem , REQUEST ) ,
" </div> " ,
]
2020-12-24 01:29:50 +01:00
# --- Lien mail enseignants:
adrlist = list ( mails_enseignants - set ( [ " " ] ) )
if adrlist :
H . append (
' <p><a class= " stdlink " href= " mailto:?cc= %s " >Courrier aux %d enseignants du semestre</a></p> '
% ( " , " . join ( adrlist ) , len ( adrlist ) )
)
2021-06-13 18:29:53 +02:00
return " " . join ( H ) + html_sco_header . sco_footer ( context , REQUEST )