From 1814f4d8acd61c7fc640e00687d4070c361f5bcf Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Thu, 30 Sep 2021 23:49:00 +0200 Subject: [PATCH] remove call to undefined method, fixes #211 --- lib/classes/Seminar.class.php | 6 +++--- lib/raumzeit/Issue.class.php | 39 ++++++++++++++--------------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index c843bea744b..099f1518e11 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -2346,9 +2346,9 @@ class Seminar public function getSlotModule($slot) { $module = 'Core' . ucfirst($slot); - if ($this->course->isToolActive($module)) { - return PluginEngine::getPlugin($module);; - } + if ($this->course->isToolActive($module)) { + return PluginEngine::getPlugin($module); + } } /** diff --git a/lib/raumzeit/Issue.class.php b/lib/raumzeit/Issue.class.php index 50f1555bab6..51b6cc0bfb8 100644 --- a/lib/raumzeit/Issue.class.php +++ b/lib/raumzeit/Issue.class.php @@ -147,12 +147,10 @@ class Issue { if ($this->hasForum) { $sem = Seminar::getInstance($this->seminar_id); - $forum_slot = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']]->getSlotModule('forum'); - - foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { - if (get_class($plugin) == $forum_slot) { - $plugin->setThreadForIssue($this->issue_id, $this->title, $this->description); - } + $forum_module = $sem->getSlotModule('forum'); + + if ($forum_module instanceof ForumModule) { + $forum_module->setThreadForIssue($this->issue_id, $this->title, $this->description); } } @@ -205,12 +203,10 @@ class Issue { // check, if there is a forums-connection $sem = Seminar::getInstance($this->seminar_id); - $forum_slot = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']]->getSlotModule('forum'); - - foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { - if (get_class($plugin) == $forum_slot) { - $this->hasForum = $plugin->getLinkToThread($this->issue_id) ? true : false; - } + $forum_module = $sem->getSlotModule('forum'); + + if ($forum_module instanceof ForumModule) { + $this->hasForum = $forum_module->getLinkToThread($this->issue_id) ? true : false; } $this->readSingleDates(); @@ -249,16 +245,13 @@ class Issue { // find the ForumModule which takes the role of the CoreForum in the current Seminar $sem = Seminar::getInstance($this->seminar_id); - $forum_slot = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']]->getSlotModule('forum'); - - foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { - if (get_class($plugin) == $forum_slot) { - - // only link if there is none yet - if (!$plugin->getLinkToThread($this->issue_id)) { - $plugin->setThreadForIssue($this->issue_id, $this->title, $this->description); - $this->messages[] = sprintf(_("Ordner im Forum für das Thema \"%s\" angelegt."), $this->toString()); - } + $forum_module = $sem->getSlotModule('forum'); + + if ($forum_module instanceof ForumModule) { + // only link if there is none yet + if (!$forum_module->getLinkToThread($this->issue_id)) { + $forum_module->setThreadForIssue($this->issue_id, $this->title, $this->description); + $this->messages[] = sprintf(_("Ordner im Forum für das Thema \"%s\" angelegt."), $this->toString()); } } } @@ -277,4 +270,4 @@ class Issue { function isIssue($issue_id) { return IssueDB::isIssue($issue_id); } -} \ No newline at end of file +} -- GitLab