# nguyenquynhtrang180206/elo_quiz architecture

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

- Interactive diagram: https://gitdiagram.com/nguyenquynhtrang180206/elo_quiz
- Repository: https://github.com/nguyenquynhtrang180206/elo_quiz

## Overview

Đấu Trường Tri Thức is a PHP/MySQL 1-vs-1 quiz arena with student and administrator areas. Students find a match, enter a live room, play a quiz, and receive an Elo update; they can also use rankings and learning-community features. Administrators manage questions, users, matches, settings, surveys, and reports. The graph emphasizes documented and indexed runtime relationships. Some admin and survey pages are represented by their exact directories because their individual implementations were not sampled.

Main entry points: [`admin`](https://github.com/nguyenquynhtrang180206/elo_quiz/tree/main/admin) (Admin management), [`core/ThiDau.php`](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/ThiDau.php) (Live quiz match), [`client/index.php`](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/index.php) (Student dashboard), [`core/bootstrap.php`](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/bootstrap.php) (Request bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry and shared services"]
  node_front["Application entry<br/>[index.php]"]
  node_bootstrap["Request bootstrap<br/>[bootstrap.php]"]
  node_auth["Authentication<br/>[Auth.php]"]
  node_database[("PDO database<br/>[Database.php]")]
  node_config["Game configuration<br/>[Config.php]"]
end

subgraph group_competition["Match and ranking"]
  node_matchmaking["Matchmaking<br/>[GhepDoi.php]"]
  node_matchroom["Match search and room<br/>[timtran.php]"]
  node_gameplay["Live quiz match<br/>[ThiDau.php]"]
  node_room["Match room UI<br/>[phong.php]"]
  node_elo["Elo rating<br/>[Elo.php]"]
  node_champions["Match modifiers<br/>[LoLChampions.php]"]
end

subgraph group_student["Student features"]
  node_studenthome["Student dashboard<br/>[index.php]"]
  node_rankings["Subject rankings<br/>[bxh.php]"]
  node_community["Learning community<br/>[CongDongHelper.php]"]
  node_communitypages["Community pages<br/>[congdong.php]"]
  node_friends["Friends<br/>[BanBeHelper.php]"]
  node_notifications["Notifications<br/>[ThongBaoHelper.php]"]
end

subgraph group_admin["Administration"]
  node_adminpages["Admin management"]
  node_questions["Question bank<br/>[cauhoi.php]"]
  node_questiontools["Question import<br/>[NhapCauHoi.php]"]
  node_questionhelper["Question operations<br/>[CauHoiHelper.php]"]
  node_audit["Admin audit log<br/>[NhatKy.php]"]
  node_pagination["Pagination<br/>[Paginator.php]"]
  node_spreadsheet["Spreadsheet export<br/>[XlsxWriter.php]"]
  node_surveys["Surveys and analytics"]
end

node_visitor(("Student"))
node_administrator(("Administrator"))

node_visitor -->|"opens site"| node_front
node_administrator -.->|"manages"| node_adminpages
node_front -->|"loads"| node_bootstrap
node_bootstrap -->|"loads"| node_database
node_bootstrap -->|"loads"| node_auth
node_bootstrap -->|"loads"| node_config
node_database -->|"reads connection"| node_config
node_matchroom -->|"uses"| node_matchmaking
node_matchroom -.->|"uses"| node_gameplay
node_room -->|"uses"| node_gameplay
node_room -->|"uses"| node_matchmaking
node_room -->|"loads modifiers"| node_champions
node_gameplay -->|"updates rating"| node_elo
node_gameplay -->|"uses pairing"| node_matchmaking
node_gameplay -->|"uses modifiers"| node_champions
node_elo -->|"reads modifier"| node_champions
node_studenthome -->|"uses"| node_matchmaking
node_studenthome -->|"uses"| node_community
node_studenthome -->|"reads ratings"| node_elo
node_rankings -->|"reads ratings"| node_elo
node_communitypages -->|"uses"| node_community
node_communitypages -->|"uses"| node_notifications
node_studenthome -.->|"loads"| node_notifications
node_questions -->|"uses"| node_questionhelper
node_questions -->|"uses"| node_pagination
node_questions -->|"records actions"| node_audit
node_questiontools -->|"uses"| node_questionhelper
node_adminpages -->|"requires admin"| node_auth
node_adminpages -.->|"queries data"| node_database
node_adminpages -.->|"manages and reports"| node_surveys
node_adminpages -.->|"records actions"| node_audit
node_adminpages -->|"exports data"| node_spreadsheet
node_adminpages -->|"paginates lists"| node_pagination
node_community -->|"creates alerts"| node_notifications
node_friends -->|"uses"| node_notifications

click node_front "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/index.php"
click node_bootstrap "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/bootstrap.php"
click node_auth "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Auth.php"
click node_database "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Database.php"
click node_config "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Config.php"
click node_matchmaking "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/GhepDoi.php"
click node_matchroom "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/timtran.php"
click node_gameplay "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/ThiDau.php"
click node_room "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/phong.php"
click node_elo "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Elo.php"
click node_champions "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/LoLChampions.php"
click node_studenthome "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/index.php"
click node_rankings "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/bxh.php"
click node_community "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/CongDongHelper.php"
click node_communitypages "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/congdong.php"
click node_friends "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/BanBeHelper.php"
click node_notifications "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/ThongBaoHelper.php"
click node_adminpages "https://github.com/nguyenquynhtrang180206/elo_quiz/tree/main/admin"
click node_questions "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/admin/cauhoi.php"
click node_questiontools "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/NhapCauHoi.php"
click node_questionhelper "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/CauHoiHelper.php"
click node_audit "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/NhatKy.php"
click node_pagination "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Paginator.php"
click node_spreadsheet "https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/XlsxWriter.php"
click node_surveys "https://github.com/nguyenquynhtrang180206/elo_quiz/tree/main/admin"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_front,node_bootstrap,node_auth,node_database,node_config toneBlue
class node_matchmaking,node_matchroom,node_gameplay,node_room,node_elo,node_champions toneAmber
class node_studenthome,node_rankings,node_community,node_communitypages,node_friends,node_notifications toneMint
class node_adminpages,node_questions,node_questiontools,node_questionhelper,node_audit,node_pagination,node_spreadsheet,node_surveys toneRose
class node_visitor,node_administrator toneIndigo
```

## Components

### Web entry and shared services

- [Application entry](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/index.php): `index.php`
- [Request bootstrap](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/bootstrap.php): `core/bootstrap.php`
- [Authentication](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Auth.php): `core/Auth.php`
- [PDO database](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Database.php): `core/Database.php`
- [Game configuration](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Config.php): `core/Config.php`

### Match and ranking

- [Matchmaking](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/GhepDoi.php): `core/GhepDoi.php`
- [Match search and room](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/timtran.php): `client/timtran.php`
- [Live quiz match](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/ThiDau.php): `core/ThiDau.php`
- [Match room UI](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/phong.php): `client/phong.php`
- [Elo rating](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Elo.php): `core/Elo.php`
- [Match modifiers](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/LoLChampions.php): `core/LoLChampions.php`

### Student features

- [Student dashboard](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/index.php): `client/index.php`
- [Subject rankings](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/bxh.php): `client/bxh.php`
- [Learning community](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/CongDongHelper.php): `core/CongDongHelper.php`
- [Community pages](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/client/congdong.php): `client/congdong.php`
- [Friends](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/BanBeHelper.php): `core/BanBeHelper.php`
- [Notifications](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/ThongBaoHelper.php): `core/ThongBaoHelper.php`

### Administration

- [Admin management](https://github.com/nguyenquynhtrang180206/elo_quiz/tree/main/admin): `admin`
- [Question bank](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/admin/cauhoi.php): `admin/cauhoi.php`
- [Question import](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/NhapCauHoi.php): `core/NhapCauHoi.php`
- [Question operations](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/CauHoiHelper.php): `core/CauHoiHelper.php`
- [Admin audit log](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/NhatKy.php): `core/NhatKy.php`
- [Pagination](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/Paginator.php): `core/Paginator.php`
- [Spreadsheet export](https://github.com/nguyenquynhtrang180206/elo_quiz/blob/main/core/XlsxWriter.php): `core/XlsxWriter.php`
- [Surveys and analytics](https://github.com/nguyenquynhtrang180206/elo_quiz/tree/main/admin): `admin`

### Other components

- **Student**
- **Administrator**

## Connections

- Student → Application entry: opens site (evidence: `index.php`)
- Administrator → Admin management: manages
- Application entry → Request bootstrap: loads (evidence: `index.php`)
- Request bootstrap → PDO database: loads (evidence: `core/bootstrap.php`)
- Request bootstrap → Authentication: loads (evidence: `core/bootstrap.php`)
- Request bootstrap → Game configuration: loads (evidence: `core/bootstrap.php`)
- PDO database → Game configuration: reads connection (evidence: `core/Database.php`)
- Match search and room → Matchmaking: uses (evidence: `client/timtran.php`)
- Match search and room → Live quiz match: uses
- Match room UI → Live quiz match: uses (evidence: `client/phong.php`)
- Match room UI → Matchmaking: uses (evidence: `client/phong.php`)
- Match room UI → Match modifiers: loads modifiers (evidence: `client/phong.php`)
- Live quiz match → Elo rating: updates rating (evidence: `core/ThiDau.php`)
- Live quiz match → Matchmaking: uses pairing (evidence: `core/ThiDau.php`)
- Live quiz match → Match modifiers: uses modifiers (evidence: `core/ThiDau.php`)
- Elo rating → Match modifiers: reads modifier (evidence: `core/Elo.php`)
- Student dashboard → Matchmaking: uses (evidence: `client/index.php`)
- Student dashboard → Learning community: uses (evidence: `client/index.php`)
- Student dashboard → Elo rating: reads ratings (evidence: `client/index.php`)
- Subject rankings → Elo rating: reads ratings (evidence: `client/bxh.php`)
- Community pages → Learning community: uses (evidence: `client/congdong.php`)
- Community pages → Notifications: uses (evidence: `client/congdong.php`)
- Student dashboard → Notifications: loads
- Question bank → Question operations: uses (evidence: `admin/cauhoi.php`)
- Question bank → Pagination: uses (evidence: `admin/cauhoi.php`)
- Question bank → Admin audit log: records actions (evidence: `admin/cauhoi.php`)
- Question import → Question operations: uses (evidence: `core/NhapCauHoi.php`)
- Admin management → Authentication: requires admin (evidence: `admin/layout/header.php`)
- Admin management → PDO database: queries data (evidence: `admin/index.php`)
- Admin management → Surveys and analytics: manages and reports
- Admin management → Admin audit log: records actions (evidence: `admin/cauhoi.php`)
- Admin management → Spreadsheet export: exports data (evidence: `admin/Nhatky_xuat.php`)
- Admin management → Pagination: paginates lists (evidence: `admin/nhatky.php`)
- Learning community → Notifications: creates alerts (evidence: `core/CongDongHelper.php`)
- Friends → Notifications: uses (evidence: `core/BanBeHelper.php`)
