From 9bc8e30f18694a838142594d767b4cce574ec2e9 Mon Sep 17 00:00:00 2001
From: Ron Lucke <lucke@elan-ev.de>
Date: Thu, 4 Aug 2022 09:47:14 +0000
Subject: [PATCH] BIEST #723

Merge request studip/studip!853
---
 .../Courseware/BlockTypes/BlockType.php       | 15 ++++++-
 .../Courseware/BlockTypes/DialogCards.php     |  2 +
 lib/models/Courseware/StructuralElement.php   | 39 +++++++++++--------
 .../CoursewareStructuralElement.vue           |  1 +
 templates/courseware/block_types/audio.php    |  9 +++++
 .../courseware/block_types/before_after.php   | 10 +++++
 templates/courseware/block_types/canvas.php   | 13 +++++++
 templates/courseware/block_types/chart.php    |  7 ++++
 templates/courseware/block_types/code.php     |  1 -
 templates/courseware/block_types/confirm.php  |  1 -
 templates/courseware/block_types/date.php     |  1 -
 templates/courseware/block_types/default.php  | 13 ++++++-
 .../courseware/block_types/dialog_cards.php   | 18 +++++++++
 templates/courseware/block_types/document.php |  9 +++++
 templates/courseware/block_types/download.php | 12 ++++++
 templates/courseware/block_types/embed.php    | 14 ++++---
 templates/courseware/block_types/folder.php   |  9 +++++
 templates/courseware/block_types/gallery.php  |  7 ++++
 templates/courseware/block_types/headline.php |  5 +--
 templates/courseware/block_types/iframe.php   |  7 ++++
 .../courseware/block_types/image_map.php      | 20 ++++++++++
 .../courseware/block_types/key_point.php      |  1 -
 templates/courseware/block_types/link.php     | 10 +++--
 .../block_types/table_of_contents.php         |  0
 templates/courseware/block_types/text.php     |  5 ++-
 .../courseware/block_types/typewriter.php     |  3 +-
 templates/courseware/block_types/video.php    |  9 +++++
 .../container_types/accordion_container.php   |  3 --
 .../container_types/list_container.php        |  3 --
 .../container_types/tabs_container.php        |  7 +---
 30 files changed, 204 insertions(+), 50 deletions(-)
 create mode 100644 templates/courseware/block_types/audio.php
 create mode 100644 templates/courseware/block_types/before_after.php
 create mode 100644 templates/courseware/block_types/canvas.php
 create mode 100644 templates/courseware/block_types/chart.php
 create mode 100644 templates/courseware/block_types/dialog_cards.php
 create mode 100644 templates/courseware/block_types/document.php
 create mode 100644 templates/courseware/block_types/download.php
 create mode 100644 templates/courseware/block_types/folder.php
 create mode 100644 templates/courseware/block_types/gallery.php
 create mode 100644 templates/courseware/block_types/iframe.php
 create mode 100644 templates/courseware/block_types/image_map.php
 create mode 100644 templates/courseware/block_types/table_of_contents.php
 create mode 100644 templates/courseware/block_types/video.php

diff --git a/lib/models/Courseware/BlockTypes/BlockType.php b/lib/models/Courseware/BlockTypes/BlockType.php
index bee1df7d450..64cd5cc7bf8 100644
--- a/lib/models/Courseware/BlockTypes/BlockType.php
+++ b/lib/models/Courseware/BlockTypes/BlockType.php
@@ -292,6 +292,18 @@ abstract class BlockType
         }
     }
 
