admin/index.php: add server-side pagination (25/page)

- Add Database::getThesesListCount(array $filters) — runs the same WHERE
  clauses as getThesesList() but with COUNT(DISTINCT t.id); used to compute
  total pages without loading all rows.
- Extend Database::getThesesList() with $limit/$offset parameters; when
  $limit > 0 appends LIMIT/OFFSET and re-binds positional params individually
  to avoid the PDO mixed-style restriction.
- Fix getThesesList() SELECT: add LEFT JOIN access_types + at.name as
  access_type — the column was referenced in the template but never fetched.
- Wire admin/index.php: read ?page=, compute $totalPages/$offset, pass
  $perPage=25 + $offset to getThesesList(); include pagination.php partial
  below the table with filter-preserving $baseParams.
- Add result-count line (<p class="admin-list-meta">) showing "X–Y sur Z TFE"
  when multiple pages exist.
- Add .admin-body .pagination-wrap / .pagination-btn / .pagination-info styles
  to admin.css (scoped to .admin-body to avoid colliding with public pages).
This commit is contained in:
Pontoporeia
2026-04-03 12:29:09 +02:00
parent ff8e33727d
commit 234d7bae40
6 changed files with 183 additions and 25 deletions

View File

@@ -4,15 +4,15 @@
- [ ] **`admin.css`**: Replace `.admin-main` with `.admin-body main`
- [ ] **`admin.css`**: Replace `.admin-page-title` with `.admin-body main > h1`
- [ ] **`admin.css`**: Replace `.admin-alert` / `.admin-alert--error` / `.admin-alert--success` with `[role="alert"]` / `data-type="error|success"` attribute
- [x] **`admin.css`**: Replace `.admin-alert` / `.admin-alert--error` / `.admin-alert--success` with `[role="alert"]` / `data-type="error|success"` attribute
- [ ] **`admin.css`**: Replace `.admin-form-row` with `.admin-body form > div` or CSS grid on `<form>` children
- [ ] **`admin.css`**: Replace `.admin-label` with `.admin-body form label`
- [ ] **`admin.css`**: Replace `.admin-input` / `.admin-select` / `.admin-textarea` with native element selectors
- [ ] **`admin.css`**: Replace `.admin-hint` with `.admin-body form small`
- [x] **`admin.css`**: Replace `.admin-hint` with `.admin-body form small`
- [ ] **`admin.css`**: Replace `.admin-table` with `.admin-body table`
- [ ] **`admin.css`**: Replace `.admin-fieldset` / `.admin-fieldset-legend` with `.admin-body fieldset` / `.admin-body legend`
- [ ] **`main.css`**: Replace `.card__caption` with `.home-body .cards-container li p` or `li > a > p`
- [ ] **`main.css`**: Replace `.card__media` with `.home-body figure`
- [x] **`main.css`**: Replace `.card__caption` with `.home-body .cards-container li p` or `li > a > p`
- [x] **`main.css`**: Replace `.card__media` with `.home-body figure`
- [ ] **`tfe.css`**: Replace `.tfe-meta-list` selectors with `article dl`, `article dt`, `article dd`
- [ ] **`tfe.css`**: Replace `.tfe-media-block` with `aside figure`
- [ ] **`tfe.css`**: Replace `.tfe-file-caption` with `aside figcaption`
@@ -22,10 +22,10 @@
## Template HTML changes to match
- [ ] In all admin templates, replace `<p class="admin-hint">` with `<small>` elements
- [ ] In `tfe.php`, remove `class="tfe-meta-list"` — target via `article dl`
- [ ] In `tfe.php`, remove `class="tfe-media-block"` — target via `aside figure`
- [ ] In `tfe.php`, remove `class="tfe-file-caption"` — target via `aside figcaption`
- [ ] In `index.php`, remove `class="card__caption"` — target via `li > a > p`
- [x] In `tfe.php`, remove `class="tfe-meta-list"` — target via `article dl`
- [x] In `tfe.php`, remove `class="tfe-media-block"` — target via `aside figure`
- [x] In `tfe.php`, remove `class="tfe-file-caption"` — target via `aside figcaption`
- [x] In `index.php`, remove `class="card__caption"` — target via `li > a > p`
## Scattered inline styles in templates
@@ -43,7 +43,7 @@
- [x] **`index.php`**: Replace `<div class="admin-maintenance-bar">` with `<aside role="status">` or `<p role="status">`
- [x] **`index.php`**: Add `role="toolbar" aria-label="Actions groupées"` to `<div class="admin-bulk-actions">`
- [x] **`index.php`**: Add `scope="col"` to all `<th>` cells in the admin table
- [ ] **`index.php`**: Add non-colour indicator + `aria-label="Statut : …"` to status badge `<span>` elements
- [x] **`index.php`**: Add non-colour indicator + `aria-label="Statut : …"` to status badge `<span>` elements (via `status-badge.php` partial)
- [x] **`tags.php`**: Add `scope="col"` to `<th>` cells
- [x] **`tags.php`**: Move inline `style="margin-top:.35rem;"` on forms → `.admin-inline-form + .admin-inline-form` selector
- [x] **`thanks.php`**: Replace `<div class="admin-thesis-info">` with `<section>` + `<h2>` heading; CSS targets `main > section`

View File

@@ -10,7 +10,7 @@
## Shared UI partials — `templates/partials/`
- [ ] **`pagination.php`** — pagination nav is duplicated between `index.php` and `search.php`; unify into one partial accepting `$page`, `$totalPages`, `$baseParams[]`
- [x] **`pagination.php`** — partial created and used in both `search.php` and (now) `admin/index.php`; `admin/index.php` also gained proper server-side pagination (25/page) with filter-aware `$baseParams`
- [ ] **`status-badge.php`** — published/pending badge + access badge pattern repeated in `index.php` admin table rows; extract into a partial
- [ ] **`admin-alert.php`** — rename/merge `flash-messages.php` to also handle the 3 different legacy flash key patterns (`$_SESSION['error']`, `$_SESSION['admin_error']`, `$_SESSION['edit_error']`, etc.) that pages still consume manually instead of via `App::consumeFlash()`