aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRon Lucke <lucke@elan-ev.de>2025-07-14 12:52:07 +0200
committerRon Lucke <lucke@elan-ev.de>2025-07-14 12:52:07 +0200
commiteb730470d8d61523c18706ccf27dad9dabf483a2 (patch)
treeae6a48387a2922b34ebe60126c9575d16612f362 /app
parent74076ca20b80311c19f3b32870f1c8eba82bc09d (diff)
Courseware öffentliche Links wieder öffentlich machen
Closes #5717 and #5003 Merge request studip/studip!4347
Diffstat (limited to 'app')
-rw-r--r--app/controllers/courseware/public.php14
-rw-r--r--app/views/courseware/public/index.php2
2 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/courseware/public.php b/app/controllers/courseware/public.php
index e5f7aec..a1d3077 100644
--- a/app/controllers/courseware/public.php
+++ b/app/controllers/courseware/public.php
@@ -22,11 +22,23 @@ class Courseware_PublicController extends StudipController
$publicLink = PublicLink::find($this->link_id);
$this->invalid = $publicLink === null;
if (!$this->invalid) {
- $this->block_types = Courseware\BlockTypes\BlockType::getBlockTypes();
+ $blockTypes = Courseware\BlockTypes\BlockType::getBlockTypes();
+ $this->block_types = json_encode( array_map([$this, 'mapType'], $blockTypes));
+ $containerTypes = Courseware\ContainerTypes\ContainerType::getContainerTypes();
+ $this->container_types = json_encode( array_map([$this, 'mapType'], $containerTypes));
$this->expired = $publicLink->isExpired();
$this->link_pass = $publicLink->password;
$this->entry_element_id = $publicLink->structural_element_id;
}
}
}
+
+ private function mapType(string $typeClass): array
+ {
+ return [
+ 'type' => $typeClass::getType(),
+ 'title' => $typeClass::getTitle(),
+ 'is-activated' => $typeClass::isActivated(),
+ ];
+ }
}
diff --git a/app/views/courseware/public/index.php b/app/views/courseware/public/index.php
index 15e0810..cae565d 100644
--- a/app/views/courseware/public/index.php
+++ b/app/views/courseware/public/index.php
@@ -5,6 +5,8 @@
link-pass="<?= htmlReady($link_pass) ?>"
entry-type="public"
entry-element-id="<?= htmlReady($entry_element_id) ?>"
+ block-types="<?= htmlReady($block_types) ?>"
+ container-types="<?= htmlReady($container_types) ?>"
>
</div>
<? endif; ?>