+    protected function getFileRefById(string $fileId)
+    {
+        $file_ref = \FileRef::find($fileId);
+        $user = \User::findCurrent();
+
+        if ($file_ref && $file_ref->getFileType()->isDownloadable($user->id)) {
+            return $file_ref;
+        } else {
+            return null;
+        }
+    }
+
     /**
      * Copies a file to a specified range.
      *
@@ -419,7 +431,8 @@ abstract class BlockType
             }
             $template->set_attributes([
                 'title' => $this->getTitle(),
-                'payload' => $this->getPayload()
+                'payload' => $this->getPayload(),
+                'files' => $this->getFiles()
             ]);
         } catch (\Exception $e) {
             // it catches the exception mostly because the template file could not be found.
diff --git a/lib/models/Courseware/BlockTypes/DialogCards.php b/lib/models/Courseware/BlockTypes/DialogCards.php
index 7d3c8ba0735..e7c82f8d6c2 100644
--- a/lib/models/Courseware/BlockTypes/DialogCards.php
+++ b/lib/models/Courseware/BlockTypes/DialogCards.php
@@ -43,11 +43,13 @@ class DialogCards extends BlockType
         foreach ($payload['cards'] as &$card) {
             if ($card['front_file_id']) {
                 $card['front_file'] = $this->getFileById($card['front_file_id']);
+                $card['front_file_ref'] = $this->getFileRefById($card['front_file_id']);
             } else {
                 $card['front_file'] = [];
             }
             if ($card['back_file_id']) {
                 $card['back_file'] = $this->getFileById($card['back_file_id']);
+                $card['back_file_ref'] = $this->getFileRefById($card['back_file_id']);
             } else {
                 $card['back_file'] = [];
             }
diff --git a/lib/models/Courseware/StructuralElement.php b/lib/models/Courseware/StructuralElement.php
index 7a127dbe18e..f518cc16005 100644
--- a/lib/models/Courseware/StructuralElement.php
+++ b/lib/models/Courseware/StructuralElement.php
@@ -830,45 +830,52 @@ SQL;
             $doc->setHeaderTitle(sprintf(_('Courseware von %s'), $this->user->getFullname()));
         }
 
-        $doc->addPage();
-
         if (!self::canRead($user)) {
+            $doc->addPage();
             $doc->addContent(_('Diese Seite steht Ihnen nicht zur Verfügung!'));
 
             return $doc;
         }
 
-        $doc->writeHTML($this->getElementPdfExport('', $with_children, $user));
+        $this->getElementPdfExport(0, $with_children, $user, $doc);
+
+        if ($with_children) {
+            $doc->addTOCPage();
+            $doc->SetFont('helvetica', 'B', 16);
+            $doc->MultiCell(0, 0, _('Inhaltsverzeichnis'), 0, 'C', 0, 1, '', '', true, 0);
+            $doc->Ln();
+            $doc->SetFont('helvetica', '', 12);
+            $doc->addTOC(1, 'helvetica', '.', _('Inhaltsverzeichnis'), 'B', array(0,0,0));
+            $doc->endTOCPage();
+        }
+
 
         return $doc;
     }
 
-    private function getElementPdfExport(string $parent_name, bool $with_children, $user)
+    private function getElementPdfExport(int $depth, bool $with_children, $user, $doc)
     {
         if (!$this->canRead($user)) {
             return '';
         }
-        if ($parent_name !== '') {
-            $parent_name .= ' / ';
-        }
-        $html = '<h1>' . $parent_name . $this->title . '</h1>';
+        $doc->addPage();
+        $doc->Bookmark(htmlReady($this->title), $depth, 0, '', '', array(128,0,0));
+        $html = "<h1>" . htmlReady($this->title) . "</h1>";
         $html .= $this->getContainerPdfExport();
+        $doc->writeHTML($html);
+
         if ($with_children) {
-            $html .= $this->getChildrenPdfExport($parent_name, $with_children, $user);
+            $this->getChildrenPdfExport($depth, $with_children, $user, $doc);
         }
-
-        return $html;
     }
 
-    private function getChildrenPdfExport(string $parent_name, bool $with_children, $user)
+    private function getChildrenPdfExport(int $depth, bool $with_children, $user, $doc)
     {
         $children = self::findBySQL('parent_id = ?', [$this->id]);
-        $html = '';
+        $depth++;
         foreach ($children as $child) {
-            $html .= $child->getElementPdfExport($parent_name . $this->title, $with_children, $user);
+            $child->getElementPdfExport($depth, $with_children, $user, $doc);
         }
-
-        return $html;
     }
 
     private function getContainerPdfExport()
diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue
index 8888c41046c..80db300045c 100644
--- a/resources/vue/components/courseware/CoursewareStructuralElement.vue
+++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue
@@ -681,6 +681,7 @@ export default {
             exportChildren: false,
             oerExportRunning: false,
             oerChildren: true,
+            pdfExportChildren: false,
             containerList: [],
             isDragging: false,
             dragOptions: {
diff --git a/templates/courseware/block_types/audio.php b/templates/courseware/block_types/audio.php
new file mode 100644
index 00000000000..b779dee95fa
--- /dev/null
+++ b/templates/courseware/block_types/audio.php
@@ -0,0 +1,9 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Audio') . ': ' ?></p>
+    <? foreach ($files as $file): ?>
+        <? if ($file === null) { continue; } ?>
+        <p>
+            <a href="<?= htmlReady($file->getDownloadURL()); ?>"><?= htmlReady($file->name); ?></a>
+        </p>
+    <? endforeach; ?>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/before_after.php b/templates/courseware/block_types/before_after.php
new file mode 100644
index 00000000000..4bdc1452068
--- /dev/null
+++ b/templates/courseware/block_types/before_after.php
@@ -0,0 +1,10 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Bildvergleich') . ': ' ?></p>
+    <? foreach ($files as $file): ?>
+        <? if ($file === null) { continue; } ?>
+        <p>
+            <img src="<?= htmlReady($file->getDownloadURL()); ?>">
+            <span style="font-style:italic"><?= htmlReady($file->name); ?></span>
+        </p>
+    <? endforeach; ?>
+</div>
diff --git a/templates/courseware/block_types/canvas.php b/templates/courseware/block_types/canvas.php
new file mode 100644
index 00000000000..a8e0b6ffb68
--- /dev/null
+++ b/templates/courseware/block_types/canvas.php
@@ -0,0 +1,13 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Leinwand') . ': ' ?></p>
+    <? if ($files[0]): ?>
+        <p>
+            <img src="<?= htmlReady($files[0]->getDownloadURL()); ?>">
+            <span style="font-style:italic"><?= htmlReady($files[0]->name); ?></span>
+        </p>
+    <? else: ?>
+        <p>
+        <span style="font-style:italic"><?= _('ohne Hintergrundbild'); ?></span>
+        </p>
+    <? endif; ?>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/chart.php b/templates/courseware/block_types/chart.php
new file mode 100644
index 00000000000..732aecaf1f6
--- /dev/null
+++ b/templates/courseware/block_types/chart.php
@@ -0,0 +1,7 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Diagramm') . ': ' ?></p>
+    <p><?= htmlReady($payload['label']) ?></p>
+    <? foreach ($payload['content'] as $val): ?>
+        <p><?= htmlReady($val['label']) . ' => ' . htmlReady($val['value']); ?></p>
+    <? endforeach; ?>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/code.php b/templates/courseware/block_types/code.php
index 0c369e2f318..456ccdf3d8f 100644
--- a/templates/courseware/block_types/code.php
+++ b/templates/courseware/block_types/code.php
@@ -1,2 +1 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
 <pre><?= htmlReady($payload['content']) ?></pre>
diff --git a/templates/courseware/block_types/confirm.php b/templates/courseware/block_types/confirm.php
index 714e8e8e6f2..df2267c09ef 100644
--- a/templates/courseware/block_types/confirm.php
+++ b/templates/courseware/block_types/confirm.php
@@ -1,2 +1 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
 <p><?= htmlReady($payload['text']) ?></p>
diff --git a/templates/courseware/block_types/date.php b/templates/courseware/block_types/date.php
index 2f748049af5..f892764d1c8 100644
--- a/templates/courseware/block_types/date.php
+++ b/templates/courseware/block_types/date.php
@@ -1,2 +1 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
 <p><?=  date('d.m.Y h:i', (int) $payload['timestamp'] / 1000) ?></p>
diff --git a/templates/courseware/block_types/default.php b/templates/courseware/block_types/default.php
index 6e09444e998..c0dc9004b1d 100644
--- a/templates/courseware/block_types/default.php
+++ b/templates/courseware/block_types/default.php
@@ -1,8 +1,17 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
-<h6><?= _('Block-Daten') ?>:</h6>
+<h5 style="font-size: 14px;"><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
+<h6 style="font-size: 12px;"><?= _('Block-Daten') ?>:</h6>
 <? foreach ($payload as $key => $value): ?>
     <? $value = is_bool($value) ? ($value ? 'true' : 'false') : $value; ?>
     <? if (!empty($value)): ?>
         <h6><?= htmlReady(str_replace('_', ' ', strtocamelcase($key, true)) . ' => ' . $value) ?></h6>
     <? endif; ?>
 <? endforeach; ?>
+<? if($files): ?>
+    <h6 style="font-size: 12px;"><?= _('Block-Dateien') ?>:</h6>
+    <? foreach ($files as $file): ?>
+        <? if ($file === null) { continue; } ?>
+        <p>
+            <a href="<?= htmlReady($file->getDownloadURL()); ?>"><?= htmlReady($file->name); ?></a>
+        </p>
+    <? endforeach; ?>
+<? endif; ?>
\ No newline at end of file
diff --git a/templates/courseware/block_types/dialog_cards.php b/templates/courseware/block_types/dialog_cards.php
new file mode 100644
index 00000000000..6fff3efe796
--- /dev/null
+++ b/templates/courseware/block_types/dialog_cards.php
@@ -0,0 +1,18 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Lernkarten') . ': ' ?></p>
+    <? foreach ($payload['cards'] as $card): ?>
+        <p style="font-weight: bold;"><?= _('Karte') . ' ' . htmlReady($card['index']) .': ' ?></p>
+        <p>
+            <? if ($card['front_file_ref']): ?>
+            <img src="<?= htmlReady($card['front_file_ref']->getDownloadURL()); ?>">
+            <? endif; ?>
+            <?= htmlReady($card['front_text']); ?>
+        </p>
+        <p>
+            <? if ($card['front_file_ref']): ?>
+                <img src="<?= htmlReady($card['back_file_ref']->getDownloadURL()); ?>">
+            <? endif; ?>
+            <?= htmlReady($card['back_text']); ?>
+        </p>
+    <? endforeach; ?>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/document.php b/templates/courseware/block_types/document.php
new file mode 100644
index 00000000000..d4391701e9c
--- /dev/null
+++ b/templates/courseware/block_types/document.php
@@ -0,0 +1,9 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Dokument') . ': ' ?></p>
+    <p>
+        <?= _('Titel') . ' => ' . htmlReady($payload['title']) ?>,
+        <? if ($files[0]): ?>
+            <?= _('Datei') . '=>' ?> <a href="<?= htmlReady($files[0]->getDownloadURL()) ?>"><?= htmlReady($files[0]->name) ?></a>
+        <? endif; ?>
+    </p>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/download.php b/templates/courseware/block_types/download.php
new file mode 100644
index 00000000000..9fdd72896b9
--- /dev/null
+++ b/templates/courseware/block_types/download.php
@@ -0,0 +1,12 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Download') . ': ' ?></p>
+    <? if ($files[0]): ?>
+        <p>
+            <a href="<?= htmlReady($files[0]->getDownloadURL()); ?>"><?= htmlReady($files[0]->name); ?></a>
+        </p>
+    <? else: ?>
+        <p>
+        <span style="font-style:italic"><?= _('keine Datei ausgewählt'); ?></span>
+        </p>
+    <? endif; ?>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/embed.php b/templates/courseware/block_types/embed.php
index f22f133614e..9bab15b63cc 100644
--- a/templates/courseware/block_types/embed.php
+++ b/templates/courseware/block_types/embed.php
@@ -1,6 +1,8 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
-<h6><?= _('Block-Daten') . ': ' ?></h6>
-<h6><?= htmlReady(_('Titel') . ' => ' . $payload['title']) ?></h6>
-<h6><?= htmlReady(_('Quelle') . ' => ' . $payload['source']) ?></h6>
-<h6><?= htmlReady(_('URL') . ' => ' . $payload['url']) ?></h6>
-
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Externer Inhalt') . ': ' ?></p>
+    <p>
+        <?= htmlReady(_('Titel') . ' => ' . $payload['title']) ?>, 
+        <?= htmlReady(_('Quelle') . ' => ' . $payload['source']) ?>,
+        <?= _('URL') . '=>' ?> <a href="<?= htmlReady($payload['url']) ?>"><?= htmlReady($payload['url']) ?></a>
+    </p>
+</div>
diff --git a/templates/courseware/block_types/folder.php b/templates/courseware/block_types/folder.php
new file mode 100644
index 00000000000..cd7a3a18481
--- /dev/null
+++ b/templates/courseware/block_types/folder.php
@@ -0,0 +1,9 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Dateiordner') . ': ' ?></p>
+    <? foreach ($files as $file): ?>
+        <? if ($file === null) { continue; } ?>
+        <p>
+            <a href="<?= htmlReady($file->getDownloadURL()); ?>"><?= htmlReady($file->name); ?></a>
+        </p>
+    <? endforeach; ?>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/gallery.php b/templates/courseware/block_types/gallery.php
new file mode 100644
index 00000000000..dff14c6bb24
--- /dev/null
+++ b/templates/courseware/block_types/gallery.php
@@ -0,0 +1,7 @@
+<? foreach ($files as $file): ?>
+    <? if ($file === null) { continue; } ?>
+    <p>
+        <img src="<?= htmlReady($file->getDownloadURL()); ?>">
+        <span style="font-style: italic; font-size: 0.75em"><?= htmlReady($file->name); ?></span>
+    </p>
+<? endforeach; ?>
\ No newline at end of file
diff --git a/templates/courseware/block_types/headline.php b/templates/courseware/block_types/headline.php
index fc573268d41..7df3a084059 100644
--- a/templates/courseware/block_types/headline.php
+++ b/templates/courseware/block_types/headline.php
@@ -1,4 +1,3 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
-<h5><?= htmlReady($payload['title']) ?></h5>
-<h6><?= htmlReady($payload['subtitle']) ?></h6>
+<h5 style="font-size: 14px;"><?= htmlReady($payload['title']) ?></h5>
+<h6 style="font-size: 12px;"><?= htmlReady($payload['subtitle']) ?></h6>
 
diff --git a/templates/courseware/block_types/iframe.php b/templates/courseware/block_types/iframe.php
new file mode 100644
index 00000000000..8b4ed0f616b
--- /dev/null
+++ b/templates/courseware/block_types/iframe.php
@@ -0,0 +1,7 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Externer Inhalt') . ': ' ?></p>
+    <p>
+        <?= _('Titel') . ' => ' . htmlReady($payload['title']) ?>, 
+        <?= _('URL') . '=>' ?> <a href="<?= htmlReady($payload['url']) ?>"><?= htmlReady($payload['url']) ?></a>
+    </p>
+</div>
diff --git a/templates/courseware/block_types/image_map.php b/templates/courseware/block_types/image_map.php
new file mode 100644
index 00000000000..f3d35184953
--- /dev/null
+++ b/templates/courseware/block_types/image_map.php
@@ -0,0 +1,20 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Verweissensitive Grafik') . ': ' ?></p>
+    <p style="font-style: italic; font-size: 10px;"><?= _('Hinweis: Positionen der Verweise können nicht dargestellt werden.')?></p>
+    <p>
+        <? if ($files[0]): ?>
+            <img src="<?= htmlReady($files[0]->getDownloadURL()); ?>">
+            <span style="font-style:italic"><?= htmlReady($files[0]->name); ?></span>
+        <? endif; ?>
+    </p>
+    <p><?= _('Verweise'). ': ' ?></p>
+    <ul>
+        <? foreach($payload['shapes'] as $shape): ?>
+            <li>
+                <?= htmlReady($shape['title']); ?>,<?= htmlReady($shape['data']['text']); ?><? if ($shape['link_type'] === 'external'): ?>,
+                    <a href="<?= htmlReady($shape['target_external']); ?>"><?= htmlReady($shape['target_external']); ?></a>
+                <? endif; ?>
+            </li>
+        <? endforeach; ?>
+    </ul>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/key_point.php b/templates/courseware/block_types/key_point.php
index 714e8e8e6f2..df2267c09ef 100644
--- a/templates/courseware/block_types/key_point.php
+++ b/templates/courseware/block_types/key_point.php
@@ -1,2 +1 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
 <p><?= htmlReady($payload['text']) ?></p>
diff --git a/templates/courseware/block_types/link.php b/templates/courseware/block_types/link.php
index c1da7643d14..aabca214703 100644
--- a/templates/courseware/block_types/link.php
+++ b/templates/courseware/block_types/link.php
@@ -1,3 +1,7 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
-<p><?= htmlReady($payload['title']) ?></p>
-<p><?= htmlReady($payload['url']) ?></p>
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Link') . ': ' ?></p>
+    <p>
+        <?= _('Titel') . ' => ' . htmlReady($payload['title']) ?>, 
+        <?= _('URL') . '=>' ?> <a href="<?= htmlReady($payload['url']) ?>"><?= htmlReady($payload['url']) ?></a>
+    </p>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/block_types/table_of_contents.php b/templates/courseware/block_types/table_of_contents.php
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/templates/courseware/block_types/text.php b/templates/courseware/block_types/text.php
index f92fe0748f8..0b1afd9229f 100644
--- a/templates/courseware/block_types/text.php
+++ b/templates/courseware/block_types/text.php
@@ -1,2 +1,3 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
-<?= formatReady($payload['text']) ?>
+<div style="font-size: 12px;">
+    <?= formatReady($payload['text']) ?>
+</div>
diff --git a/templates/courseware/block_types/typewriter.php b/templates/courseware/block_types/typewriter.php
index 714e8e8e6f2..fe81bf76229 100644
--- a/templates/courseware/block_types/typewriter.php
+++ b/templates/courseware/block_types/typewriter.php
@@ -1,2 +1 @@
-<h5><?= sprintf(_('Block-Typ: %s'), htmlReady($title)) ?></h5>
-<p><?= htmlReady($payload['text']) ?></p>
+<p><?= htmlReady($payload['text']) ?></p>
\ No newline at end of file
diff --git a/templates/courseware/block_types/video.php b/templates/courseware/block_types/video.php
new file mode 100644
index 00000000000..5e23416795f
--- /dev/null
+++ b/templates/courseware/block_types/video.php
@@ -0,0 +1,9 @@
+<div style="font-size: 12px;">
+    <p style="font-weight: bold;"><?= _('Video') . ': ' ?></p>
+    <p>
+        <?= htmlReady($payload['title']); ?>,
+        <? if ($files[0]): ?>
+            <a href="<?= htmlReady($files[0]->getDownloadURL()) ?>"><?= htmlReady($files[0]->name); ?></a>
+        <? endif; ?>
+    </p>
+</div>
\ No newline at end of file
diff --git a/templates/courseware/container_types/accordion_container.php b/templates/courseware/container_types/accordion_container.php
index afc25e04bd7..cbe35f70c4e 100644
--- a/templates/courseware/container_types/accordion_container.php
+++ b/templates/courseware/container_types/accordion_container.php
@@ -1,4 +1,3 @@
-<h3><?= sprintf(_('Container-Typ: %s'), htmlReady($title)) ?></h3>
 <? foreach ($payload['sections'] as $section): ?>
     <h4><?= htmlReady($section['name']) ?></h4>
     <? foreach ($section['blocks'] as $block_id): ?>
@@ -8,8 +7,6 @@
             <? if ($block_html_template): ?>
                 <?= $block_html_template->render(); ?>
             <? endif; ?>
-        <? else: ?>
-            <p><?= _('Block konnte nicht gefunden werden') ?></p>
         <? endif; ?>
     <? endforeach ?>
 <? endforeach ?>
diff --git a/templates/courseware/container_types/list_container.php b/templates/courseware/container_types/list_container.php
index 1dc4376864d..efe8e952696 100644
--- a/templates/courseware/container_types/list_container.php
+++ b/templates/courseware/container_types/list_container.php
@@ -1,4 +1,3 @@
-<h3><?= sprintf(_('Container-Typ: %s'), htmlReady($title)) ?></h3>
 <? foreach ($payload['sections'][0]['blocks'] as $block_id): ?>
     <? $block = $container->blocks->find($block_id); ?>
     <? if ($block): ?>
@@ -6,7 +5,5 @@
         <? if ($block_html_template): ?>
             <?= $block_html_template->render(); ?>
         <? endif; ?>
-    <? else: ?>
-        <p><?= _('Block konnte nicht gefunden werden') ?></p>
     <? endif; ?>
 <? endforeach ?>
diff --git a/templates/courseware/container_types/tabs_container.php b/templates/courseware/container_types/tabs_container.php
index afc25e04bd7..24879f598a4 100644
--- a/templates/courseware/container_types/tabs_container.php
+++ b/templates/courseware/container_types/tabs_container.php
@@ -1,4 +1,3 @@
-<h3><?= sprintf(_('Container-Typ: %s'), htmlReady($title)) ?></h3>
 <? foreach ($payload['sections'] as $section): ?>
     <h4><?= htmlReady($section['name']) ?></h4>
     <? foreach ($section['blocks'] as $block_id): ?>
@@ -8,8 +7,6 @@
             <? if ($block_html_template): ?>
                 <?= $block_html_template->render(); ?>
             <? endif; ?>
-        <? else: ?>
-            <p><?= _('Block konnte nicht gefunden werden') ?></p>
         <? endif; ?>
-    <? endforeach ?>
-<? endforeach ?>
+    <? endforeach; ?>
+<? endforeach ?>
\ No newline at end of file
-- 
GitLab