From e8b705552223dda616b52cb37bf1462831e79d6a Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Wed, 8 Nov 2023 08:50:40 +0000
Subject: [PATCH] fixes #3354

Closes #3354

Merge request studip/studip!2281
---
 app/controllers/course/details.php | 14 +++++++++++++-
 app/views/course/details/index.php | 25 ++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/app/controllers/course/details.php b/app/controllers/course/details.php
index a956f07de5b..2a685e3b683 100644
--- a/app/controllers/course/details.php
+++ b/app/controllers/course/details.php
@@ -67,11 +67,11 @@ class Course_DetailsController extends AuthenticatedController
 
     public function index_action()
     {
-
         $this->prelim_discussion = vorbesprechung($this->course->id);
         $this->title             = $this->course->getFullname();
         $this->course_domains    = UserDomain::getUserDomainsForSeminar($this->course->id);
         $this->sem = new Seminar($this->course);
+        $this->links = [];
 
         //public folders
         $folders = Folder::findBySQL("range_type='course' AND range_id = ? AND folder_type = 'CoursePublicFolder'", [$this->course->id]);
@@ -233,6 +233,12 @@ class Course_DetailsController extends AuthenticatedController
                     ['data-dialog' => 'size=big']
                 );
 
+                $this->links[] = [
+                    'label'      => $abo_msg,
+                    'url'        => $this->url_for("course/enrolment/apply/{$this->course->id}"),
+                    'attributes' => ['data-dialog' => 'size=big'],
+                ];
+
             }
 
             if (Config::get()->SCHEDULE_ENABLE
@@ -253,6 +259,12 @@ class Course_DetailsController extends AuthenticatedController
                         $this->url_for("calendar/schedule/addvirtual/{$this->course->id}"),
                         Icon::create('info')
                     );
+
+                    $this->links[] = [
+                        'label'      => _('Nur im Stundenplan vormerken'),
+                        'url'        => $this->url_for("calendar/schedule/addvirtual/{$this->course->id}"),
+                        'attributes' => [],
+                    ];
                 }
             }
 
diff --git a/app/views/course/details/index.php b/app/views/course/details/index.php
index 3b9d86ccd25..15cee6ca6cd 100644
--- a/app/views/course/details/index.php
+++ b/app/views/course/details/index.php
@@ -1,3 +1,14 @@
+<?php
+/**
+ * @var array<array{label: string, url: string, attributes: array}> $links
+ * @var Course $course
+ * @var Course[] $siblings
+ * @var Course_DetailsController $controller
+ * @var Seminar $sem
+ * @var string $prelim_discussion
+ * @var stdClass $id_sfx
+ */
+?>
 <style>
     /* This should be done by an own class (maybe not table? maybe dd?) */
     #tablefix {
@@ -498,9 +509,17 @@ if (!empty($mvv_tree)) : ?>
 <? endforeach ?>
 
 
-<? if (Request::get('from')) : ?>
+<? if (count($links) > 0 || Request::get('from')) : ?>
     <footer data-dialog-button>
-        <?= \Studip\LinkButton::createCancel(_('Zurück'), URLHelper::getURL(Request::get('from')))?>
+    <? foreach ($links as $link): ?>
+        <?= Studip\LinkButton::create(
+            $link['label'],
+            URLHelper::getURL($link['url'], $link['attributes'] ?? [])
+        ) ?>
+    <? endforeach ?>
+    <? if (Request::get('from')): ?>
+        <?= Studip\LinkButton::createCancel(_('Zurück'), URLHelper::getURL(Request::get('from')))?>
+    <? endif ?>
     </footer>
 <? endif ?>
-<?= Feedback::getHTML($course->id, 'Course'); ?>
+<?= Feedback::getHTML($course->id, Course::class) ?>
-- 
GitLab