# -*- mode: python -*- # -*- coding: utf-8 -*- ############################################################################## # # Gestion scolarite IUT # # Copyright (c) 1999 - 2021 Emmanuel Viennet. All rights reserved. # # 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 module """ import time import urllib import sco_utils as scu from sco_utils import ( EVALUATION_NORMALE, EVALUATION_RATTRAPAGE, EVALUATION_SESSION2, ) from sco_permissions import ScoEtudInscrit, ScoAbsChange from notes_log import log from TrivialFormulator import TrivialFormulator, TF # from notes_table import * import sco_groups import sco_evaluations import htmlutils import sco_excel from gen_tables import GenTable from htmlutils import histogram_notes import sco_moduleimpl import sco_formsemestre import sco_formsemestre_status import htmlutils import sco_saisie_notes import sco_compute_moy import sco_abs # ported from old DTML code in oct 2009 # menu evaluation dans moduleimpl def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None): "Menu avec actions sur une evaluation" E = context.do_evaluation_list({"evaluation_id": evaluation_id})[0] modimpl = sco_moduleimpl.do_moduleimpl_list( context, moduleimpl_id=E["moduleimpl_id"] )[0] group_id = sco_groups.get_default_group(context, modimpl["formsemestre_id"]) if ( sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False ) and nbnotes != 0 ): sup_label = "Supprimer évaluation impossible (il y a des notes)" else: sup_label = "Supprimer évaluation" menuEval = [ { "title": "Saisir notes", "url": "saisie_notes?evaluation_id=" + evaluation_id, "enabled": sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"] ), }, { "title": "Modifier évaluation", "url": "evaluation_edit?evaluation_id=" + evaluation_id, "enabled": sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False ), }, { "title": sup_label, "url": "evaluation_delete?evaluation_id=" + evaluation_id, "enabled": nbnotes == 0 and sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False ), }, { "title": "Supprimer toutes les notes", "url": "evaluation_suppress_alln?evaluation_id=" + evaluation_id, "enabled": sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False ), }, { "title": "Afficher les notes", "url": "evaluation_listenotes?evaluation_id=" + evaluation_id, "enabled": nbnotes > 0, }, { "title": "Placement étudiants", "url": "placement_eval_selectetuds?evaluation_id=" + evaluation_id, "enabled": nbnotes == 0 and sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"] ), }, { "title": "Absences ce jour", "url": "Absences/EtatAbsencesDate?date=%s&group_ids=%s" % (urllib.quote(E["jour"], safe=""), group_id), "enabled": E["jour"], }, { "title": "Vérifier notes vs absents", "url": "evaluation_check_absences_html?evaluation_id=%s" % (evaluation_id), "enabled": nbnotes > 0 and E["jour"], }, ] return htmlutils.make_menu("actions", menuEval, alone=True) def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=None): """Tableau de bord module (liste des evaluations etc)""" authuser = REQUEST.AUTHENTICATED_USER M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] formsemestre_id = M["formsemestre_id"] Mod = context.do_module_list(args={"module_id": M["module_id"]})[0] sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] ModInscrits = sco_moduleimpl.do_moduleimpl_inscription_list( context, moduleimpl_id=M["moduleimpl_id"] ) nt = context._getNotesCache().get_NotesTable(context, formsemestre_id) ModEvals = context.do_evaluation_list({"moduleimpl_id": moduleimpl_id}) ModEvals.sort( key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True ) # la plus RECENTE en tête # caneditevals = sco_saisie_notes.can_edit_notes( context, authuser, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"] ) caneditnotes = sco_saisie_notes.can_edit_notes(context, authuser, moduleimpl_id) arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags(context, REQUEST) # H = [ context.sco_header(REQUEST, page_title="Module %(titre)s" % Mod), """
Responsable: | """, context.Users.user_info(M["responsable_id"])["nomprenom"], """(%(responsable_id)s)""" % M, ] try: sco_moduleimpl.can_change_module_resp(context, REQUEST, moduleimpl_id) H.append( """modifier""" % moduleimpl_id ) except: pass H.append(""" | """) H.append( ", ".join([context.Users.user_info(m["ens_id"])["nomprenom"] for m in M["ens"]]) ) H.append(""" | """) try: sco_moduleimpl.can_change_ens(context, REQUEST, moduleimpl_id) H.append( """modifier les enseignants""" % moduleimpl_id ) except: pass H.append(""" | |
""") if sem["semestre_id"] >= 0: H.append("""Semestre: | %s""" % sem["semestre_id"]) else: H.append(""" | """) if sem["etat"] != "1": H.append(scu.icontag("lock32_img", title="verrouillé")) H.append( """ | Coef dans le semestre: %(coefficient)s | |
Formation: | %(titre)s | |||
Inscrits: | %d étudiants""" % len(ModInscrits) ) if authuser.has_permission(ScoEtudInscrit, context): H.append( """modifier""" % M["moduleimpl_id"] ) H.append(" | |||
Règle de calcul: moyenne=%s' % M["computation_expr"] ) if sco_moduleimpl.can_change_ens( context, REQUEST, moduleimpl_id, raise_exc=False ): H.append( 'modifier' % moduleimpl_id ) H.append(" | ||||
règle de calcul standard' ) if sco_moduleimpl.can_change_ens( context, REQUEST, moduleimpl_id, raise_exc=False ): H.append( ' (changer)' % moduleimpl_id ) H.append(" | ||||
Absences dans ce module' % moduleimpl_id ) # Adapté à partir d'une suggestion de DS (Le Havre) # Liens saisies absences seulement si permission et date courante dans le semestre if authuser.has_permission( ScoAbsChange, context ) and sco_formsemestre.sem_est_courant(context, sem): datelundi = sco_abs.ddmmyyyy(time.strftime("%d/%m/%Y")).prev_monday() group_id = sco_groups.get_default_group(context, formsemestre_id) H.append( 'Saisie Absences hebdo.' % (formsemestre_id, moduleimpl_id, datelundi, group_id) ) H.append(" |
""" % tr_class_1) if eval["jour"]: H.append("""Le %(jour)s%(descrheure)s""" % eval) else: H.append( """Evaluation sans date""" % eval ) H.append( " %(description)s" % eval ) H.append( " " ) if eval["evaluation_type"] == EVALUATION_RATTRAPAGE: H.append( """rattrapage""" ) elif eval["evaluation_type"] == EVALUATION_SESSION2: H.append( """session 2""" ) if etat["last_modif"]: H.append( """(dernière modif le %s)""" % etat["last_modif"].strftime("%d/%m/%Y à %Hh%M") ) H.append('') if has_expression or True: H.append( """%2d""" % eval_index ) # Fleches: H.append('') if eval_index != (len(ModEvals) - 1) and caneditevals: H.append( '%s' % (eval["evaluation_id"], arrow_up) ) else: H.append(arrow_none) if (eval_index > 0) and caneditevals: H.append( '%s' % (eval["evaluation_id"], arrow_down) ) else: H.append(arrow_none) H.append("") eval_index -= 1 H.append(""" | |||||||
Durée | Coef. | Notes | Abs | N | Moyenne """ % tr_class ) if etat["evalcomplete"]: etat_txt = """(prise en compte)""" etat_descr = "notes utilisées dans les moyennes" elif eval["publish_incomplete"] != "0": etat_txt = """(prise en compte immédiate)""" etat_descr = ( "il manque des notes, mais la prise en compte immédiate a été demandée" ) elif etat["nb_notes"] != 0: etat_txt = "(non prise en compte)" etat_descr = "il manque des notes" else: etat_txt = "" if caneditevals and etat_txt: etat_txt = ( '%s' % (eval["evaluation_id"], etat_descr, etat_txt) ) H.append(etat_txt) H.append(""" | ||
---|---|---|---|---|---|---|---|
""" % tr_class) if caneditevals: H.append( """%s""" % ( eval["evaluation_id"], scu.icontag( "edit_img", alt="modifier", title="Modifier informations" ), ) ) if caneditnotes: H.append( """%s""" % ( eval["evaluation_id"], scu.icontag( "notes_img", alt="saisie notes", title="Saisie des notes" ), ) ) if etat["nb_notes"] == 0: if caneditevals: H.append( """""" % eval ) H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer")) if caneditevals: H.append("""""") elif etat["evalcomplete"]: H.append( """%s""" % (eval["evaluation_id"], scu.icontag("status_green_img", title="ok")) ) else: if etat["evalattente"]: H.append( """%s""" % ( eval["evaluation_id"], scu.icontag( "status_greenorange_img", file_format="gif", title="notes en attente", ), ) ) else: H.append( """%s""" % ( eval["evaluation_id"], scu.icontag("status_orange_img", title="il manque des notes"), ) ) # if eval["visibulletin"] == "1": H.append( scu.icontag( "status_visible_img", title="visible dans bulletins intermédiaires" ) ) else: H.append(" ") H.append(' | ') if caneditnotes: H.append( moduleimpl_evaluation_menu( context, eval["evaluation_id"], nbnotes=etat["nb_notes"], REQUEST=REQUEST, ) ) H.append(" | ") # H.append( """%s | %s | """ % (eval["duree"], "%g" % eval["coefficient"]) ) H.append( """%(nb_notes)s / %(nb_inscrits)s | %(nb_abs)s | %(nb_neutre)s | """ % etat ) if etat["moy"]: H.append("%s / %g" % (etat["moy"], eval["note_max"])) H.append( """ (afficher)""" % (eval["evaluation_id"],) ) else: H.append( """saisir notes""" % (eval["evaluation_id"]) ) H.append(""" |
""" % tr_class) H.append(""" | |||||||
""") if gr_moyenne["group_name"] is None: name = "Tous" # tous else: name = "Groupe %s" % gr_moyenne["group_name"] H.append( """ | %s | """ % name ) if gr_moyenne["gr_nb_notes"] > 0: H.append("%(gr_moy)s" % gr_moyenne) H.append( """ (%s notes""" % ( eval["evaluation_id"], gr_moyenne["group_id"], gr_moyenne["gr_nb_notes"], ) ) if gr_moyenne["gr_nb_att"] > 0: H.append( """, %s en attente""" % gr_moyenne["gr_nb_att"] ) H.append(""")""") if gr_moyenne["group_id"] in etat["gr_incomplets"]: H.append("""[""") if caneditnotes: H.append( """incomplet]""" % (eval["evaluation_id"], gr_moyenne["group_id"]) ) else: H.append("""incomplet]""") else: H.append(""" """) if caneditnotes: H.append( """""" % (eval["evaluation_id"], gr_moyenne["group_id"]) ) H.append("pas de notes") if caneditnotes: H.append("""""") H.append("") H.append(""" | |||||
""") if sem["etat"] != "1": H.append("""%s semestre verrouillé""" % scu.icontag("lock32_img")) else: H.append(top_table_links) H.append( """ |
Rappel : seules les notes des évaluations complètement saisies (affichées en vert) apparaissent dans les bulletins.
""" % ( scu.icontag("edit_img"), scu.icontag("notes_img"), scu.icontag("delete_img"), scu.icontag("status_orange_img"), scu.icontag("status_green_img"), scu.icontag("status_visible_img"), ) ) H.append(context.sco_footer(REQUEST)) return "".join(H)