Example #1
0
$strsearchresults = get_string("searchresults", "twf");
$strpage = get_string("page");
if (!$search || $showform) {
    $PAGE->navbar->add($strtwfs, new moodle_url('/mod/twf/index.php', array('id' => $course->id)));
    $PAGE->navbar->add(get_string('advancedsearch', 'twf'));
    $PAGE->set_title($strsearch);
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();
    twf_print_big_search_form($course);
    echo $OUTPUT->footer();
    exit;
}
/// We need to do a search now and print results
$searchterms = str_replace('twfid:', 'instance:', $search);
$searchterms = explode(' ', $searchterms);
$searchform = twf_search_form($course, $search);
$PAGE->navbar->add($strsearch, new moodle_url('/mod/twf/search.php', array('id' => $course->id)));
$PAGE->navbar->add($strsearchresults);
if (!($posts = twf_search_posts($searchterms, $course->id, $page * $perpage, $perpage, $totalcount))) {
    $PAGE->set_title($strsearchresults);
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($strtwfs, 2);
    echo $OUTPUT->heading($strsearchresults, 3);
    echo $OUTPUT->heading(get_string("noposts", "twf"), 4);
    if (!$individualparams) {
        $words = $search;
    }
    twf_print_big_search_form($course);
    echo $OUTPUT->footer();
    exit;
Example #2
0
    print_error("notexists", 'twf', "{$CFG->wwwroot}/mod/twf/view.php?f={$twf->id}");
}
if (!twf_user_can_see_post($twf, $discussion, $post, null, $cm)) {
    print_error('noviewdiscussionspermission', 'twf', "{$CFG->wwwroot}/mod/twf/view.php?id={$twf->id}");
}
if ($mark == 'read' or $mark == 'unread') {
    if ($CFG->twf_usermarksread && twf_tp_can_track_twfs($twf) && twf_tp_is_tracked($twf)) {
        if ($mark == 'read') {
            twf_tp_add_read_record($USER->id, $postid);
        } else {
            // unread
            twf_tp_delete_read_records($USER->id, $postid);
        }
    }
}
$searchform = twf_search_form($course);
$twfnode = $PAGE->navigation->find($cm->id, navigation_node::TYPE_ACTIVITY);
if (empty($twfnode)) {
    $twfnode = $PAGE->navbar;
} else {
    $twfnode->make_active();
}
$node = $twfnode->add(format_string($discussion->name), new moodle_url('/mod/twf/discuss.php', array('d' => $discussion->id)));
$node->display = false;
if ($node && $post->id != $discussion->firstpost) {
    $node->add(format_string($post->subject), $PAGE->url);
}
$PAGE->set_title("{$course->shortname}: " . format_string($discussion->name));
$PAGE->set_heading($course->fullname);
$PAGE->set_button($searchform);
$renderer = $PAGE->get_renderer('mod_twf');
Example #3
0
            print_error('coursemisconf');
        }
        if (!($cm = get_coursemodule_from_instance("twf", $twf->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);
        $strtwfs = get_string("modulenameplural", "twf");
        $strtwf = get_string("modulename", "twf");
    } else {
        print_error('missingparameter');
    }
}
if (!$PAGE->button) {
    $PAGE->set_button(twf_search_form($course, $search));
}
$context = context_module::instance($cm->id);
$PAGE->set_context($context);
if (!empty($CFG->enablerssfeeds) && !empty($CFG->twf_enablerssfeeds) && $twf->rsstype && $twf->rssarticles) {
    require_once "{$CFG->libdir}/rsslib.php";
    $rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($twf->name);
    rss_add_http_header($context, 'mod_twf', $twf, $rsstitle);
}
/// Print header.
$PAGE->set_title($twf->name);
$PAGE->add_body_class('twftype-' . $twf->type);
$PAGE->set_heading($course->fullname);
/// Some capability checks.
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
    notice(get_string("activityiscurrentlyhidden"));