course)) { error("Course is misconfigured"); } if (! $forum = get_record("forum", "id", $cm->instance)) { error("Forum ID was incorrect"); } $buttontext = update_module_button($cm->id, $course->id, $strforum); } else if ($f) { if (! $forum = get_record("forum", "id", $f)) { error("Forum ID was incorrect or no longer exists"); } if (! $course = get_record("course", "id", $forum->course)) { error("Forum is misconfigured - don't know what course it's from"); } if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) { $buttontext = update_module_button($cm->id, $course->id, $strforum); } else { $buttontext = ""; } } else { error("Must specify a course module or a forum ID"); } if (!$buttontext) { $buttontext = forum_print_search_form($course, $search, true, "plain"); } if ($course->category) { require_login($course->id); $navigation = "id\">$course->shortname -> id\">$strforums ->"; } else { $navigation = "id\">$strforums ->"; } if ($forum->type == "teacher") { if (!isteacher($course->id)) { error("You must be a $course->teacher to view this forum"); } } if ($cm) { add_to_log($course->id, "forum", "view forum", "view.php?id=$cm->id", "$forum->id"); } else { add_to_log($course->id, "forum", "view forum", "view.php?f=$forum->id", "$forum->id"); } print_header("$course->shortname: $forum->name", "$course->fullname", "$navigation $forum->name", "", "", true, $buttontext, navmenu($course, $cm)); if (!$cm->visible and !isteacher($course->id)) { notice(get_string("activityiscurrentlyhidden")); } /// Check to see if groups are being used in this forum /// and if so, set $currentgroup to reflect the current group $groupmode = groupmode($course, $cm); // Groups are being used $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']); if (!isteacheredit($course->id) and $groupmode and !$currentgroup) { print_heading("Sorry, but you need to be part of a group to see this forum."); print_footer(); exit; } /// Print settings and things in a table across the top echo '
';
echo '
| ';
}
}
if ($USER) {
echo '';
$SESSION->fromdiscussion = "$FULLME";
if (forum_is_forcesubscribed($forum->id)) {
$streveryoneissubscribed = get_string("everyoneissubscribed", "forum");
$strallowchoice = get_string("allowchoice", "forum");
helpbutton("subscription", $streveryoneissubscribed, "forum");
echo "";
if (isteacher($course->id)) {
echo "id&force=no\">$streveryoneissubscribed";
} else {
echo $streveryoneissubscribed;
}
echo "";
} else {
$streveryonecanchoose = get_string("everyonecanchoose", "forum");
$strforcesubscribe = get_string("forcesubscribe", "forum");
$strshowsubscribers = get_string("showsubscribers", "forum");
helpbutton("subscription", $streveryonecanchoose, "forum");
echo "";
if (isteacher($course->id)) {
echo "id&force=yes\">$streveryonecanchoose";
echo " "; echo "id\">$strshowsubscribers"; } else { echo $streveryonecanchoose; } echo ""; if (forum_is_subscribed($USER->id, $forum->id)) { $subtexttitle = get_string("subscribestop", "forum"); $subtext = get_string("unsubscribe", "forum"); } else { $subtexttitle = get_string("subscribestart", "forum"); $subtext = get_string("subscribe", "forum"); } echo " "; echo "id\">$subtext"; } echo ' | ';
}
echo '
'; if (forum_user_can_post_discussion($forum)) { print_string("allowsdiscussions", "forum"); } else { echo ' '; } echo '
'; if (!empty($showall)) { forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup); } else { forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup); } break; case 'teacher': if (!empty($showall)) { forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup); } else { forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup); } break; default: if (!empty($forum->intro)) { print_simple_box(text_to_html($forum->intro), 'center'); } echo ''; if (!empty($showall)) { forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup); } else { forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup); } break; } print_footer($course); ?>