Add bead separator support to Rosary Builder

- Bead Markers section in library panel with Small, Large, Crucifix cards
- Bead steps render as amber-tinted cards in the sequence (no attribution)
- migrate_v5.php: adds step_type/bead_type columns, makes prayer_id nullable
- Bead steps produce slides with proper bead+bead_index so the ring advances
  during presentation — allows participants to follow along on physical beads
- Prayer steps between beads still show bead_index=null (ring stays on last bead)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 21:20:59 -07:00
parent 3c11fd2067
commit 3cc002a6da
6 changed files with 299 additions and 38 deletions
+21 -4
View File
@@ -15,9 +15,10 @@ require_once __DIR__ . '/../data/prayers.php';
*/
function get_builder_steps(PDO $pdo, int $session_id): array {
$st = $pdo->prepare("
SELECT bs.attribution, cp.name, cp.leader_text, cp.all_text
SELECT bs.step_type, bs.bead_type, bs.attribution,
cp.name, cp.leader_text, cp.all_text
FROM builder_steps bs
JOIN custom_prayers cp ON cp.id = bs.prayer_id
LEFT JOIN custom_prayers cp ON cp.id = bs.prayer_id
WHERE bs.session_id = ?
ORDER BY bs.step_order ASC
");
@@ -104,8 +105,25 @@ function build_slides(array $session): array {
'photo_path' => $session['photo_path'] ?? null,
];
$bead_idx = 0; // increments for each bead separator step
foreach ($steps as $i => $step) {
$attr = $step['attribution'];
$type = $step['step_type'] ?? 'prayer';
if ($type === 'bead') {
$slides[] = [
'id' => 'bead_' . $i,
'type' => 'prayer',
'section' => 'bead',
'title' => '',
'leader' => '',
'all' => '',
'bead' => $step['bead_type'] ?? 'small',
'bead_index' => $bead_idx++,
];
continue;
}
$attr = $step['attribution'] ?? 'leader_all';
$leader = '';
$all = '';
@@ -116,7 +134,6 @@ function build_slides(array $session): array {
$all = $step['all_text'] ?? '';
}
if ($attr === 'none') {
// Show prayer text without attribution labels — put in leader field
$leader = ($step['leader_text'] ?: $step['all_text']) ?? '';
}