# srblx/projet-qcm architecture

> Architecture diagram of the GitHub repository srblx/projet-qcm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srblx/projet-qcm
- Repository: https://github.com/srblx/projet-qcm

## Overview

##### Main Components

A. Frontend Layer:
- User Interface (2_User)
- Admin Interface (1_Admin)
- Shared Components (Content)

B. Backend Layer:
- Controllers (MVC)
- Models (Database interactions)
- Views (PHP templates)

C. Database Layer:
- SQL Database (indicated by .sql files)

**[Client Layer]**
- ↓ ↑
**[Application Layer]**
- ↓ ↑
**[Data Layer]**

##### Detailed Component Breakdown

Client Layer:
- Public Interface (login, signup, home)
- User Interface (quiz, leaderboard, profile)
- Admin Interface (CRUD operations, user management)
- JavaScript components (emailJS, navigation, question handling)
- CSS styling modules

Application Layer:
- Controller Components:
- Base Controller
- Specialized Controllers (home, choice, contact, etc.)
- Model Layer:
- Data access logic
- Business logic
- View Components:
- Template rendering
- Response formatting

Data Layer:
- SQL Database
- Database schema (from qcm.sql)

##### Additional Elements

- External services (EmailJS)
- Shared utilities (header.php, footer.php)
- Static content (CSS, images, JavaScript)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#a8d1ff,stroke:#000
    classDef backend fill:#ffb3b3,stroke:#000
    classDef database fill:#c2f0c2,stroke:#000
    classDef shared fill:#ffe6cc,stroke:#000
    classDef auth fill:#e6e6ff,stroke:#000

    %% Client Layer
    subgraph ClientLayer["Client Interfaces"]
        PublicUI["Public Interface"]:::frontend
        AdminUI["Admin Interface"]:::frontend
        UserUI["User Interface"]:::frontend
    end

    %% Authentication Layer
    subgraph AuthLayer["Authentication"]
        Auth["Authentication Controller"]:::auth
        LoginView["Login View"]:::auth
        SignupView["Signup View"]:::auth
    end

    %% Admin Section
    subgraph AdminSection["Admin Components"]
        AdminControllers["Admin Controllers"]:::backend
        AdminViews["Admin Views"]:::frontend
        AdminCRUD["CRUD Operations"]:::backend
        AdminProfile["Profile Management"]:::backend
        AdminLeaderboard["Leaderboard"]:::backend
    end

    %% User Section
    subgraph UserSection["User Components"]
        UserControllers["User Controllers"]:::backend
        UserViews["User Views"]:::frontend
        QuizSystem["Quiz System"]:::backend
        UserProfile["Profile Management"]:::backend
        UserLeaderboard["Leaderboard"]:::backend
    end

    %% Shared Components
    subgraph SharedComponents["Shared Components"]
        BaseController["Base Controller"]:::shared
        BaseModel["Base Model"]:::shared
        EmailJS["Email Integration"]:::shared
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        Database[(Database)]:::database
        StaticResources["Static Resources"]:::shared
    end

    %% Relationships
    PublicUI --> Auth
    Auth --> LoginView
    Auth --> SignupView
    Auth --> Database

    AdminUI --> AdminControllers
    AdminControllers --> AdminViews
    AdminControllers --> AdminCRUD
    AdminControllers --> AdminProfile
    AdminControllers --> AdminLeaderboard
    AdminControllers --> Database

    UserUI --> UserControllers
    UserControllers --> UserViews
    UserControllers --> QuizSystem
    UserControllers --> UserProfile
    UserControllers --> UserLeaderboard
    UserControllers --> Database

    BaseController --> AdminControllers
    BaseController --> UserControllers
    BaseModel --> Database

    EmailJS --> Auth
    StaticResources --> PublicUI
    StaticResources --> AdminUI
    StaticResources --> UserUI

    %% Click Events
    click PublicUI "https://github.com/Srblx/Projet-QCM/tree/master//"
    click Auth "https://github.com/Srblx/Projet-QCM/blob/master//Controllers/Controller_login_signup.php"
    click LoginView "https://github.com/Srblx/Projet-QCM/blob/master//Views/view_login.php"
    click SignupView "https://github.com/Srblx/Projet-QCM/blob/master//Views/view_signup.php"
    click AdminUI "https://github.com/Srblx/Projet-QCM/tree/master//1_Admin/"
    click AdminControllers "https://github.com/Srblx/Projet-QCM/tree/master//1_Admin/Controllers/"
    click AdminViews "https://github.com/Srblx/Projet-QCM/tree/master//1_Admin/Views/"
    click AdminCRUD "https://github.com/Srblx/Projet-QCM/blob/master//1_Admin/Controllers/Controller_crud.php"
    click UserUI "https://github.com/Srblx/Projet-QCM/tree/master//2_User/"
    click UserControllers "https://github.com/Srblx/Projet-QCM/tree/master//2_User/Controllers/"
    click UserViews "https://github.com/Srblx/Projet-QCM/tree/master//2_User/Views/"
    click QuizSystem "https://github.com/Srblx/Projet-QCM/blob/master//2_User/Controllers/Controller_question_correction.php"
    click AdminLeaderboard "https://github.com/Srblx/Projet-QCM/blob/master//1_Admin/Controllers/Controller_leaderboard.php"
    click UserLeaderboard "https://github.com/Srblx/Projet-QCM/blob/master//2_User/Controllers/Controller_leaderboard.php"
    click AdminProfile "https://github.com/Srblx/Projet-QCM/blob/master//1_Admin/Controllers/Controller_profile.php"
    click UserProfile "https://github.com/Srblx/Projet-QCM/blob/master//2_User/Controllers/Controller_profile.php"
    click EmailJS "https://github.com/Srblx/Projet-QCM/blob/master//Content/js/emailJS.js"
    click BaseController "https://github.com/Srblx/Projet-QCM/blob/master//Controllers/Controller.php"
    click BaseModel "https://github.com/Srblx/Projet-QCM/blob/master//Models/Model.php"
    click Database "https://github.com/Srblx/Projet-QCM/blob/master//Content/db/qcm.sql"
    click StaticResources "https://github.com/Srblx/Projet-QCM/tree/master//Content/"
```
