/** * @todo Document this function * @global object * @global object * @return void */ function anonforum_print_posts_nested($course, &$cm, $anonforum, $discussion, $parent, $reply, $anonforumtracked, $posts) { global $USER, $CFG; $link = false; if (!empty($posts[$parent->id]->children)) { $posts = $posts[$parent->id]->children; foreach ($posts as $post) { echo '<div class="indent">'; if (!isloggedin()) { $ownpost = false; } else { $ownpost = $USER->id == $post->userid; } $post->subject = format_string($post->subject); $postread = !empty($post->postread); anonforum_print_post($post, $discussion, $anonforum, $cm, $course, $ownpost, $reply, $link, '', '', $postread, true, $anonforumtracked); anonforum_print_posts_nested($course, $cm, $anonforum, $discussion, $post, $reply, $anonforumtracked, $posts); echo "</div>\n"; } } }
$post->message = highlight($strippedsearch, format_text($post->message, $post->messageformat, $options, $course->id), 0, '<fgw9sdpq4>', '</fgw9sdpq4>'); foreach ($searchterms as $searchterm) { if (preg_match("/{$searchterm}/i", $post->message) && !preg_match('/<fgw9sdpq4>' . $searchterm . '<\\/fgw9sdpq4>/i', $post->message)) { $missing_terms .= " {$searchterm}"; } } $post->message = str_replace('<fgw9sdpq4>', '<span class="highlight">', $post->message); $post->message = str_replace('</fgw9sdpq4>', '</span>', $post->message); if ($missing_terms) { $strmissingsearchterms = get_string('missingsearchterms', 'anonforum'); $post->message = '<p class="highlight2">' . $strmissingsearchterms . ' ' . $missing_terms . '</p>' . $post->message; } // Prepare a link to the post in context, to be displayed after the anonymous forum post. $fulllink = "<a href=\"discuss.php?d={$post->discussion}#p{$post->id}\">" . get_string("postincontext", "anonforum") . "</a>"; // Now pring the post. anonforum_print_post($post, $discussion, $anonforum, $cm, $course, false, false, false, $fulllink, '', -99, false); } echo $OUTPUT->paging_bar($totalcount, $page, $perpage, $url); echo $OUTPUT->footer(); /** * @todo Document this function */ function anonforum_print_big_search_form($course) { global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto, $PAGE, $OUTPUT; echo $OUTPUT->box(get_string('searchanonforumintro', 'anonforum'), 'searchbox boxaligncenter', 'intro'); echo $OUTPUT->box_start('generalbox boxaligncenter'); echo html_writer::script('', $CFG->wwwroot . '/mod/anonforum/anonforum.js'); echo '<form id="searchform" action="search.php" method="get">'; echo '<table cellpadding="10" class="searchbox" id="form">'; echo '<tr>';
if ($post->parent != 0) { $postname = format_string($post->subject, true, array('context' => $cm->context)); if (!$isspecificcourse && !$hasparentaccess) { $fullsubjects[] .= html_writer::link(new moodle_url('/mod/anonforum/discuss.php', array('d' => $post->discussion, 'parent' => $post->id)), $postname); } else { $fullsubjects[] .= html_writer::tag('span', $postname); } } } $post->subject = join(' -> ', $fullsubjects); // This is really important, if the strings are formatted again all the links // we've added will be lost. $post->subjectnoformat = true; $discussionurl->set_anchor('p' . $post->id); $fulllink = html_writer::link($discussionurl, get_string("postincontext", "anonforum")); $postoutput[] = anonforum_print_post($post, $discussion, $anonforum, $cm, $course, false, false, false, $fulllink, '', null, true, null, true); } $userfullname = fullname($user); if ($discussionsonly) { $inpageheading = get_string('discussionsstartedby', 'mod_anonforum', $userfullname); } else { $inpageheading = get_string('postsmadebyuser', 'mod_anonforum', $userfullname); } if ($isspecificcourse) { $a = new stdClass(); $a->fullname = $userfullname; $a->coursename = format_string($course->shortname, true, array('context' => $coursecontext)); $pageheading = $a->coursename; if ($discussionsonly) { $pagetitle = get_string('discussionsstartedbyuserincourse', 'mod_anonforum', $a); } else {