# asobrados03/tweb-notificador-avisos architecture

> Architecture diagram of the GitHub repository asobrados03/tweb-notificador-avisos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/asobrados03/tweb-notificador-avisos
- Repository: https://github.com/asobrados03/tweb-notificador-avisos

## Overview

##### Project type and purpose
- This is a full-stack LAMP web application (“Notificador de Avisos”) written in PHP, intended for professors to notify students via web-based messages (avisos). It supports user management (login, password reset), student registration, publishing individual/collective notices, CSV import of bulk notices, and tracking read/unread status.

##### File structure
Top-level:
- conexionBD/ – database connection helper (conexion_BD.php)
- public_html/ – the web root containing all public-facing PHP scripts, static assets and include modules:
– .htaccess (rewrite/protection rules)
– index.php, login/registration/reset/password scripts, aviso-related scripts (publicar-aviso, ver-aviso, importar-aviso, aviso-CSV)
– css/ (estilo.css, images), js/ (comportamientoLadoCliente.js)
– inc/ (template and function includes: initialization, functions library, navigation bar, footer, filter logic)
- uploads/ – storage of uploaded CSV files
Other indicators: procedural PHP with include-based templating, a single Apache/PHP monolith, and MySQL interaction via conexionBD.

##### README for additional insights
- No external services (e.g., mail services) are used; CSV validation is handled server-side.

