Ejemplo n.º 1
0
        $strforums = get_string("modulenameplural", "forum");
        $strforum = get_string("modulename", "forum");
        if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
            $buttontext = update_module_button($cm->id, $course->id, $strforum);
        } else {
            $cm->id = 0;
            $cm->visible = 1;
            $cm->course = $course->id;
            $buttontext = "";
        }
    } else {
        error('Must specify a course module or a forum ID');
    }
}
if (!$buttontext) {
    $buttontext = forum_search_form($course, $search);
}
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// Print header.
$navigation = build_navigation('', $cm);
print_header_simple(format_string($forum->name), "", $navigation, "", "", true, $buttontext, user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
/// Some capability checks.
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
    notice(get_string("activityiscurrentlyhidden"));
}
if (!has_capability('mod/forum:viewdiscussion', $context)) {
    notice(get_string('noviewdiscussionspermission', 'forum'));
}
/// find out current groups mode
groups_print_activity_menu($cm, 'view.php?id=' . $cm->id);
Ejemplo n.º 2
0
        }

        if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
            print_error('missingparameter');
        }
        // move require_course_login here to use forced language for course
        // fix for MDL-6926
        require_course_login($course, true, $cm);
        $strforums = get_string("modulenameplural", "forum");
        $strforum = get_string("modulename", "forum");
    } else {
        print_error('missingparameter');
    }

    if (!$PAGE->button) {
        $PAGE->set_button(forum_search_form($course, $search));
    }

    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $PAGE->set_context($context);

    if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
        require_once("$CFG->libdir/rsslib.php");

        $rsstitle = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))) . ': ' . format_string($forum->name);
        rss_add_http_header($context, 'mod_forum', $forum, $rsstitle);
    }

    // Mark viewed if required
    $completion = new completion_info($course);
    $completion->set_module_viewed($cm);
Ejemplo n.º 3
0
$strforum = get_string('forum', 'forum');
$strdescription = get_string('description');
$strdiscussions = get_string('discussions', 'forum');
$strsubscribed = get_string('subscribed', 'forum');
$strunreadposts = get_string('unreadposts', 'forum');
$strtracking = get_string('tracking', 'forum');
$strmarkallread = get_string('markallread', 'forum');
$strtrackforum = get_string('trackforum', 'forum');
$strnotrackforum = get_string('notrackforum', 'forum');
$strsubscribe = get_string('subscribe', 'forum');
$strunsubscribe = get_string('unsubscribe', 'forum');
$stryes = get_string('yes');
$strno = get_string('no');
$strrss = get_string('rss');
$stremaildigest = get_string('emaildigest');
$searchform = forum_search_form($course);
// Retrieve the list of forum digest options for later.
$digestoptions = forum_get_user_digest_options();
$digestoptions_selector = new single_select(new moodle_url('/mod/forum/maildigest.php', array('backtoindex' => 1)), 'maildigest', $digestoptions, null, '');
$digestoptions_selector->method = 'post';
// Start of the table for General Forums
$generaltable = new html_table();
$generaltable->head = array($strforum, $strdescription, $strdiscussions);
$generaltable->align = array('left', 'left', 'center');
if ($usetracking = forum_tp_can_track_forums()) {
    $untracked = forum_tp_get_untracked_forums($USER->id, $course->id);
    $generaltable->head[] = $strunreadposts;
    $generaltable->align[] = 'center';
    $generaltable->head[] = $strtracking;
    $generaltable->align[] = 'center';
}
Ejemplo n.º 4
0
        break;
    case 'teacher':
        if (!empty($showall)) {
            forum_print_latest_discussions($course, $forum, 0, 'header', '', -1, -1, -1, 0, $cm);
        } else {
            forum_print_latest_discussions($course, $forum, -1, 'header', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
        }
        break;
    case 'blog':
        echo '<br />';
        if (!empty($showall)) {
            forum_print_latest_discussions($course, $forum, 0, 'plain', '', -1, -1, -1, 0, $cm);
        } else {
            forum_print_latest_discussions($course, $forum, -1, 'plain', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
        }
        break;
    default:
        echo '<br />';
        if (!empty($showall)) {
            forum_print_latest_discussions($course, $forum, 0, 'header', '', -1, -1, -1, 0, $cm);
        } else {
            forum_print_latest_discussions($course, $forum, -1, 'header', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
        }
        break;
}
// Local eClass modification LMS-349.
// Search at bottom of centre column instead of in place of edit button.
echo forum_search_form($course, $search);
// Add the subscription toggle JS.
$PAGE->requires->yui_module('moodle-mod_forum-subscriptiontoggle', 'Y.M.mod_forum.subscriptiontoggle.init');
echo $OUTPUT->footer($course);