From debd3d62b383b5e249ff72c1b0731141799a8a37 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 14 Apr 2008 08:52:49 +0000 Subject: [PATCH] MDL-14349 adv forum search accessibility; merged from MOODLE_19_STABLE --- mod/forum/search.php | 62 +++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/mod/forum/search.php b/mod/forum/search.php index 0f02417a07..9e59099254 100644 --- a/mod/forum/search.php +++ b/mod/forum/search.php @@ -85,7 +85,7 @@ } if (! $course = get_record("course", "id", $id)) { - print_error("Course id is incorrect."); + error("Course id is incorrect."); } require_course_login($course); @@ -182,14 +182,14 @@ // Replace the simple subject with the three items forum name -> thread name -> subject // (if all three are appropriate) each as a link. if (! $discussion = get_record('forum_discussions', 'id', $post->discussion)) { - print_error('Discussion ID was incorrect'); + error('Discussion ID was incorrect'); } if (! $forum = get_record('forum', 'id', "$discussion->forum")) { - print_error("Could not find forum $discussion->forum"); + error("Could not find forum $discussion->forum"); } if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) { - print_error('Course Module ID was incorrect'); + error('Course Module ID was incorrect'); } $post->subject = highlight($strippedsearch, $post->subject); @@ -261,30 +261,30 @@ function forum_print_big_search_form($course) { echo ''; echo ''; - echo ''; - echo ''; + echo ''; echo ''; echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; if ($CFG->dbfamily == 'mysql' || $CFG->dbfamily == 'postgres') { echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; } echo ''; - echo ''; + echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; echo ''; @@ -390,19 +390,21 @@ function forum_menu_list($course) { $menu = array(); - if ($cms = get_coursemodules_in_course('forum', $course->id)) { - if ($course->format == 'weeks') { - $strsection = get_string('week'); - } else { - $strsection = get_string('topic'); - } + $modinfo = get_fast_modinfo($course); - foreach ($cms as $cm) { - if (!coursemodule_visible_for_user($cm)) { - continue; - } - $menu[$cm->instance] = format_string($cm->name,true); + if (empty($modinfo->instances['forum'])) { + return $menu; + } + + foreach ($modinfo->instances['forum'] as $cm) { + if (!$cm->uservisible) { + continue; + } + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + if (!has_capability('mod/forum:viewdiscussion', $context)) { + continue; } + $menu[$cm->instance] = format_string($cm->name); } return $menu; -- 2.39.5