From 01a76b0689393277fb89ca2b493133a53c1deb5c Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Mon, 17 Jun 2019 15:22:53 +0200
Subject: [PATCH] removed obsolete code segments, added checkbox to lock copied
 courses in copy/info view

---
 CourseCopy.class.php | 16 ++++++----------
 controllers/copy.php | 20 --------------------
 views/copy/info.php  |  4 ++++
 3 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/CourseCopy.class.php b/CourseCopy.class.php
index 6258aaa..0876f0c 100755
--- a/CourseCopy.class.php
+++ b/CourseCopy.class.php
@@ -15,16 +15,12 @@ class CourseCopy extends StudIPPlugin implements AdminCourseAction
     }
 
     public function useMultimode() {
-        if (version_compare($GLOBALS['SOFTWARE_VERSION'], "3.4.99", ">=")) {
-            //Damit es im Dialog geöffnet wird
-            return \Studip\Button::createAccept(
-                dgettext('CourseCopy', 'Kopieren'),
-                'edit',
-                array('data-dialog' => 1)
-            );
-        } else {
-            return dgettext('CourseCopy', 'Kopieren');
-        }
+        //Damit es im Dialog geöffnet wird
+        return \Studip\Button::createAccept(
+            dgettext('CourseCopy', 'Kopieren'),
+            'edit',
+            array('data-dialog' => 1)
+        );
     }
 
     public function getAdminCourseActionTemplate($course_id, $values = null, $semester = null) {
diff --git a/controllers/copy.php b/controllers/copy.php
index 1c7985c..6dbfb7b 100755
--- a/controllers/copy.php
+++ b/controllers/copy.php
@@ -99,26 +99,6 @@ class CopyController extends PluginController
                             $newentry->store();
                         }
 
-                        if (version_compare($GLOBALS['SOFTWARE_VERSION'], "3.99.99", "<")) {
-                            //Document folders (Stud.IP 3.5)
-                            $insert_folder = DBManager::get()->prepare("
-                                INSERT IGNORE INTO folder
-                                SET folder_id = MD5(CONCAT(:seminar_id, 'allgemeine_dateien')),
-                                    range_id = :seminar_id,
-                                    user_id = :user_id,
-                                    name = :name,
-                                    description = :description,
-                                    mkdate = UNIX_TIMESTAMP(),
-                                    chdate = UNIX_TIMESTAMP()
-                            ");
-                            $insert_folder->execute(array(
-                                'seminar_id' => $newcourse->getId(),
-                                'user_id' => $GLOBALS['user']->id,
-                                'name' => _("Allgemeiner Dateiordner"),
-                                'description' => _("Ablage für allgemeine Ordner und Dokumente der Veranstaltung")
-                            ));
-                        }
-
                         $copy_regular_room_bookings = false;
                         if (Request::get('regular_room_bookings')) {
                             $copy_regular_room_bookings = true;
diff --git a/views/copy/info.php b/views/copy/info.php
index 880c150..a586954 100755
--- a/views/copy/info.php
+++ b/views/copy/info.php
@@ -33,6 +33,10 @@
             <input type="checkbox" name="regular_room_bookings" value="1">
             <?= _('Raumbuchungen von regelmäßigen Terminen kopieren') ?>
         </label>
+        <label>
+            <input type="checkbox" name="lock_copied_courses" value="1">
+            <?= _('Kopierte Veranstaltungen sperren') ?>
+        </label>
     </fieldset>
     <div data-dialog-button>
         <?= \Studip\Button::create(_("Kopieren"), "copy", array('onclick' => "return window.confirm('"._("Wirklich kopieren?")."');")) ?>
-- 
GitLab