How joe0919/mesa-de-partes works
Project Type and Purpose
• This is a full-stack PHP web application (“Mesa-de-Partes Virtual”) built on an MVC pattern.
• Its core functionality is to receive virtual document submissions via forms, allow administrative review, routing/derivation to organizational areas, and reporting.
• Technologies: PHP, MySQL, HTML/CSS/JS/AJAX, Composer-managed libraries (PHPMailer, FPDF).
File-Structure Analysis
• Top-level MVC directories:
• controller/ – business logic & request handlers
• models/ – data-access layer (e.g., Usuario.php)
• view/ – presentation templates (organized by feature)
• config/ – database connection scripts (conexion.php variants)
• public/ – publicly served assets: CSS, JS, images, third-party plugins
• files/ – runtime storage for uploaded docs & images
• reporte/ – server-side report generation scripts (PHP + fonts + images)
• vendor/ & composer.json/lock – external dependencies (PHPMailer, FPDF)
• bd_mesapartes – MySQL database schema name
• Entry points at top level (index.html, index.php) and per-module index.php files (Acceso, Servicios, Seguimiento, etc.)
Key Components
a. Client/Browser (UI layer)
• Renders HTML views, CSS styles, and executes JS/AJAX calls.
b. Web Server & PHP Runtime
• Receives HTTP(S) requests, routes to front-controller or module index.php.
• Loads Composer autoloader, config, controllers.
c. MVC Layers
• Controller Layer: controller/*.php – receives AJAX or form submissions, invokes models, returns JSON or renders views.
• Model Layer: models/*.php – encapsulates MySQL queries via config/conexion.php.
• View Layer: view/** – PHP/HTML templates assembled with data, served to client.
d. Database (MySQL)
• Stores users, empleados, areas, documentos, historial, etc.
e. File Storage
• files/docs – PDF uploads
• files/images – document previews or user avatars
f. External Services/Libraries
• PHPMailer – email notifications for password recovery, notifications
• FPDF – PDF generation for reporting
g. Reporting Module
• reporte/ – PHP scripts producing area/document/employee/user reports, using custom fonts and images
Component Interactions
• Client Browser → HTTP Request → Web Server (Apache/Nginx + PHP)
• Web Server → Front-Controller/Module Entry → Appropriate Controller
• Controller ↔ Model → MySQL Database
• Controller → FPDF / PHPMailer (external libs)
• Controller → View → HTML Output → Browser
• Browser → AJAX → Controller (for dynamic operations)
• Static Assets (CSS/JS/plugins) served directly from public/assets → Browser
Architectural Patterns & Design Principles
• MVC Separation of Concerns: clear boundaries between data, business logic, and presentation.
• Layered Architecture: presentation (views+assets), application logic (controllers), data access (models, config).
• Asynchronous Updates: AJAX calls for real-time operations (e.g., submitting trámites, retrieving historial).
• Modular Features: each functional area (Usuarios, Tramites, Seguimiento) lives in its own view/controller pair.
• Reusable Services: email (PHPMailer), PDF generation (FPDF), DataTables, Select2 plugins for UI consistency.