From 4c8168a15878ab661f9390ede2e2f2c7fe7a7763 Mon Sep 17 00:00:00 2001 From: tgloeggl Date: Wed, 28 Sep 2022 13:32:46 +0200 Subject: [PATCH] reintroduce missing method for OC block int the courseware plugin --- models/OCCourseModel.class.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/models/OCCourseModel.class.php b/models/OCCourseModel.class.php index f29b6e665..b7d9d0edd 100644 --- a/models/OCCourseModel.class.php +++ b/models/OCCourseModel.class.php @@ -173,6 +173,26 @@ public static function getCount($course_id, $visitdate) return $stmt->fetchColumn(); } + public function getEpisodesforREST() + { + $rest_episodes = []; + $is_dozent = $GLOBALS['perm']->have_studip_perm('autor', $this->course_id); + $episodes = $this->getEpisodes(); + + foreach ($episodes as $episode) { + if ($episode['visibility'] == 'true') { + $rest_episodes[] = $episode; + } else { + if ($is_dozent) { + $rest_episodes[] = $episode; + } + } + } + + return $rest_episodes; + } + + public function toggleSeriesVisibility() { if ($this->getSeriesVisibility() == 'visible') {