# Digital Learning Academy with Ravindu Nidushan — LMS (Customized)

## What was changed for you

1. **Rebranded** — "Bd/Passara Tamil Maha Vidyalaya" replaced with
   **"Digital Learning Academy with Ravindu Nidushan"** across the whole system (46 files).

2. **New QR Attendance System** (new feature):
   - `generate_id_cards.php` — Admin page. Filter by Grade (6–11) / Class
     (Econ Center, Sadhana, Commerce Center) and generate printable student
     ID cards. Each card shows the student's **name, grade/class, and a QR
     code**. Click "Print All Cards" to print on card stock.
   - `scan_attendance.php` — Admin page with two tabs:
     - **Camera Scan** — uses the device/laptop camera to read the QR
       (works on phone or laptop with a webcam).
     - **Scanner Device** — for a handheld/USB QR scanner (keyboard-wedge
       type). Just click the input box and scan — it submits automatically.
     Both give instant on-screen name/grade/class confirmation + a beep.
   - `attendance_scan_process.php` — backend that validates the QR
     (signed, so a fake/guessed code will be rejected) and marks today's
     attendance. Prevents duplicate marking for the same day.
   - `attendance_report.php` — Admin page to view Present/Absent counts by
     date, grade, and class.
   - New `attendance` table (added by the reset script below).
   - New nav links added to the Admin sidebar (Student ID Cards, QR
     Attendance Scan, Attendance Report).

3. **Restricted to your institute's structure:**
   - Student Grade dropdown limited to **6–11** (Manage Students, Timetable).
   - Class dropdown limited to **Econ Center / Sadhana / Commerce Center**
     (Manage Students, Timetable).
   - Timetable subject defaults to **ICT**, and **Saturday** was added as a
     day (in addition to Mon–Fri) since tuition classes often run weekends.
   - Subjects list reset to just **ICT** (see reset script).

4. **Bilingual English / Sinhala:**
   - The **Login page (index.php)** language toggle now switches between
     **English and Sinhala** (previously it was English/Tamil — all the
     Tamil UI text on this page has been replaced with Sinhala).
   - All **new pages** (ID Cards, QR Scan, Attendance Report) are fully
     bilingual EN/SI with a toggle button.
   - ⚠️ **Important scope note:** the rest of the original system (Lessons,
     Quizzes, Assignments, Activity Creator, Teacher/Student/Parent
     dashboards, etc. — about 40 files) still has its *old* English/Tamil
     toggle and Tamil text, since it was originally built for a Tamil-medium
     school. Fully translating every string in those files to Sinhala is a
     large separate job (600+ phrases) that needs careful, correct
     translation — I did not want to auto-translate that content and risk
     wrong/garbled Sinhala showing to your students. Let me know if you'd
     like me to continue that conversion page-by-page.

## Setup — IMPORTANT, do this first

1. Upload/replace the `new_lms` folder on your server (XAMPP/hosting).
2. Open **phpMyAdmin**, select the `ict_academy_lms` database.
3. Import **`reset_and_seed.sql`** (provided separately). This will:
   - **Delete ALL existing data** (students, teachers, users, timetable,
     lessons, quizzes, assignments, everything) — a full fresh start.
   - Create the new **Admin** login:
     - Username: `admin@rnlms.edu.lk`
     - Password: `Admin@1234`
   - Add the **ICT** subject and the new `attendance` table.
4. Go to `index.php`, log in as Admin, and start adding your teachers and
   students (Grade 6–11, Class: Econ Center / Sadhana / Commerce Center).
5. Go to **Student ID Cards** → filter → **Print All Cards** to print IDs
   for your students.
6. Use **QR Attendance Scan** every day to mark attendance by camera or a
   handheld scanner.

## Security note
The QR code on each card is cryptographically signed (HMAC) using a secret
key in `config/database.php` (`ATT_SECRET`). **Please change that value to
your own random string** before going live, so nobody can forge a QR code
by guessing admission numbers.