a. Main components:
- Client (Browser on desktop/mobile)
- Web Server (Apache with mod_php)
- PHP Application Layer
– Entry-point scripts (index.php, procesar-*.php, importar-aviso.php)
– Include modules (inc/*.php) for business logic, templating, navigation
– Database access layer (conexionBD/conexion_BD.php)
- Database (MySQL/MariaDB)
- File Storage (uploads/ for CSV files; static assets under public_html/css, public_html/js)
b. Relationships and interactions:
– Browser → Web Server: HTTP requests for pages and form submissions
– Web Server → PHP Application: executes PHP scripts
– PHP Application ↔ Database: CRUD operations on USUARIO, ESTUDIANTE, AVISO, DIRIGIR_A_ESTUDIANTE
– PHP Application → File Storage: read/write CSV files on import, serve CSS/JS/images
– Browser ← PHP Application: dynamic HTML, CSS, JS responses
c. Architectural patterns and principles:
– Layered architecture: Presentation (HTML/CSS/JS + templates), Application Logic (PHP functions and processing scripts), Data Access (conexionBD to MySQL), Data Storage (DB + filesystem)
– Reusable include modules for templating and common functions
– Separation of concerns: distinct scripts for each use case (login, register student, publish notice, import file, filter/list notices)
d. Key technologies/frameworks:
– Apache HTTP Server, PHP 7+
– MySQL/MariaDB
– HTML5/CSS3 (responsive design), JavaScript (client-side interactivity)
– CSV processing (delimiter validation, error reporting)

##### Essential elements
- Clear component labels (e.g., “public_html/index.php”, “conexionBD/conexion_BD.php”, “MySQL DB”)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    Browser["Client Browser\n(HTML5/CSS3/JS)"]:::presentation
    Apache["Apache HTTP Server\n(mod_php)"]:::presentation

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        subgraph "Routing & Entry Points"
            direction TB
            index["index.php"]  
            procesar_login["procesar-login.php"]
            procesar_registro_estudiante["procesar-registro-estudiante.php"]
            procesar_registro_aviso["procesar-registro-aviso.php"]
            procesar_restablecer["procesar-restablecer-contrasenia.php"]
            registrar_estudiante["registrar-estudiante.php"]
            publicar_aviso["publicar-aviso.php"]
            importar_aviso["importar-aviso.php"]
            aviso_csv["aviso-csv.php"]
            ver_aviso["ver-aviso.php"]
            indice_avisos["indice-avisos.php"]
            menu_estudiante["menu-estudiante.php"]
            menu_profesor["menu-profesor.php"]
            cerrar_sesion["cerrar-sesion.php"]
            leer_aviso_importado["leer-aviso-importado.php"]
            htaccess[".htaccess"]
        end

        subgraph "Business Logic & Common Functions"
            direction TB
            codigo_inicializacion["inc/codigo_inicializacion.php"]
            codigo_funciones["inc/codigo_funciones.php"]
            filtrar_avisos["inc/filtrar-avisos.php"]
        end

        subgraph "Templating & Layout Includes"
            direction TB
            plantilla["inc/plantilla.php"]
            barra_nav["inc/barra-navegadora.php"]
            codigo_finalizacion["inc/codigo_finalizacion.php"]
        end

        data_access["conexionBD/conexion_BD.php"]:::dataAccess
    end

    %% Storage Layer
    subgraph "Storage"
        direction TB
        DB["MySQL / MariaDB"]:::storage
        uploads["uploads/"]:::storage
        css_folder["public_html/css/"]:::storage
        js_folder["public_html/js/"]:::storage
        images_folder["public_html/css/images/"]:::storage
    end

    %% Connections
    Browser -->|HTTP GET/POST| Apache
    Apache -->|exec PHP scripts| index
    Apache --> procesar_login
    Apache --> procesar_registro_estudiante
    Apache --> procesar_registro_aviso
    Apache --> procesar_restablecer
    Apache --> registrar_estudiante
    Apache --> publicar_aviso
    Apache --> importar_aviso
    Apache --> aviso_csv
    Apache --> ver_aviso
    Apache --> indice_avisos
    Apache --> menu_estudiante
    Apache --> menu_profesor
    Apache --> cerrar_sesion
    Apache --> leer_aviso_importado
    Apache --> htaccess

    %% Static asset serving
    Apache --> css_folder
    Apache --> js_folder
    Apache --> images_folder

    %% Internal calls
    index --> codigo_inicializacion
    index --> plantilla
    index --> barra_nav
    index --> codigo_finalizacion

    procesar_* --> codigo_inicializacion
    procesar_* --> codigo_funciones
    procesar_* --> filtrar_avisos
    procesar_* --> data_access

    registrar_estudiante --> data_access
    publicar_aviso --> data_access
    importar_aviso --> codigo_funciones
    importar_aviso --> uploads
    aviso_csv --> uploads
    leer_aviso_importado --> uploads

    plantilla --> barra_nav
    plantilla --> codigo_finalizacion

    codigo_funciones --> data_access
    filtrar_avisos --> data_access

    data_access --> DB
    DB --> data_access

    %% Responses
    index -->|HTML/CSS/JS| Apache
    procesar_* -->|redirect/render| Apache
    Apache -->|HTTP Response| Browser

    %% Click Events
    click data_access "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/conexionBD/conexion_BD.php"
    click index "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/index.php"
    click procesar_login "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/procesar-login.php"
    click procesar_registro_estudiante "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/procesar-registro-estudiante.php"
    click procesar_registro_aviso "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/procesar-registro-aviso.php"
    click procesar_restablecer "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/procesar-restablecer-contrasenia.php"
    click registrar_estudiante "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/registrar-estudiante.php"
    click publicar_aviso "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/publicar-aviso.php"
    click importar_aviso "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/importar-aviso.php"
    click aviso_csv "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/aviso-csv.php"
    click ver_aviso "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/ver-aviso.php"
    click indice_avisos "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/indice-avisos.php"
    click menu_estudiante "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/menu-estudiante.php"
    click menu_profesor "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/menu-profesor.php"
    click cerrar_sesion "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/cerrar-sesion.php"
    click leer_aviso_importado "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/leer-aviso-importado.php"
    click htaccess "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/.htaccess"
    click codigo_inicializacion "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/inc/codigo_inicializacion.php"
    click codigo_funciones "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/inc/codigo_funciones.php"
    click filtrar_avisos "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/inc/filtrar-avisos.php"
    click plantilla "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/inc/plantilla.php"
    click barra_nav "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/inc/barra-navegadora.php"
    click codigo_finalizacion "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/inc/codigo_finalizacion.php"
    click uploads "https://github.com/asobrados03/tweb-notificador-avisos/tree/master/uploads/"
    click css_folder "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/css/estilo.css"
    click images_folder "https://github.com/asobrados03/tweb-notificador-avisos/tree/master/public_html/css/images/"
    click js_folder "https://github.com/asobrados03/tweb-notificador-avisos/blob/master/public_html/js/comportamientoLadoCliente.js"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#333,stroke-width:1px;
    classDef appLogic fill:#d4edda,stroke:#333,stroke-width:1px;
    classDef dataAccess fill:#fff3cd,stroke:#333,stroke-width:1px;
    classDef storage fill:#f8d7da,stroke:#333,stroke-width:1px;

    class Browser,Apache presentation;
    class index,procesar_login,procesar_registro_estudiante,procesar_registro_aviso,procesar_restablecer,registrar_estudiante,publicar_aviso,importar_aviso,aviso_csv,ver_aviso,indice_avisos,menu_estudiante,menu_profesor,cerrar_sesion,leer_aviso_importado,htaccess appLogic;
    class codigo_inicializacion,codigo_funciones,filtrar_avisos,plantilla,barra_nav,codigo_finalizacion appLogic;
    class data_access dataAccess;
    class DB,uploads,css_folder,js_folder,images_folder storage;
```
