How sucrero/asistencia works
1. What this repository is
- A monolithic PHP application for school attendance control (“asistencia”) identified by national ID/cédula.
- It is built as a classic server-rendered CRUD system rather than a SPA or API service.
2. Primary entry and page flow
- index.php and vistas/index.php act as the main application entry points.
- The vistas/ directory contains the user-facing screens for the main modules: attendance, personnel, schedules, holidays, permissions, users, and reports.
- menu/menu.php and shared layout fragments like vistas/pie.html provide common navigation and page chrome.
3. Core functional subsystems
- Asistencia: attendance registration and consultation.
- Personal: staff/person records.
- Horario / Horper: schedules and schedule-to-person assignment.
- Festivo: holidays/non-working days.
- Permiso / PermisoPer: permissions/leave requests and their assignment to people.
- Usuario: user accounts and access management.
- Operaciones.php likely acts as a controller/dispatcher for form actions and CRUD operations across these modules.
4. Domain model layer
- The clases/ folder contains the application’s business/domain objects.
- Each class maps closely to a business concept: Asistencia, Personal, Horario, Festivo, Permiso, Usuario, plus helper entities like Horper and PermisoPer.
- clases/JSON.php suggests the app also emits structured responses for some AJAX-driven interactions.
5. Database access boundary
- conexion/ is the persistence layer, with Postgres.php, DataAccess.php, DBMetodos.php, and conexion.php.
- The README confirms PostgreSQL as the database backend.
- bdd/bdd.sql is the schema/data seed file, which is the authoritative source for tables and likely stored structure used by the domain classes.
6. Data flow from UI to database
- User actions start in a vistas/*.php screen, often driven by JavaScript form handling.
- Requests are processed by PHP classes or Operaciones.php, which call the database layer in conexion/.
- Results are rendered back into the same view or returned as JSON for asynchronous updates.
7. Reporting and document generation
- The vistas/reporte_*.php files indicate separate report screens for each business area.
- PDF generation is a major subsystem: the repository includes FPDF plus custom extensions in clases/PDF_MC_Table.php, clases/PDF_Code128.php, and clases/cellpdf.php.
- This suggests reports can be exported/printed as structured PDFs, possibly with tables and barcodes.
8. Client-side interaction layer
- The js/ folder contains module-specific scripts like jsAsistencia.js, jsPersonal.js, jsHorario.js, jsPermiso.js, jsFestivo.js, and jsUsuario.js.
- These scripts likely handle validation, AJAX calls, dynamic table updates, and UI behavior.
- jQuery and Bootstrap 2.x are the main front-end dependencies.
9. Presentation and styling
- CSS assets in css/ and Bootstrap assets define the UI layout and responsive behavior.
- The app is designed for a traditional form-based interface, with modal/dialog interactions supported by Bootstrap scripts.
10. External/runtime assumptions
- The README states the system was built on Linux/Debian, using PHP 5.x, PostgreSQL 9.4, and tested in Chrome/Firefox.
- That places the application squarely in the LAMP-like era, with no evidence of modern framework abstractions.
11. What to highlight in an architecture diagram
- A central web UI layer (vistas/, menu/, JS/CSS).
- A PHP domain/controller layer (clases/, Operaciones.php).
- A database access layer (conexion/).
- A PostgreSQL data store (bdd/bdd.sql as schema source).
- A report/export layer built on FPDF.
- Cross-cutting static dependencies: Bootstrap, jQuery, and custom AJAX scripts.
12. Overall structure
- This is a single-codebase, tightly coupled CRUD application with separate screens per module, shared PHP classes for business logic, and direct database access.
- The main architectural boundaries are not microservices or APIs, but rather UI screens, domain classes, persistence helpers, and PDF/report generation.
Main entry points: Operaciones.php Operaciones · index.php App Entry · conexion.php DB Access · jsAsistencia.js UI Scripts
Components 28
Web UI
Server-rendered screens, shared chrome, and client-side interaction assets.
- Home · Main application entry point.
index.php - App Entry · Primary page bootstrap and navigation entry.
vistas/index.php - Menu · Shared navigation chrome.
menu/menu.php - Start Page · Landing/dashboard screen.
vistas/inicio.php - Asistencia · Attendance management view.
vistas/asistencia.php - Personal · Staff/person management view.
vistas/personal.php - Horario · Schedule management view.
vistas/horario.php - Permiso · Leave/permission management view.
vistas/permiso.php - Festivo · Holiday calendar view.
vistas/festivo.php - Usuario · User account management view.
vistas/usuario.php - UI Scripts · Module-specific AJAX, validation, and UI behavior.
js/jsAsistencia.js
Application Core
Central PHP controller and domain model for attendance and related entities.
- Operaciones · Central action dispatcher for CRUD operations.
Operaciones.php - Asistencia · Attendance domain object.
clases/Asistencia.php - Personal · Staff/person domain object.
clases/Personal.php - Horario · Schedule domain object.
clases/Horario.php - Permiso · Permission/leave domain object.
clases/Permiso.php - Usuario · User/account domain object.
clases/Usuario.php - JSON · Structured response helper for asynchronous interactions.
clases/JSON.php
Persistence
Database connection and access helpers.
- DB Access · Database connection and access layer.
conexion/conexion.php - DB Methods · Reusable database operations.
conexion/DBMetodos.php - Postgres · PostgreSQL-specific access wrapper.
conexion/Postgres.php - Schema · SQL schema and seed source.
bdd/bdd.sql
Reports & PDF
PDF generation and report screens.
- General Report · Consolidated reporting view.
vistas/repgeneral.php - Asis Report · Attendance report screen.
vistas/repgralasis.php - Pers Report · Personnel report screen.
vistas/reporte_pers.php - Permiso Report · Permission report screen.
vistas/reporte_permiso.php - PDF Extras · Custom PDF table and barcode helpers.
clases/PDF_MC_Table.php
Vendored Libraries
Bundled third-party frontend and PDF dependencies.
- FPDF · Bundled PDF generation engine.
fpdf/fpdf.php
Connections 36
- Home → App Entry: boots · Initial request enters the main app flow.
- App Entry → Menu: includes · Shared navigation is loaded into pages.
- App Entry → Start Page: routes to · Loads the start screen after bootstrap.
- App Entry → Asistencia: routes to · Main navigation opens attendance screens.
- App Entry → Personal: routes to · Main navigation opens personnel screens.
- App Entry → Horario: routes to · Main navigation opens schedule screens.
- App Entry → Permiso: routes to · Main navigation opens permission screens.
- App Entry → Festivo: routes to · Main navigation opens holiday screens.
- App Entry → Usuario: routes to · Main navigation opens user screens.
- Asistencia → UI Scripts: uses · Client-side behavior and AJAX hooks.
- Personal → UI Scripts: uses · Client-side behavior and AJAX hooks.
- Horario → UI Scripts: uses · Client-side behavior and AJAX hooks.
- Permiso → UI Scripts: uses · Client-side behavior and AJAX hooks.
- Operaciones → Asistencia: coordinates · Dispatches attendance operations.
- Operaciones → Personal: coordinates · Dispatches personnel operations.
- Operaciones → Horario: coordinates · Dispatches schedule operations.
- Operaciones → Permiso: coordinates · Dispatches permission operations.
- Operaciones → Usuario: coordinates · Dispatches account operations.
- Asistencia → DB Access: reads/writes · Persists attendance records.
- Personal → DB Access: reads/writes · Persists staff records.
- Horario → DB Access: reads/writes · Persists schedules and assignments.
- Permiso → DB Access: reads/writes · Persists permission requests.
- Usuario → DB Access: reads/writes · Persists user accounts.
- DB Access → DB Methods: uses · Common database helpers.
- DB Access → Postgres: adapts · PostgreSQL-specific connection behavior.
- DB Methods → Schema: targets · Operates on the seeded schema.
- General Report → FPDF: renders with · Report output is built as PDF.
- Pers Report → FPDF: renders with · Report output is built as PDF.
- Permiso Report → FPDF: renders with · Report output is built as PDF.
- PDF Extras → FPDF: extends · Custom table and barcode rendering.
- Asistencia → Operaciones: submits to · Forms post actions into the dispatcher.
- Personal → Operaciones: submits to · Forms post actions into the dispatcher.
- Horario → Operaciones: submits to · Forms post actions into the dispatcher.
- Permiso → Operaciones: submits to · Forms post actions into the dispatcher.
- Usuario → Operaciones: submits to · Forms post actions into the dispatcher.
- Operaciones → JSON: returns · Some interactions return structured JSON.