From beb442d8fee892418adb71d871961dcbe9e2a227 Mon Sep 17 00:00:00 2001
From: tgloeggl <tgloeggl@uos.de>
Date: Fri, 13 Dec 2013 16:34:42 +0100
Subject: [PATCH] remove plugin-activation check, improve sem-status check

---
 AvailSchedule.class.php | 17 +++++------------
 plugin.manifest         |  2 +-
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/AvailSchedule.class.php b/AvailSchedule.class.php
index 05bd893..b5e8eab 100755
--- a/AvailSchedule.class.php
+++ b/AvailSchedule.class.php
@@ -27,19 +27,12 @@ class AvailSchedule extends StudipPlugin implements SystemPlugin
     {
         parent::__construct();
 
-        if (!$this->isActivated()) {
-            return;
-        }
-
-        $seminar_id = Request::option('cid', $GLOBALS['SeminarSession']);
+        $sem_type = $_SESSION['SessSemName']['art_num'];
 
-        $sem = Seminar::getInstance($seminar_id);
-        
-        if (in_array($sem->status, studygroup_sem_types()) === false) {
-            if (Navigation::hasItem('/course/members') && $GLOBALS['perm']->have_studip_perm('tutor', $seminar_id)) {
-                $navigation = Navigation::getItem('/course/members');
-                $navigation->addSubNavigation('conflicts', new Navigation(_('Verfügbarkeit'), PluginEngine::getLink('availschedule/show')));
-            }
+        if (isset($sem_type) && !$GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem_type]]->studygroup_mode &&
+            Navigation::hasItem('/course/members') && $GLOBALS['perm']->have_studip_perm('tutor', $_SESSION['SessSemName'][1])) {
+            $navigation = Navigation::getItem('/course/members');
+            $navigation->addSubNavigation('conflicts', new Navigation(_('Verfügbarkeit'), PluginEngine::getLink('availschedule/show')));
         }
     }
 
diff --git a/plugin.manifest b/plugin.manifest
index f66612d..4561866 100755
--- a/plugin.manifest
+++ b/plugin.manifest
@@ -1,5 +1,5 @@
 pluginclassname=AvailSchedule
 pluginname=AvailabilitySchedule
 origin=elan-ev
-version=0.1.2
+version=0.1.3
 studipMinVersion=2.4
-- 
GitLab