Ejemplo n.º 1
0
def index():
    session = utils.loadSession()
    connection = utils.engine.connect()

    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsMailles(
            connection, config.NB_DAY_LAST_OBS, config.ATTR_MAIN_PHOTO
        )
    else:
        observations = vmObservationsRepository.lastObservations(
            connection, config.NB_DAY_LAST_OBS, config.ATTR_MAIN_PHOTO
        )

    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    mostViewTaxon = vmTaxonsMostView.mostViewTaxon(connection)
    stat = vmObservationsRepository.statIndex(connection)
    customStat = vmObservationsRepository.genericStat(
        connection, config.RANG_STAT
    )
    customStatMedias = vmObservationsRepository.genericStatMedias(
        connection, config.RANG_STAT
    )

    configuration = base_configuration.copy()
    configuration.update({
        'HOMEMAP': True,
        'TEXT_LAST_OBS': config.TEXT_LAST_OBS,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'AFFICHAGE_DERNIERES_OBS': config.AFFICHAGE_DERNIERES_OBS,
        'AFFICHAGE_EN_CE_MOMENT': config.AFFICHAGE_EN_CE_MOMENT,
        'AFFICHAGE_STAT_GLOBALES': config.AFFICHAGE_STAT_GLOBALES,
        'AFFICHAGE_RANG_STAT': config.AFFICHAGE_RANG_STAT,
        'COLONNES_RANG_STAT': config.COLONNES_RANG_STAT,
        'RANG_STAT_FR': config.RANG_STAT_FR,
        'MAP': config.MAP,
        'AFFICHAGE_INTRODUCTION': config.AFFICHAGE_INTRODUCTION,
        'AFFICHAGE_LOGOS_ORGAS': config.AFFICHAGE_LOGOS_ORGAS
    })

    connection.close()
    session.close()

    return render_template(
        'templates/index.html',
        observations=observations,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        mostViewTaxon=mostViewTaxon,
        stat=stat,
        customStat=customStat,
        customStatMedias=customStatMedias,
        configuration=configuration
    )
Ejemplo n.º 2
0
def get_staticpages(page):
    session = utils.loadSession()
    if (page not in config.STATIC_PAGES):
        abort(404)
    static_page = config.STATIC_PAGES[page]
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    configuration = base_configuration
    session.close()
    return render_template(
        static_page['template'],
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        configuration=configuration
    )
Ejemplo n.º 3
0
def photos():
    session = utils.loadSession()
    connection = utils.engine.connect()

    groups = vmTaxonsRepository.getINPNgroupPhotos(connection)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    configuration = base_configuration

    session.close()
    connection.close()
    return render_template(
        'templates/galeriePhotos.html',
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        groups=groups,
        configuration=configuration
    )
Ejemplo n.º 4
0
def ficheRangTaxonomie(cd_ref):
    session = utils.loadSession()
    connection = utils.engine.connect()

    listTaxons = vmTaxonsRepository.getTaxonsChildsList(connection, cd_ref)
    referenciel = vmTaxrefRepository.getInfoFromCd_ref(session, cd_ref)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    taxonomyHierarchy = vmTaxrefRepository.getAllTaxonomy(session, cd_ref)
    orgas = vmObservationsRepository.getOrgasObservations(connection, cd_ref)
    observers = vmObservationsRepository.getObservers(connection, cd_ref)

    connection.close()
    session.close()

    configuration = base_configuration.copy()
    configuration.update({
        'LIMIT_FICHE_LISTE_HIERARCHY': config.LIMIT_FICHE_LISTE_HIERARCHY,
        'AFFICHAGE_ORGAS_OBS_FICHETAXO': config.AFFICHAGE_ORGAS_OBS_FICHETAXO,
        'MYTYPE': 0,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION,
    })

    return render_template(
        'templates/ficheRangTaxonomique.html',
        listTaxons=listTaxons,
        referenciel=referenciel,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        taxonomyHierarchy=taxonomyHierarchy,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )
