schema: validate against new TFE field spec

- add exemplaire_baiu, exemplaire_erg, cc4r, remarks;
- add is_ulb to jury;
- split jury_lecteurs into interne/externe in view;
- refactor admin edit form with backoffice fields;
- update public fiche to show promoteur ULB and split lecteurs
This commit is contained in:
Pontoporeia
2026-05-07 17:30:34 +02:00
parent 7793b6f86d
commit dce0e0b301
18 changed files with 280 additions and 38 deletions

View File

@@ -112,10 +112,12 @@ class TfeController
'accessTypeId' => $accessTypeId,
'isInterdit' => $isInterdit,
'captionFiles' => $captionFiles,
'juryPresidents' => $juryByRole['presidents'],
'promoteursInternes' => $juryByRole['internes'],
'promoteursExternes' => $juryByRole['externes'],
'juryLecteurs' => $juryByRole['lecteurs'],
'juryPresidents' => $juryByRole['presidents'],
'promoteursInternes' => $juryByRole['internes'],
'promoteursExternes' => $juryByRole['externes'],
'promoteursUlb' => $juryByRole['ulb'],
'juryLecteursInternes' => $juryByRole['lecteurs_internes'],
'juryLecteursExternes' => $juryByRole['lecteurs_externes'],
// Restricted files access
'restrictedEnabled' => $restrictedEnabled,
@@ -199,14 +201,14 @@ class TfeController
}
/**
* Split jury members by role and internal/external flag.
* Split jury members by role and internal/external/ULB flags.
*
* @param array<int, array<string, mixed>> $jury
* @return array{presidents: list<string>, internes: list<string>, externes: list<string>, lecteurs: list<string>}
* @return array{presidents: list<string>, internes: list<string>, externes: list<string>, ulb: list<string>, lecteurs_internes: list<string>, lecteurs_externes: list<string>}
*/
private function splitJuryByRole(array $jury): array
{
$result = ['presidents' => [], 'internes' => [], 'externes' => [], 'lecteurs' => []];
$result = ['presidents' => [], 'internes' => [], 'externes' => [], 'ulb' => [], 'lecteurs_internes' => [], 'lecteurs_externes' => []];
foreach ($jury as $member) {
$name = $member['name'] ?? '';
@@ -219,14 +221,20 @@ class TfeController
$result['presidents'][] = $name;
break;
case 'promoteur':
if ((int)$member['is_external'] === 1) {
if ((int)($member['is_ulb'] ?? 0) === 1) {
$result['ulb'][] = $name;
} elseif ((int)$member['is_external'] === 1) {
$result['externes'][] = $name;
} else {
$result['internes'][] = $name;
}
break;
case 'lecteur':
$result['lecteurs'][] = $name;
if ((int)$member['is_external'] === 1) {
$result['lecteurs_externes'][] = $name;
} else {
$result['lecteurs_internes'][] = $name;
}
break;
}
}

View File

@@ -322,6 +322,7 @@ class ThesisCreateController
'name' => trim($post['jury_promoteur']),
'role' => 'promoteur',
'is_external' => isset($post['jury_promoteur_ext']) ? 1 : 0,
'is_ulb' => isset($post['jury_promoteur_ulb']) ? 1 : 0,
];
}
foreach ($post['jury_lecteurs'] ?? [] as $i => $name) {

View File

@@ -127,6 +127,7 @@ class ThesisEditController
'currentContextNote' => $currentContextNote,
'currentAuthorEmail' => $currentAuthorEmail,
'currentAuthorShowContact' => $currentAuthorShowContact,
'currentRaw' => $rawRow,
'pageTitle' => 'Éditer TFE - ' . htmlspecialchars($thesis['title']),
];
}
@@ -166,19 +167,24 @@ class ThesisEditController
try {
// ── 1. Thesis metadata ────────────────────────────────────────────
$this->db->updateThesis($thesisId, [
'title' => trim($post['titre'] ?? ''),
'subtitle' => trim($post['subtitle'] ?? ''),
'year' => intval($post['année'] ?? 0),
'orientation_id' => intval($post['orientation'] ?? 0),
'ap_program_id' => intval($post['ap'] ?? 0),
'finality_id' => intval($post['finality'] ?? 0),
'synopsis' => trim($post['synopsis'] ?? ''),
'context_note' => trim($post['context_note'] ?? ''),
'file_size_info' => trim($post['duration_info'] ?? ''),
'baiu_link' => trim($post['lien'] ?? ''),
'license_id' => filter_var($post['license_id'] ?? '', FILTER_VALIDATE_INT) ?: null,
'access_type_id' => filter_var($post['access_type_id'] ?? '', FILTER_VALIDATE_INT) ?: null,
'is_published' => isset($post['is_published']),
'title' => trim($post['titre'] ?? ''),
'subtitle' => trim($post['subtitle'] ?? ''),
'year' => intval($post['année'] ?? 0),
'orientation_id' => intval($post['orientation'] ?? 0),
'ap_program_id' => intval($post['ap'] ?? 0),
'finality_id' => intval($post['finality'] ?? 0),
'synopsis' => trim($post['synopsis'] ?? ''),
'context_note' => trim($post['context_note'] ?? ''),
'file_size_info' => trim($post['duration_info'] ?? ''),
'baiu_link' => trim($post['lien'] ?? ''),
'license_id' => filter_var($post['license_id'] ?? '', FILTER_VALIDATE_INT) ?: null,
'access_type_id' => filter_var($post['access_type_id'] ?? '', FILTER_VALIDATE_INT) ?: null,
'is_published' => isset($post['is_published']),
'remarks' => trim($post['remarks'] ?? ''),
'jury_points' => $post['jury_points'] ?? null,
'exemplaire_baiu' => !empty($post['exemplaire_baiu']),
'exemplaire_erg' => !empty($post['exemplaire_erg']),
'cc4r' => !empty($post['cc4r']),
]);
// ── 2. Authors (alphabetically sorted) ─────────────────────────────
@@ -552,6 +558,7 @@ class ThesisEditController
'name' => trim($post['jury_promoteur']),
'role' => 'promoteur',
'is_external' => isset($post['jury_promoteur_ext']) ? 1 : 0,
'is_ulb' => isset($post['jury_promoteur_ulb']) ? 1 : 0,
];
}

View File

@@ -1405,7 +1405,7 @@ class Database
public function getThesisJury(int $thesisId): array
{
$stmt = $this->pdo->prepare('
SELECT s.id, s.name, ts.role, ts.is_external, ts.supervisor_order
SELECT s.id, s.name, ts.role, ts.is_external, ts.is_ulb, ts.supervisor_order
FROM thesis_supervisors ts
JOIN supervisors s ON s.id = ts.supervisor_id
WHERE ts.thesis_id = ?
@@ -1428,8 +1428,8 @@ class Database
try {
$this->pdo->prepare('DELETE FROM thesis_supervisors WHERE thesis_id = ?')->execute([$thesisId]);
$stmt = $this->pdo->prepare('
INSERT INTO thesis_supervisors (thesis_id, supervisor_id, role, is_external, supervisor_order)
VALUES (?, ?, ?, ?, ?)
INSERT INTO thesis_supervisors (thesis_id, supervisor_id, role, is_external, is_ulb, supervisor_order)
VALUES (?, ?, ?, ?, ?, ?)
');
foreach ($juryMembers as $order => $member) {
$name = trim($member['name'] ?? '');
@@ -1440,7 +1440,8 @@ class Database
$role = in_array($member['role'], ['president', 'promoteur', 'lecteur'])
? $member['role'] : 'promoteur';
$isExternal = isset($member['is_external']) ? (int)$member['is_external'] : 0;
$stmt->execute([$thesisId, $supervisorId, $role, $isExternal, (int)$order + 1]);
$isUlb = isset($member['is_ulb']) ? (int)$member['is_ulb'] : 0;
$stmt->execute([$thesisId, $supervisorId, $role, $isExternal, $isUlb, (int)$order + 1]);
}
if (!$alreadyInTransaction) {
$this->pdo->commit();
@@ -1650,7 +1651,7 @@ class Database
public function getThesisRawFields(int $thesisId): ?array
{
$stmt = $this->pdo->prepare(
'SELECT license_id, access_type_id, context_note FROM theses WHERE id = ? LIMIT 1'
'SELECT license_id, access_type_id, context_note, remarks, jury_points, exemplaire_baiu, exemplaire_erg, cc4r FROM theses WHERE id = ? LIMIT 1'
);
$stmt->execute([$thesisId]);
$row = $stmt->fetch();
@@ -1784,6 +1785,11 @@ class Database
license_id = ?,
access_type_id = ?,
is_published = ?,
remarks = ?,
jury_points = ?,
exemplaire_baiu = ?,
exemplaire_erg = ?,
cc4r = ?,
updated_at = CURRENT_TIMESTAMP
WHERE id = ?
');
@@ -1801,6 +1807,11 @@ class Database
$data['license_id'] ?? null,
$data['access_type_id'] ?? null,
$data['is_published'] ? 1 : 0,
!empty($data['remarks']) ? $data['remarks'] : null,
isset($data['jury_points']) && $data['jury_points'] !== '' ? (float)$data['jury_points'] : null,
!empty($data['exemplaire_baiu']) ? 1 : 0,
!empty($data['exemplaire_erg']) ? 1 : 0,
!empty($data['cc4r']) ? 1 : 0,
$thesisId,
]);
}

View File

@@ -32,8 +32,10 @@ class StudentEmail
'Format(s)' => $thesis['formats'] ?? '',
'Mots-clés' => $thesis['keywords'] ?? '',
'Promoteur·ice(s)' => $thesis['jury_promoteurs'] ?? '',
'Promoteur·ice(s) ULB' => $thesis['jury_promoteurs_ulb'] ?? '',
'Président·e du jury' => $thesis['jury_president'] ?? '',
'Lecteurs·rices' => $thesis['jury_lecteurs'] ?? '',
'Lecteurs·rices (interne)' => $thesis['jury_lecteurs_internes'] ?? '',
'Lecteurs·rices (externe)' => $thesis['jury_lecteurs_externes'] ?? '',
'Durée / Taille' => $thesis['file_size_info'] ?? '',
'Lien' => $thesis['baiu_link'] ?? '',
'Type d\'accès' => $thesis['access_type'] ?? '',