Files
Plenario/templates/element/slide_time_limit.php
T
gnilebeinandClaude Sonnet 5.5 27771e7470
CI / Deploy / PHP 8.4 (push) Successful in 1m18s
CI / Deploy / PHP 8.5 (push) Successful in 1m29s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped
Add an optional countdown to every slide that collects answers
Choice, word cloud, open question, scale and ordering slides get a time
limit like the quiz. With a limit the slide waits ("ready") showing only
the question; next starts the countdown, the next one ends it, the third
moves on. Stage results and the ordering solution are withheld until the
countdown has started. The countdown music plays during any countdown.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 12:18:33 +01:00

33 lines
1.3 KiB
PHP

<?php
/**
* Countdown of a slide (not for quizzes, which have their own field, nor Q&A): without a limit the slide is
* open as soon as it is live; with one it first shows only the question, the next step starts the countdown.
*
* @var \App\View\AppView $this
* @var \App\Model\Entity\Slide $slide
*/
use App\Model\Entity\Slide;
if ($slide->isQuiz() || !Slide::supportsTimer($slide->type)) {
return;
}
$limits = [];
foreach (Slide::TIME_LIMITS as $seconds) {
$limits[$seconds] = match (true) {
$seconds === 0 => __('Kein Countdown'),
$seconds < 60 => __('{0} Sekunden', $seconds),
$seconds % 60 === 0 => __n('{0} Minute', '{0} Minuten', intdiv($seconds, 60), intdiv($seconds, 60)),
default => __('{0} Minuten', number_format($seconds / 60, 1, ',', '')),
};
}
?>
<?= $this->Form->control('settings.time_limit', [
'type' => 'select',
'options' => $limits,
'label' => __('Countdown'),
'value' => $slide->getSettings()['time_limit'],
'aria-describedby' => 'time-limit-hint',
]) ?>
<p class="hint" id="time-limit-hint"><?= __('Mit Countdown zeigt die Präsentation zuerst nur die Frage. „Weiter“ startet den Countdown und die Abstimmung, am Ende (oder mit „Weiter“) wird geschlossen und das Ergebnis gezeigt. Ohne Countdown ist die Folie sofort offen.') ?></p>