# ILO Student Exports and Application Letters

## Added functions

### Filtered ILO register
The Industrial Liaison Office placement register now supports filtering by:

- Student name, admission number, placement number, organization or attachment area
- Placement status
- Class
- Course
- Organization
- Attachment start-date range

The register shows up to 300 matching records on screen.

### CSV and Excel exports
Authorized System Administrators, Administrators and ILO Officers can export the filtered register as:

- UTF-8 CSV
- Microsoft Excel `.xlsx` when PHP ZipArchive is available
- Excel-compatible XML fallback when the Zip extension is unavailable

The export contains placement, student, organization, period, supervisor, logbook, weekly-entry, supervision, assessment, clearance and application-letter information. CSV cells are protected against spreadsheet-formula injection.

### Industrial attachment application letter
Each placement can generate an official industrial attachment application letter with:

- Institutional letterhead
- Unique letter reference
- Student admission number, course, department and class
- Target organization and attachment area
- Requested or approved attachment dates
- Employer acceptance section
- ILO signature and official stamp area
- Print / Save PDF support through the browser

The letter remains separate from uploaded employer acceptance documents. Letter issuance and views are recorded in the ILO audit trail.

## Database migration

Run migration:

`database/migrations/20260726_018_ilo_exports_application_letters.sql`

This creates `ilo_application_letters`.

## Staging validation

```bat
C:\xampp\php\php.exe bin\migrate.php
C:\xampp\php\php.exe bin\check_ilo_exports_letters.php
C:\xampp\php\php.exe bin\check_class_rep_ilo.php
C:\xampp\php\php.exe bin\check_integrity.php
C:\xampp\php\php.exe bin\xampp_check.php
```

Test CSV and Excel downloads with several filters, and verify that students can access only their own application letters while lecturers can access only assigned placements.
