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>
This commit is contained in:
1 parent
722e845cff
commit
27771e7470
19 files changed
+480
-34
No files matched your search
@@ -119,6 +119,12 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
||||
'running' => __('Quiz läuft'),
|
||||
'finished' => __('Quiz beendet'),
|
||||
][$slide->quizPhase()]) ?></span>
|
||||
<?php elseif ($slide->usesPhases()) : ?>
|
||||
<span class="muted">· ⏱ <?= __('{0} s', (int)$slide->setting('time_limit')) ?> · <?= h([
|
||||
'ready' => __('noch nicht gestartet'),
|
||||
'running' => __('Countdown läuft'),
|
||||
'finished' => __('beendet'),
|
||||
][$slide->phase()]) ?></span>
|
||||
<?php elseif ($slide->isQa()) : ?>
|
||||
<span class="muted">· <?= h([
|
||||
'collect' => __('Fragen sammeln'),
|
||||
|
||||
@@ -43,6 +43,7 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
|
||||
<p class="stage__status" data-status></p>
|
||||
<h1 class="stage__question" data-question><?= __('Lade …') ?></h1>
|
||||
<div class="stage__description formatted" data-description></div>
|
||||
<div class="stage__timer" data-stage-timer></div>
|
||||
<div class="stage__media" data-media hidden></div>
|
||||
<figure class="stage__image" data-image hidden></figure>
|
||||
<div class="stage__results" data-results></div>
|
||||
|
||||
@@ -18,6 +18,7 @@ $this->assign('bodyClass', 'participant');
|
||||
$voteUrl = ['_name' => 'participate:vote', 'code' => $poll->join_code];
|
||||
$words = $state['words'] ?? null;
|
||||
$quiz = $state['quiz'] ?? null;
|
||||
$timer = $state['timer'] ?? null;
|
||||
$qa = $state['qa'] ?? null;
|
||||
$order = $state['order'] ?? null;
|
||||
$countdown = function (?int $remaining): string {
|
||||
@@ -100,6 +101,13 @@ $countdown = function (?int $remaining): string {
|
||||
<?php endif; ?>
|
||||
<?= $this->element('slide_image', compact('slide', 'poll')) ?>
|
||||
|
||||
<?php if ($timer !== null && $timer['phase'] === 'ready') : ?>
|
||||
<div class="waiting center">
|
||||
<div class="pulse" aria-hidden="true"></div>
|
||||
<p class="muted"><?= __('Die Abstimmung startet gleich. Die Antwortmöglichkeiten erscheinen, sobald es losgeht.') ?></p>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?= $timer !== null && $timer['phase'] === 'running' ? $countdown($timer['remaining']) : '' ?>
|
||||
<?php if ($quiz !== null) : ?>
|
||||
<?php if ($quiz['phase'] === 'ready') : ?>
|
||||
<div class="waiting center">
|
||||
@@ -336,6 +344,7 @@ $countdown = function (?int $remaining): string {
|
||||
<?= $this->Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<section class="card results-card" data-results-card <?= $state['results'] ? '' : 'hidden' ?>>
|
||||
|
||||
@@ -354,6 +354,8 @@ $optionsError = $slide->getError('options_text');
|
||||
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Ohne Upvotes entfällt Schritt 2. Du schaltest die Schritte selbst weiter.') ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->element('slide_time_limit', ['slide' => $slide]) ?>
|
||||
|
||||
<div class="form-actions">
|
||||
<?= $this->Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?>
|
||||
<a class="button button--ghost" data-modal-close href="<?= $this->Url->build(['_name' => 'admin', 'token' => $adminToken]) ?>"><?= __('Abbrechen') ?></a>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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>
|
||||
Reference in new issue
Block a user