diff options
| author | Murtaza Sultani <sultani@data-quest.de> | 2025-07-14 12:42:13 +0200 |
|---|---|---|
| committer | Murtaza Sultani <sultani@data-quest.de> | 2025-07-14 12:42:13 +0200 |
| commit | 74076ca20b80311c19f3b32870f1c8eba82bc09d (patch) | |
| tree | 80bcb0d7b58269e947c006e6a51cc8b94c1938be /app/controllers/course | |
| parent | c76e8045a8113b3d5837459c521371921a592279 (diff) | |
Resolve "Forum funktioniert nicht mehr an Einrichtungen"
Closes #5700
Merge request studip/studip!4351
Diffstat (limited to 'app/controllers/course')
| -rw-r--r-- | app/controllers/course/forum/ForumBaseController.php | 6 | ||||
| -rw-r--r-- | app/controllers/course/forum/categories.php | 10 | ||||
| -rw-r--r-- | app/controllers/course/forum/discussions.php | 14 | ||||
| -rw-r--r-- | app/controllers/course/forum/search.php | 12 | ||||
| -rw-r--r-- | app/controllers/course/forum/topics.php | 14 |
5 files changed, 28 insertions, 28 deletions
diff --git a/app/controllers/course/forum/ForumBaseController.php b/app/controllers/course/forum/ForumBaseController.php index cefa5a4..196bbcf 100644 --- a/app/controllers/course/forum/ForumBaseController.php +++ b/app/controllers/course/forum/ForumBaseController.php @@ -18,9 +18,9 @@ abstract class ForumBaseController extends StudipController { object_set_visit_module('forum'); - $this->course_id = Context::getId(); - $this->is_moderator = CoreForum::isModerator($this->course_id); - $this->is_admin = CoreForum::isAdmin($this->course_id); + $this->range_id = Context::getId(); + $this->is_moderator = CoreForum::isModerator($this->range_id); + $this->is_admin = CoreForum::isAdmin($this->range_id); $this->buildSidebar(); diff --git a/app/controllers/course/forum/categories.php b/app/controllers/course/forum/categories.php index 3b5cfd4..4f9f324 100644 --- a/app/controllers/course/forum/categories.php +++ b/app/controllers/course/forum/categories.php @@ -9,7 +9,7 @@ class Course_Forum_CategoriesController extends Forum\ForumBaseController { parent::before_filter($action, $args); - if (!CourseConfig::get($this->course_id)->FORUM_HIDE_CATEGORIES_NAVIGATION) { + if (!RangeConfig::get($this->range_id)->FORUM_HIDE_CATEGORIES_NAVIGATION) { Navigation::activateItem('course/forum/categories'); } else { Navigation::activateItem('course/forum/topics'); @@ -54,7 +54,7 @@ class Course_Forum_CategoriesController extends Forum\ForumBaseController if ($category_id) { PageLayout::setTitle(_('Kategorie bearbeiten')); - $category = ForumCategory::findOneBySQL("range_id = ? AND category_id = ?", [$this->course_id, $category_id]); + $category = ForumCategory::findOneBySQL("range_id = ? AND category_id = ?", [$this->range_id, $category_id]); if (!$category) { throw new AccessDeniedException(); @@ -81,13 +81,13 @@ class Course_Forum_CategoriesController extends Forum\ForumBaseController CSRFProtection::verifyUnsafeRequest(); if ($category_id) { - $category = ForumCategory::findOneBySQL("range_id = ? AND category_id = ?", [$this->course_id, $category_id]); + $category = ForumCategory::findOneBySQL("range_id = ? AND category_id = ?", [$this->range_id, $category_id]); if (!$category) { throw new AccessDeniedException(); } } else { $category = new ForumCategory(); - $category->range_id = $this->course_id; + $category->range_id = $this->range_id; } $category->name = Request::get('name'); @@ -107,7 +107,7 @@ class Course_Forum_CategoriesController extends Forum\ForumBaseController throw new AccessDeniedException(); } - $category = ForumCategory::findOneBySQL("range_id = ? AND category_id = ?", [$this->course_id, $category_id]); + $category = ForumCategory::findOneBySQL("range_id = ? AND category_id = ?", [$this->range_id, $category_id]); if (!$category) { throw new AccessDeniedException(); diff --git a/app/controllers/course/forum/discussions.php b/app/controllers/course/forum/discussions.php index decff73..c946401 100644 --- a/app/controllers/course/forum/discussions.php +++ b/app/controllers/course/forum/discussions.php @@ -31,9 +31,9 @@ class Course_Forum_DiscussionsController extends Forum\ForumBaseController COUNT(posting_id) as 'postings_count', COUNT(DISTINCT user_id) as 'users_count' , MAX(mkdate) as 'recent_activity' - FROM forum_postings WHERE range_id = :course_id", + FROM forum_postings WHERE range_id = :range_id", [ - 'course_id' => $this->course_id + 'range_id' => $this->range_id ] ); @@ -105,7 +105,7 @@ class Course_Forum_DiscussionsController extends Forum\ForumBaseController 'category' => $category ? $category->toRawArray() : [], 'read_index' => (int) ($posting_read ? $posting_read->read_index : 0), 'redirect' => Request::option('redirect'), - 'search_keyword' => $_SESSION['forum'][$this->course_id]['search']['keyword'] ?? '' + 'search_keyword' => $_SESSION['forum'][$this->range_id]['search']['keyword'] ?? '' ]) ); } @@ -128,10 +128,10 @@ class Course_Forum_DiscussionsController extends Forum\ForumBaseController `ft`.`topic_id`, `ft`.`name`, `fc`.`color` FROM `forum_topics` AS `ft` LEFT JOIN `forum_categories` AS `fc` USING (`category_id`) - WHERE `ft`.`range_id` = :course_id + WHERE `ft`.`range_id` = :range_id ORDER BY `ft`.`position` ASC, `ft`.`mkdate` DESC ", - ['course_id' => $this->course_id] + ['range_id' => $this->range_id] ); $all_tags = array_map(fn(ForumTag $tag) => $tag->toRawArray(), ForumTag::getForumTags()); @@ -179,7 +179,7 @@ class Course_Forum_DiscussionsController extends Forum\ForumBaseController if (empty($topic['topic_id'])) { $newTopic = ForumTopic::create([ - 'range_id' => $this->course_id, + 'range_id' => $this->range_id, 'name' => $topic['name'] ]); @@ -191,7 +191,7 @@ class Course_Forum_DiscussionsController extends Forum\ForumBaseController if (!$discussion_id && Request::get('content')) { ForumPosting::create([ - 'range_id' => $this->course_id, + 'range_id' => $this->range_id, 'discussion_id' => $discussion->discussion_id, 'content' => Markup::markAsHtml(Request::get('content')), 'user_id' => User::findCurrent()->user_id diff --git a/app/controllers/course/forum/search.php b/app/controllers/course/forum/search.php index 9e811e3..c9f4588 100644 --- a/app/controllers/course/forum/search.php +++ b/app/controllers/course/forum/search.php @@ -22,10 +22,10 @@ class Course_Forum_SearchController extends Forum\ForumBaseController `ft`.`topic_id`, `ft`.`name`, `fc`.`color` FROM `forum_topics` AS `ft` LEFT JOIN `forum_categories` AS `fc` USING (`category_id`) - WHERE `ft`.`range_id` = :course_id + WHERE `ft`.`range_id` = :range_id ORDER BY `ft`.`position` ASC, `ft`.`mkdate` DESC ", - ['course_id' => $this->course_id] + ['range_id' => $this->range_id] ); $course_members = []; @@ -58,7 +58,7 @@ class Course_Forum_SearchController extends Forum\ForumBaseController private function getResult($search_object): array { if ($this->isSearchObjectEmpty($search_object)) { - unset($_SESSION['forum'][$this->course_id]['search']); + unset($_SESSION['forum'][$this->range_id]['search']); return []; } @@ -71,7 +71,7 @@ class Course_Forum_SearchController extends Forum\ForumBaseController LEFT JOIN tags_relations ON (tags_relations.range_id = discussions.discussion_id AND range_type = 'forum') WHERE postings.range_id = :range_id ", [ - 'range_id' => $this->course_id + 'range_id' => $this->range_id ] ]; @@ -196,11 +196,11 @@ class Course_Forum_SearchController extends Forum\ForumBaseController 'user_ids' => Request::getArray('user_ids') ]; - $_SESSION['forum'][$this->course_id]['search'] = $search_object; + $_SESSION['forum'][$this->range_id]['search'] = $search_object; return $search_object; } - $session_search = $_SESSION['forum'][$this->course_id]['search'] ?? []; + $session_search = $_SESSION['forum'][$this->range_id]['search'] ?? []; return [ 'keyword' => $session_search['keyword'] ?? '', 'begin' => $session_search['begin'] ?? 0, diff --git a/app/controllers/course/forum/topics.php b/app/controllers/course/forum/topics.php index 0070937..652ecf9 100644 --- a/app/controllers/course/forum/topics.php +++ b/app/controllers/course/forum/topics.php @@ -11,7 +11,7 @@ class Course_Forum_TopicsController extends Forum\ForumBaseController { parent::before_filter($action, $args); - unset($_SESSION['forum'][$this->course_id]['search']); + unset($_SESSION['forum'][$this->range_id]['search']); Navigation::activateItem('course/forum/topics'); } @@ -65,7 +65,7 @@ class Course_Forum_TopicsController extends Forum\ForumBaseController if ($topic_id) { PageLayout::setTitle(_('Thema bearbeiten')); - $topic = ForumTopic::getCourseTopic($this->course_id, $topic_id); + $topic = ForumTopic::getCourseTopic($this->range_id, $topic_id); if (!$topic) { throw new AccessDeniedException(); @@ -78,7 +78,7 @@ class Course_Forum_TopicsController extends Forum\ForumBaseController $categories = DBManager::get()->fetchAll( "SELECT * FROM `forum_categories` WHERE `range_id` = ? ORDER BY `position` ASC, `mkdate` DESC", - [$this->course_id] + [$this->range_id] ); $this->render_vue_app( @@ -99,20 +99,20 @@ class Course_Forum_TopicsController extends Forum\ForumBaseController CSRFProtection::verifyUnsafeRequest(); if ($topic_id) { - $topic = ForumTopic::getCourseTopic($this->course_id, $topic_id); + $topic = ForumTopic::getCourseTopic($this->range_id, $topic_id); if (!$topic) { throw new AccessDeniedException(); } } else { $topic = new ForumTopic(); - $topic->range_id = $this->course_id; + $topic->range_id = $this->range_id; } $category = json_decode(Request::get('category'), true); if (empty($category['category_id']) && !empty($category['name'])) { $newCategory = ForumCategory::create([ - 'range_id' => $this->course_id, + 'range_id' => $this->range_id, 'color' => '#28497C', 'name' => $category['name'] ]); @@ -142,7 +142,7 @@ class Course_Forum_TopicsController extends Forum\ForumBaseController throw new AccessDeniedException(); } - $topic = ForumTopic::getCourseTopic($this->course_id, $topic_id); + $topic = ForumTopic::getCourseTopic($this->range_id, $topic_id); if (!$topic) { throw new AccessDeniedException(); |