Ejemplo n.º 5
0
def ficheGroupe(groupe):
    session = utils.loadSession()
    connection = utils.engine.connect()

    groups = vmTaxonsRepository.getAllINPNgroup(connection)
    listTaxons = vmTaxonsRepository.getTaxonsGroup(connection, groupe)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    orgas = vmObservationsRepository.getGroupeOrgas(connection, groupe)
    observers = vmObservationsRepository.getGroupeObservers(connection, groupe)

    session.close()
    connection.close()

    configuration = base_configuration.copy()
    configuration.update({
        'LIMIT_FICHE_LISTE_HIERARCHY': config.LIMIT_FICHE_LISTE_HIERARCHY,
        'AFFICHAGE_ORGAS_OBS_FICHEGROUPE': config.AFFICHAGE_ORGAS_OBS_FICHEGROUPE,
        'MYTYPE': 0,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    return render_template(
        'templates/ficheGroupe.html',
        listTaxons=listTaxons,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        referenciel=groupe,
        groups=groups,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )
Ejemplo n.º 6
0
def ficheDepartement(num_dpt):
    session = utils.loadSession()
    connection = utils.engine.connect()
    listTaxons = vmTaxonsRepository.getTaxonsDpt(connection, num_dpt)
    listespeces = vmTaxonsRepository.getListeTaxonsDpt(connection, num_dpt)
    taxonProPatri = vmStatsStatutTaxonDptRepository.getNbTaxonsProPatriDpt(connection, num_dpt)
    statsStatutTaxonDpt = vmStatsStatutTaxonDptRepository.getStatsStatutsTaxonsDpt(connection, num_dpt)
    infosDpt = vmDepartementRepository.infosDpt(connection, num_dpt)
    communesDpt = vmDepartementRepository.communesDptChilds(connection, num_dpt)
    epciDpt = vmDepartementRepository.epciDptChilds(connection, num_dpt)
    dpt = vmDepartementRepository.getDepartementFromNumdpt(connection, num_dpt)
    statsorgataxondpt = vmStatsOrgaDptRepository.getStatsOrgaTaxonDptChilds(connection, num_dpt)
    statsorgadatadpt = vmStatsOrgaDptRepository.getStatsOrgaDataDptChilds(connection, num_dpt)
    statsgroup2inpndpt = vmStatsGroup2inpnDptRepository.getStatsGroup2inpnDptChilds(connection, num_dpt)
    statstaxongroup2inpndpt = vmStatsTaxonGroup2inpnDptRepository.getStatsTaxonGroup2inpnDptChilds(connection, num_dpt)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    #if config.AFFICHAGE_MAILLE:
    #    if (config.TAILLE_MAILLES_DPT=='10'):
    #        observations = vmObservationsMaillesRepository.lastObservationsDptMaille10(
    #        connection, config.NB_LAST_OBS, num_dpt
    #        )
    #    else:
    #        observations = vmObservationsMaillesRepository.lastObservationsDptMaille(
    #        connection, config.NB_LAST_OBS, num_dpt
    #        )
    #else:
    #    observations = vmObservationsRepository.lastObservationsDpt(
    #        connection, config.NB_LAST_OBS, num_dpt
    #    )
    orgas = vmObservationsRepository.getOrgasDpt(connection, num_dpt)
    observers = vmObservationsRepository.getObserversDpt(connection, num_dpt)

    configuration = base_configuration.copy()
    configuration.update({
        'NB_LAST_OBS': config.NB_LAST_OBS,
        'AFFICHAGE_ORGAS_OBS_FICHECOMM': config.AFFICHAGE_ORGAS_OBS_FICHECOMM,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'TAILLE_MAILLES_DPT': config.TAILLE_MAILLES_DPT,
        'MAP': config.MAP,
        'MYTYPE': 0,
        'PRESSION_PROSPECTION': config.PRESSION_PROSPECTION,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    session.close()
    connection.close()

    return render_template(
        'templates/ficheDepartement.html',
        num_dpt=num_dpt,
        listTaxons=listTaxons,
        listespeces=listespeces,
        taxonProPatri=taxonProPatri,
        statsStatutTaxonDpt=statsStatutTaxonDpt,
        infosDpt=infosDpt,
        communesDpt=communesDpt,
        epciDpt=epciDpt,
        referenciel=dpt,
        statsorgataxondpt=statsorgataxondpt,
        statsorgadatadpt=statsorgadatadpt,
        statsgroup2inpndpt=statsgroup2inpndpt,
        statstaxongroup2inpndpt=statstaxongroup2inpndpt,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        #observations=observations,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )
Ejemplo n.º 7
0
def ficheEpci(nom_epci_simple):
    session = utils.loadSession()
    connection = utils.engine.connect()
    listTaxons = vmTaxonsRepository.getTaxonsEpci(connection, nom_epci_simple)
    listespeces = vmTaxonsRepository.getListeTaxonsEpci(connection, nom_epci_simple)
    taxonProPatri = vmStatsStatutTaxonEpciRepository.getNbTaxonsProPatriEpci(connection, nom_epci_simple)
    statsStatutTaxonEpci = vmStatsStatutTaxonEpciRepository.getStatsStatutsTaxonsEpci(connection, nom_epci_simple)
    infosEpci = vmEpciRepository.infosEpci(connection, nom_epci_simple)
    communesEpci = vmEpciRepository.communesEpciChilds(connection, nom_epci_simple)
    epci = vmEpciRepository.getEpciFromNomsimple(connection, nom_epci_simple)
    epciDpt = vmEpciRepository.getDptFromEpci(connection, nom_epci_simple)
    statsorgataxonepci = vmStatsOrgaEpciRepository.getStatsOrgaTaxonEpciChilds(connection, nom_epci_simple)
    statsorgadataepci = vmStatsOrgaEpciRepository.getStatsOrgaDataEpciChilds(connection, nom_epci_simple)
    statsgroup2inpnepci = vmStatsGroup2inpnEpciRepository.getStatsGroup2inpnEpciChilds(connection, nom_epci_simple)
    statstaxongroup2inpnepci = vmStatsTaxonGroup2inpnEpciRepository.getStatsTaxonGroup2inpnEpciChilds(connection, nom_epci_simple)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsEpciMaille(
            connection, config.NB_LAST_OBS, nom_epci_simple
        )
    else:
        observations = vmObservationsRepository.lastObservationsEpci(
            connection, config.NB_LAST_OBS, nom_epci_simple
        )
    orgas = vmObservationsRepository.getOrgasEpci(connection, nom_epci_simple)
    observers = vmObservationsRepository.getObserversEpci(connection, nom_epci_simple)

    configuration = base_configuration.copy()
    configuration.update({
        'NB_LAST_OBS': config.NB_LAST_OBS,
        'AFFICHAGE_ORGAS_OBS_FICHECOMM': config.AFFICHAGE_ORGAS_OBS_FICHECOMM,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'MAP': config.MAP,
        'MYTYPE': 0,
        'PRESSION_PROSPECTION': config.PRESSION_PROSPECTION,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    session.close()
    connection.close()

    return render_template(
        'templates/ficheEpci.html',
        nom_epci_simple=nom_epci_simple,
        listTaxons=listTaxons,
        listespeces=listespeces,
        taxonProPatri=taxonProPatri,
        statsStatutTaxonEpci=statsStatutTaxonEpci,
        infosEpci=infosEpci,
        communesEpci=communesEpci,
        referenciel=epci,
        epciDpt=epciDpt,
        statsorgataxonepci=statsorgataxonepci,
        statsorgadataepci=statsorgadataepci,
        statsgroup2inpnepci=statsgroup2inpnepci,
        statstaxongroup2inpnepci=statstaxongroup2inpnepci,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        observations=observations,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )
Ejemplo n.º 8
0
def ficheCommune(insee):
    session = utils.loadSession()
    connection = utils.engine.connect()
    listTaxons = vmTaxonsRepository.getTaxonsCommunes(connection, insee)
    listespeces = vmTaxonsRepository.getListeTaxonsCommunes(connection, insee)
    taxonProPatri = vmStatsStatutTaxonCommRepository.getNbTaxonsProPatriCommunes(connection, insee)
    statsStatutTaxonComm = vmStatsStatutTaxonCommRepository.getStatsStatutsTaxonsCommunes(connection, insee)
    infosCommune = vmCommunesRepository.infosCommune(connection, insee)
    epciCommune = vmCommunesRepository.epciCommune(connection, insee)
    commune = vmCommunesRepository.getCommuneFromInsee(connection, insee)
    statsorgataxoncomm = vmStatsOrgaCommRepository.getStatsOrgaTaxonCommChilds(connection, insee)
    statsorgadatacomm = vmStatsOrgaCommRepository.getStatsOrgaDataCommChilds(connection, insee)
    statsgroup2inpncomm = vmStatsGroup2inpnCommRepository.getStatsGroup2inpnCommChilds(connection, insee)
    statstaxongroup2inpncomm = vmStatsTaxonGroup2inpnCommRepository.getStatsTaxonGroup2inpnCommChilds(connection, insee)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsCommuneMaille(
            connection, config.NB_LAST_OBS, insee
        )
    else:
        observations = vmObservationsRepository.lastObservationsCommune(
            connection, config.NB_LAST_OBS, insee
        )
    orgas = vmObservationsRepository.getOrgasCommunes(connection, insee)
    observers = vmObservationsRepository.getObserversCommunes(connection, insee)

    configuration = base_configuration.copy()
    configuration.update({
        'NB_LAST_OBS': config.NB_LAST_OBS,
        'AFFICHAGE_ORGAS_OBS_FICHECOMM': config.AFFICHAGE_ORGAS_OBS_FICHECOMM,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'MAP': config.MAP,
        'MYTYPE': 0,
        'PRESSION_PROSPECTION': config.PRESSION_PROSPECTION,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    session.close()
    connection.close()

    return render_template(
        'templates/ficheCommune.html',
        insee=insee,
        listTaxons=listTaxons,
        listespeces=listespeces,
        taxonProPatri=taxonProPatri,
        statsStatutTaxonComm=statsStatutTaxonComm,
        infosCommune=infosCommune,
        epciCommune=epciCommune,
        referenciel=commune,
        statsorgataxoncomm=statsorgataxoncomm,
        statsorgadatacomm=statsorgadatacomm,
        statsgroup2inpncomm=statsgroup2inpncomm,
        statstaxongroup2inpncomm=statstaxongroup2inpncomm,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        observations=observations,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )
Ejemplo n.º 9
0
def ficheEspece(cd_ref):
    session = utils.loadSession()
    connection = utils.engine.connect()

    cd_ref = int(cd_ref)
    taxon = vmTaxrefRepository.searchEspece(connection, cd_ref)
    statsorgataxon = vmStatsOrgaTaxonRepository.getStatsOrgaTaxonChilds(connection, cd_ref)
    months = vmMoisRepository.getMonthlyObservationsChilds(connection, cd_ref)
    synonyme = vmTaxrefRepository.getSynonymy(connection, cd_ref)
    communes = vmCommunesRepository.getCommunesObservationsChilds(
        connection, cd_ref
    )
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    taxonomyHierarchy = vmTaxrefRepository.getAllTaxonomy(session, cd_ref)
    firstPhoto = vmMedias.getFirstPhoto(
        connection, cd_ref, config.ATTR_MAIN_PHOTO
    )
    photoCarousel = vmMedias.getPhotoCarousel(
        connection, cd_ref, config.ATTR_OTHER_PHOTO
    )
    videoAudio = vmMedias.getVideo_and_audio(
        connection, cd_ref, config.ATTR_AUDIO, config.ATTR_VIDEO_HEBERGEE,
        config.ATTR_YOUTUBE, config.ATTR_DAILYMOTION, config.ATTR_VIMEO
    )
    articles = vmMedias.getLinks_and_articles(
        connection, cd_ref, config.ATTR_LIEN, config.ATTR_PDF
    )
    taxonDescription = vmCorTaxonAttribut.getAttributesTaxon(
        connection, cd_ref, config.ATTR_DESC, config.ATTR_COMMENTAIRE,
        config.ATTR_MILIEU, config.ATTR_CHOROLOGIE
    )
    orgas = vmObservationsRepository.getOrgasObservations(connection, cd_ref)
    observers = vmObservationsRepository.getObservers(connection, cd_ref)
    observationsMaille = vmObservationsMaillesRepository.getObservationsMaillesChilds(connection, cd_ref)

    configuration = base_configuration.copy()
    configuration.update({
        'LIMIT_FICHE_LISTE_HIERARCHY': config.LIMIT_FICHE_LISTE_HIERARCHY,
        'AFFICHAGE_ORGAS_OBS_FICHEESP': config.AFFICHAGE_ORGAS_OBS_FICHEESP,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION,
        'GLOSSAIRE': config.GLOSSAIRE,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,       
        'AFFICHAGE_SWITCHER': config.AFFICHAGE_SWITCHER,
        'AFFICHAGE_ATLAS_MAILLE_COMMUNALE': config.AFFICHAGE_ATLAS_MAILLE_COMMUNALE,
        'AFFICHAGE_ATLAS_MAILLE_CARREE': config.AFFICHAGE_ATLAS_MAILLE_CARREE,
        'AFFICHAGE_ATLAS_POINT': config.AFFICHAGE_ATLAS_POINT,
        'ZOOM_LEVEL_POINT': config.ZOOM_LEVEL_POINT,
        'LIMIT_CLUSTER_POINT': config.LIMIT_CLUSTER_POINT,
        'FICHE_ESPECE': True,
        'MAP': config.MAP
    })

    connection.close()
    session.close()

    return render_template(
        'templates/ficheEspece.html',
        taxon=taxon,
        listeTaxonsSearch=[],
        observations=[],
        cd_ref=cd_ref,
        statsorgataxon=statsorgataxon,
        months=months,
        synonyme=synonyme,
        communes=communes,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        observationsMaille=observationsMaille,
        taxonomyHierarchy=taxonomyHierarchy,
        firstPhoto=firstPhoto,
        photoCarousel=photoCarousel,
        videoAudio=videoAudio,
        articles=articles,
        taxonDescription=taxonDescription,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )