How heir2050/ged works
1. System shape
- This is a PHP monolith built around a custom MVC framework.
- The browser hits public/index.php, and Apache rewrite rules in public/.htaccess route requests into the app.
- The application code lives in app/, while uploaded documents live on disk under public/uploads/.
2. Framework layer
- The core runtime is in app/core/: App.php handles routing, Controller.php and Model.php define the base abstractions, and Database.php is the persistence layer.
- config.php, init.php, and helper files provide bootstrapping, shared configuration, and utility functions.
- This means the architecture is controller-driven, with direct model access rather than a separate service layer.
3. Primary UI flow
- Each request follows the classic flow: router → controller → model → view.
- Views are server-rendered PHP templates in app/views/, with shared layout pieces such as head, header, sidebar, and footer.
- The app is presentation-heavy and page-oriented, not API-first.
4. Authentication and user administration
- Identity-related controllers include Login, Signup, Logout, Profile, Users, and Admin.
- Models such as User, Session, and Profile back the authentication/session state and account management.
- The Admin area is the administrative boundary for creating, editing, and deleting users and services.
5. Service-based access model
- The README states that users belong to services, and each user can see the activity of their service.
- This implies a multi-tenant-like partitioning by service, with access and visibility scoped by organizational unit rather than purely by individual ownership.
- The presence of Employe, Employes, Dossiers, and Folders suggests the service/dossier structure is central to authorization and navigation.
6. Document management core
- The heart of the repo is document handling: controllers such as Document, Folder, Upload, DocumentAssignment, DocumentOg, Details, and Historique.
- Models such as Documents, Folders, Uploads, DocumentAssignments, and ConsultationDocument support metadata, storage location, assignment, and viewing history.
- Views like documents.view.php, folders.view.php, upload.view.php, documentassignments.view.php, and details.view.php correspond to the main user journeys.
7. File storage boundary
- Actual files are stored under public/uploads/ in many subfolders, including documents/, conges/, attachments/, and several dossier-like directories.
- This is an important architectural boundary: the database stores metadata and relationships, while the filesystem stores the binary documents.
- The README requirement that uploaded documents should not be deleted when a user is removed indicates the file store is treated as a shared organizational archive, not user-owned ephemeral data.
8. Upload workflow
- The system supports multi-file uploads, and the README says each new file should go into its own folder.
- Upload and Uploads/Uploads copy are the main upload handlers, likely coordinating folder creation, filename generation, and database record creation.
- The directory structure in public/uploads/documents/<dossier>/... shows uploads are organized by dossier/service context.
9. Document consultation tracking
- A key domain requirement is tracking who has opened a file and who has not.
- That behavior is reflected by ConsultationDocument and DocumentAssignments, plus history-related controllers/views.
- In architecture terms, every document view/open action likely writes a consultation/audit record, which later feeds the “opened by” lists shown per service.
10. Leave management side module
- There is a separate “congés” workflow with Conges, DetailConges, and related models Conge, CongeAttachment, and DetailConge.
- Its files are stored separately under public/uploads/conges/, showing it is a distinct business module, not just a document subtype.
- This module likely has its own list/detail pages and attachment handling, but shares the same core MVC and database patterns.
11. Notifications and activity history
- Notifications and Historique provide cross-cutting feedback and auditability.
- These subsystems are important for the service visibility model: they help surface who uploaded, viewed, assigned, or changed documents.
- The Notification copy files suggest iterative development, but the canonical boundary is the notification feed plus activity log.
12. Database and schema
- The repo includes bd.sql and sql.sql, indicating a relational database schema is part of the project delivery.
- The schema likely captures users, services, documents, folders/dossiers, consultations, notifications, and leave requests.
- For an architecture diagram, the database should be shown as the authoritative store for all metadata and audit state.
13. Static assets and generated UI
- public/assets/ contains app-specific styling and scripts, while public/build/ looks like a prebuilt admin UI/template bundle.
- These assets support the server-rendered pages but do not appear to be the main application logic.
- They matter mainly as the presentation layer around the MVC pages.
14. Repo hygiene note
- There are many files named copy, which suggests older iterations or duplicated variants of controllers, models, and views.
- For architecture purposes, the important thing is the canonical set: Document, Upload, Notifications, Conges, Users, and the matching models/views.
- The copies are noise rather than separate subsystems.
15. What the diagram should emphasize
- Show a single PHP web app with three major domain zones: identity/admin, document management, and congés/attachments.
- Put the database and filesystem uploads as separate backends, with metadata in SQL and binaries on disk.
- Highlight the service-scoped visibility and consultation tracking as the project’s distinctive architectural feature.
Main entry points: views Server views · Document.php Documents · sql.sql SQL schema · Conges.php Congés
Components 18
Entry & Presentation
Web entrypoint, server-rendered views, and static frontend assets.
- Front controller · Main web entry that receives requests before routing into the app.
public/index.php - Rewrite rules · Apache rewrite boundary that forwards browser requests to the front controller.
public/.htaccess - Server views · Rendered page templates and shared layout partials.
app/views - UI assets · Application styling, scripts, and bundled UI resources.
public/assets
Framework Core
Custom MVC runtime, bootstrap, and shared infrastructure.
- Router · Dispatches incoming requests to controllers.
app/core/App.php - Base controller · Shared controller abstraction for request handling and view rendering.
app/core/Controller.php - Base model · Shared model abstraction used by application models.
app/core/Model.php - Database layer · Low-level database access used by models.
app/core/Database.php - Bootstrap · Application configuration and startup helpers.
app/core/init.php
Domain Modules
Identity, document, notification, and leave-management boundaries.
- Identity · Login, signup, logout, profile, and user administration boundaries.
app/controllers/Login.php - User admin · User and administrative management area.
app/controllers/Users.php - Documents · Main document browsing, metadata, and consultation workflow.
app/controllers/Document.php - Upload flow · Multi-file upload handling and dossier-based file creation.
app/controllers/Upload.php - Folders · Folder and dossier organization for document grouping.
app/controllers/Folder.php - Tracking · Consultation history, document assignments, and notifications.
app/controllers/Historique.php - Congés · Leave requests and related attachments.
app/controllers/Conges.php
Storage Backends
Relational schema and filesystem-backed uploads.
- SQL schema · Authoritative metadata and audit store for users, services, documents, and leave records.
sql.sql - Uploads store · Shared filesystem archive for documents, attachments, and congés files.
public/uploads
Connections 21
- Rewrite rules → Front controller: rewrites to · Apache forwards requests into the PHP front controller.
- Front controller → Bootstrap: boots · Front controller loads shared configuration and startup logic.
- Bootstrap → Router: initializes · Bootstrap prepares the router/runtime.
- Router → Base controller: dispatches · Router invokes controller actions.
- Base controller → Server views: renders · Controllers select server-side templates.
- Base controller → Base model: uses · Controllers coordinate model access through the base abstraction.
- Base model → Database layer: queries · Models persist and read data through the database layer.
- Identity → User admin: delegates · Identity flows lead into account administration.
- User admin → SQL schema: stores metadata · User and service state is persisted in the relational schema.
- Documents → Folders: organizes by · Documents are grouped through dossiers and folders.
- Documents → Tracking: records views · Opening documents feeds consultation and history tracking.
- Upload flow → Uploads store: writes files · Uploaded binaries are stored on disk in dossier-specific folders.
- Upload flow → SQL schema: records uploads · Upload metadata and relationships are written to the database.
- Documents → Uploads store: reads files · Document views resolve stored binaries from the filesystem archive.
- Tracking → SQL schema: audits · Consultations, assignments, and notifications are stored as metadata.
- Congés → Uploads store: stores attachments · Congés attachments are kept in a separate upload subtree.
- Congés → SQL schema: persists requests · Leave requests and their details are stored in the database.
- Identity → Server views: renders pages · Login, signup, and profile screens are server-rendered pages.
- Documents → Server views: renders pages · Document management pages are served from PHP templates.
- Congés → Server views: renders pages · Congés views are part of the server-rendered UI.
- UI assets → Server views: supports UI · Static assets back the rendered templates and layouts.