From b497817cc38753a6ee97644b46e9969e63a8f39d Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Thu, 23 Dec 2021 17:04:40 +0100
Subject: [PATCH] fix calculation of week offset when semester does not start
 on Monday, fixes #472

---
 app/views/course/timesrooms/_irregularEvents.php | 4 ++--
 app/views/course/timesrooms/_regularEvents.php   | 6 +++---
 lib/models/SeminarCycleDate.class.php            | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/app/views/course/timesrooms/_irregularEvents.php b/app/views/course/timesrooms/_irregularEvents.php
index 71a82669425..0181ec5123f 100644
--- a/app/views/course/timesrooms/_irregularEvents.php
+++ b/app/views/course/timesrooms/_irregularEvents.php
@@ -33,7 +33,7 @@ $room_request_filter = function ($date) {
     <? endif ?>
     </header>
 <? if (!empty($single_dates)): ?>
-    <form class="default collapsable" action="<?= $controller->url_for('course/timesrooms/stack', $linkAttributes) ?>"
+    <form class="collapsable" action="<?= $controller->url_for('course/timesrooms/stack', $linkAttributes) ?>"
     <?= Request::isXhr() ? 'data-dialog="size=big"' : ''?> method="post">
         <?= CSRFProtection::tokenTag() ?>
     <? foreach ($single_dates as $semester_id => $termine) : ?>
@@ -70,7 +70,7 @@ $room_request_filter = function ($date) {
                 </section>
             </header>
             <section>
-                <table class="default nohover">
+                <table class="default">
                     <colgroup>
                     <? if (!$locked) :?>
                         <col width="30px">
diff --git a/app/views/course/timesrooms/_regularEvents.php b/app/views/course/timesrooms/_regularEvents.php
index bfe18b2b382..6048331f3f0 100644
--- a/app/views/course/timesrooms/_regularEvents.php
+++ b/app/views/course/timesrooms/_regularEvents.php
@@ -18,7 +18,7 @@
 <? if (!empty($cycle_dates)) : ?>
     <? foreach ($cycle_dates as $metadate_id => $cycle) : ?>
 
-        <form class="default collapsable" action="<?= $controller->url_for('course/timesrooms/stack/' . $metadate_id, $linkAttributes) ?>"
+        <form class="collapsable" action="<?= $controller->url_for('course/timesrooms/stack/' . $metadate_id, $linkAttributes) ?>"
               method="post" <?= Request::isXhr() ? 'data-dialog="size=big"' : ''?>>
             <?= CSRFProtection::tokenTag() ?>
 
@@ -97,7 +97,7 @@
                                     'clickable',
                                     [
                                         'title' => _('Raumanfrage erstellen'),
-                                        'class' => 'text-align'
+                                        'style' => 'vertical-align: middle;'
                                     ]
                                 ),
                                 ['data-dialog' => 'size=big']
@@ -114,7 +114,7 @@
                     <? endif ?>
                 </header>
                 <section>
-                    <table class="default nohover">
+                    <table class="default">
                         <colgroup>
                             <? if (!$locked) : ?>
                                 <col width="30px">
diff --git a/lib/models/SeminarCycleDate.class.php b/lib/models/SeminarCycleDate.class.php
index 4daef1e0ac8..aed6fd9f2e7 100644
--- a/lib/models/SeminarCycleDate.class.php
+++ b/lib/models/SeminarCycleDate.class.php
@@ -722,7 +722,7 @@ class SeminarCycleDate extends SimpleORMap
     {
         $date = new DateTime();
         $date->setTimestamp($base);
-        $date->modify(sprintf('%s days', $days));
+        $date->modify(sprintf('this week monday +%s days', $days));
         return $date->getTimestamp();
     }
 
-- 
GitLab