本文整理汇总了PHP中forum_print_post函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_print_post函数的具体用法?PHP forum_print_post怎么用?PHP forum_print_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_print_post函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_check_throttling
if ($forum->type == 'qanda' && !has_capability('mod/forum:viewqandawithoutposting', $modcontext) && !empty($discussion->id) && !forum_user_has_posted($forum->id, $discussion->id, $USER->id)) {
echo $OUTPUT->notification(get_string('qandanotify', 'forum'));
}
forum_check_throttling($forum, $cm);
if (!empty($parent)) {
if (!($discussion = $DB->get_record('forum_discussions', array('id' => $parent->discussion)))) {
print_error('notpartofdiscussion', 'forum');
}
// #marginalia begin
$moodlemia = moodle_marginalia::get_instance();
$miaprofile = $moodlemia->get_profile($PAGE->url->out(false));
if ($miaprofile) {
$miaprofile->emit_body();
$miaprofile->emit_margin_controls();
}
// #marginalia end
forum_print_post($parent, $discussion, $forum, $cm, $course, false, false, false);
if (empty($post->edit)) {
if ($forum->type != 'qanda' || forum_user_can_see_discussion($forum, $discussion, $modcontext)) {
$forumtracked = forum_tp_is_tracked($forum);
$posts = forum_get_all_discussion_posts($discussion->id, "created ASC", $forumtracked);
forum_print_posts_threaded($course, $cm, $forum, $discussion, $parent, 0, false, $forumtracked, $posts);
}
}
} else {
if (!empty($forum->intro)) {
echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
}
}
$mform_post->display();
echo $OUTPUT->footer();
示例2: forum_print_posts_nested
/**
* @todo Document this function
* @global object
* @global object
* @return void
*/
function forum_print_posts_nested($course, &$cm, $forum, $discussion, $parent, $reply, $forumtracked, $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);
forum_print_post($post, $discussion, $forum, $cm, $course, $ownpost, $reply, $link,
'', '', $postread, true, $forumtracked);
forum_print_posts_nested($course, $cm, $forum, $discussion, $post, $reply, $forumtracked, $posts);
echo "</div>\n";
}
}
}
示例3: unset
}
$cms[$forum->id] = $cm;
unset($cm);
// do not use cm directly, it would break caching
}
$fullsubject = "<a href=\"view.php?f={$forum->id}\">" . format_string($forum->name, true) . "</a>";
if ($forum->type != 'single') {
$fullsubject .= " -> <a href=\"discuss.php?d={$discussion->id}\">" . format_string($discussion->name, true) . "</a>";
if ($post->parent != 0) {
$fullsubject .= " -> <a href=\"discuss.php?d={$post->discussion}&parent={$post->id}\">" . format_string($post->subject, true) . "</a>";
}
}
if ($course->id == SITEID && has_capability('moodle/site:config', $syscontext)) {
$postcoursename = get_field('course', 'shortname', 'id', $forum->course);
$fullsubject = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $forum->course . '">' . $postcoursename . '</a> -> ' . $fullsubject;
}
$post->subject = $fullsubject;
$fulllink = "<a href=\"discuss.php?d={$post->discussion}#p{$post->id}\">" . get_string("postincontext", "forum") . "</a>";
forum_print_post($post, $discussion, $forum, $cms[$forum->id], $course, false, false, false, $ratings, $fulllink);
echo "<br />";
}
print_paging_bar($totalcount, $page, $perpage, "user.php?id={$user->id}&course={$course->id}&mode={$mode}&perpage={$perpage}&");
} else {
if ($mode == 'posts') {
print_heading(get_string('noposts', 'forum'));
} else {
print_heading(get_string('nodiscussionsstartedby', 'forum'));
}
}
echo '</div>';
print_footer($course);
示例4: print_header
} else {
print_header("{$course->shortname}: {$strdiscussionname} " . format_string($toppost->subject), $course->fullname, "{$navmiddle} {$navtail}", $mform_post->focus($forcefocus), "", true, "", navmenu($course, $cm));
}
// checkup
if (!empty($parent) && !forum_user_can_see_post($forum, $discussion, $post)) {
error("You cannot reply to this post");
}
if (empty($parent) && empty($edit) && !forum_user_can_post_discussion($forum)) {
error("You cannot start a new discussion in this forum");
}
if ($forum->type == 'qanda' && !has_capability('mod/forum:viewqandawithoutposting', $modcontext) && !empty($discussion->id) && !forum_user_has_posted($forum->id, $discussion->id, $USER->id)) {
notify(get_string('qandanotify', 'forum'));
}
forum_check_throttling($forum);
if (!empty($parent)) {
forum_print_post($parent, $course->id, $ownpost = false, $reply = false, $link = false);
if (empty($post->edit)) {
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
$user_read_array = forum_tp_get_discussion_read_records($USER->id, $discussion->id);
} else {
$user_read_array = array();
}
if ($forum->type != 'qanda' || forum_user_can_see_discussion($forum, $discussion, $modcontext)) {
forum_print_posts_threaded($parent->id, $course->id, 0, false, false, $user_read_array, $discussion->forum, $modcontext);
}
}
$heading = get_string("yourreply", "forum");
} else {
$forum->intro = trim($forum->intro);
if (!empty($forum->intro)) {
print_box(format_text($forum->intro), 'generalbox', 'intro');
示例5: highlight
$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', 'forum');
$post->message = '<p class="highlight2">' . $strmissingsearchterms . ' ' . $missing_terms . '</p>' . $post->message;
}
// Prepare a link to the post in context, to be displayed after the forum post.
$fulllink = "<a href=\"discuss.php?d={$post->discussion}#p{$post->id}\">" . get_string("postincontext", "forum") . "</a>";
// Now pring the post.
forum_print_post($post, $discussion, $forum, $cm, $course, false, false, false, $fulllink, '', -99, false);
}
echo $OUTPUT->paging_bar($totalcount, $page, $perpage, $url);
echo $OUTPUT->footer();
/**
* @todo Document this function
*/
function forum_print_big_search_form($course)
{
global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto, $PAGE, $OUTPUT;
echo $OUTPUT->box(get_string('searchforumintro', 'forum'), 'searchbox boxaligncenter', 'intro');
echo $OUTPUT->box_start('generalbox boxaligncenter');
echo html_writer::script('', $CFG->wwwroot . '/mod/forum/forum.js');
echo '<form id="searchform" action="search.php" method="get">';
echo '<table cellpadding="10" class="searchbox" id="form">';
echo '<tr>';
示例6: format_string
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/forum/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", "forum"));
$postoutput[] = forum_print_post($post, $discussion, $forum, $cm, $course, false, false, false, $fulllink, '', null, true, null, true);
}
$userfullname = fullname($user);
if ($discussionsonly) {
$inpageheading = get_string('discussionsstartedby', 'mod_forum', $userfullname);
} else {
$inpageheading = get_string('postsmadebyuser', 'mod_forum', $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_forum', $a);
} else {
示例7: object
$options = new object();
$options->trusted = $post->messagetrust;
$message = highlight($strippedsearch, format_text($post->message, $post->messageformat, $options, $course->id), 0, '<fgw9sdpq4>', '</fgw9sdpq4>');
foreach ($searchterms as $searchterm) {
if (preg_match("/{$searchterm}/i", $message) && !preg_match('/<fgw9sdpq4>' . $searchterm . '<\\/fgw9sdpq4>/i', $message)) {
$missing_terms .= " {$searchterm}";
}
}
if ($missing_terms) {
$strmissingsearchterms = get_string('missingsearchterms', 'forum');
$post->message = '<p class="highlight2">' . $strmissingsearchterms . ' ' . $missing_terms . '</p>' . $post->message;
}
// Prepare a link to the post in context, to be displayed after the forum post.
$fulllink = "<a href=\"discuss.php?d={$post->discussion}#p{$post->id}\">" . get_string("postincontext", "forum") . "</a>";
// Now pring the post.
forum_print_post($post, $discussion, $forum, $cm, $course, false, false, false, false, $fulllink, $strippedsearch, -99, false);
}
print_paging_bar($totalcount, $page, $perpage, "search.php?search=" . urlencode($search) . "&id={$course->id}&perpage={$perpage}&");
print_footer($course);
/**
* @todo Document this function
*/
function forum_print_big_search_form($course)
{
global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto;
print_simple_box(get_string('searchforumintro', 'forum'), 'center', '', '', 'searchbox', 'intro');
print_simple_box_start("center");
echo "<script type=\"text/javascript\">\n";
echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n";
echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
echo "</script>\n";
示例8: oc_forum_print_latest_discussions
//.........这里部分代码省略.........
if (has_capability('mod/forum:viewdiscussion', $context)) {
echo '<th class="header replies" scope="col">' . get_string('replies', 'forum') . '</th>';
// If the forum can be tracked, display the unread column.
if ($cantrack) {
echo '<th class="header replies" scope="col">' . get_string('unread', 'forum');
if ($forumtracked) {
echo '<a title="' . get_string('markallread', 'forum') . '" href="' . $CFG->wwwroot . '/mod/forum/markposts.php?f=' . $forum->id . '&mark=read&returnpage=view.php">' . '<img src="' . $OUTPUT->pix_url('t/markasread') . '" class="iconsmall" alt="' . get_string('markallread', 'forum') . '" /></a>';
}
echo '</th>';
}
}
echo '<th class="header lastpost" scope="col">' . get_string('lastpost', 'forum') . '</th>';
if (!is_guest($context, $USER) && isloggedin() && has_capability('mod/forum:viewdiscussion', $context)) {
if (\mod_forum\subscriptions::is_subscribable($forum)) {
echo '<th class="header discussionsubscription" scope="col">';
echo forum_get_discussion_subscription_icon_preloaders();
echo '</th>';
}
}
echo '</tr>';
echo '</thead>';
echo '<tbody>';
}
foreach ($discussions as $discussion) {
if ($forum->type == 'qanda' && !has_capability('mod/forum:viewqandawithoutposting', $context) && !forum_user_has_posted($forum->id, $discussion->discussion, $USER->id)) {
$canviewparticipants = false;
}
if (!empty($replies[$discussion->discussion])) {
$discussion->replies = $replies[$discussion->discussion]->replies;
$discussion->lastpostid = $replies[$discussion->discussion]->lastpostid;
} else {
$discussion->replies = 0;
}
// SPECIAL CASE: The front page can display a news item post to non-logged in users.
// All posts are read in this case.
if (!$forumtracked) {
$discussion->unread = '-';
} else {
if (empty($USER)) {
$discussion->unread = 0;
} else {
if (empty($unreads[$discussion->discussion])) {
$discussion->unread = 0;
} else {
$discussion->unread = $unreads[$discussion->discussion];
}
}
}
if (isloggedin()) {
$ownpost = $discussion->userid == $USER->id;
} else {
$ownpost = false;
}
// Use discussion name instead of subject of first post
$discussion->subject = $discussion->name;
switch ($displayformat) {
case 'header':
if ($groupmode > 0) {
if (isset($groups[$discussion->groupid])) {
$group = $groups[$discussion->groupid];
} else {
$group = $groups[$discussion->groupid] = groups_get_group($discussion->groupid);
}
} else {
$group = -1;
}
forum_print_discussion_header($discussion, $forum, $group, $strdatestring, $cantrack, $forumtracked, $canviewparticipants, $context);
break;
default:
$link = false;
if ($discussion->replies) {
$link = true;
} else {
$modcontext = context_module::instance($cm->id);
$link = forum_user_can_see_discussion($forum, $discussion, $modcontext, $USER);
}
$discussion->forum = $forum->id;
forum_print_post($discussion, $discussion, $forum, $cm, $course, $ownpost, 0, $link, false, '', null, true, $forumtracked);
break;
}
}
if ($displayformat == "header") {
echo '</tbody>';
echo '</table>';
}
if ($olddiscussionlink) {
if ($forum->type == 'news') {
$strolder = get_string('oldertopics', 'forum');
} else {
$strolder = get_string('olderdiscussions', 'forum');
}
echo '<div class="forumolddiscuss">';
echo '<a href="' . $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id . '&showall=1">';
echo $strolder . '</a> ...</div>';
}
if ($page != -1) {
///Show the paging bar
echo $OUTPUT->paging_bar($numdiscussions, $page, $perpage, "view.php?f={$forum->id}");
}
}
示例9: get_string
$post->message = '<p class="highlight2">' . $strmissingsearchterms . ' ' . $missing_terms . '</p>' . $message;
$ttpresent = false;
} else {
$post->message = $message;
}
$fulllink = "<a href=\"discuss.php?d={$post->discussion}#p{$post->id}\">" . get_string("postincontext", "forum") . "</a>";
//search terms already highlighted - fiedorow - 9/2/2005
$SESSION->forum_search = true;
// reconstruct the TRUSTTEXT properly after processing
if ($ttpresent) {
$post->message = trusttext_mark($post->message);
} else {
$post->message = trusttext_strip($post->message);
//make 100% sure TRUSTTEXT marker was not created during processing
}
forum_print_post($post, $course->id, false, false, false, false, $fulllink);
unset($SESSION->forum_search);
echo "<br />";
}
print_paging_bar($totalcount, $page, $perpage, "search.php?search=" . urlencode(stripslashes($search)) . "&id={$course->id}&perpage={$perpage}&");
print_footer($course);
/**
* @todo Document this function
*/
function forum_print_big_search_form($course)
{
global $CFG, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto;
print_simple_box(get_string('searchforumintro', 'forum'), 'center', '', '', 'searchbox', 'intro');
print_simple_box_start("center");
echo "<script type=\"text/javascript\">\n";
echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n";
示例10: object
$options = new object();
$options->trusttext = true;
$message = highlight($strippedsearch, format_text($post->message, $post->format, $options, $course->id), 0, '<fgw9sdpq4>', '</fgw9sdpq4>');
foreach ($searchterms as $searchterm) {
if (preg_match("/{$searchterm}/i", $message) && !preg_match('/<fgw9sdpq4>' . $searchterm . '<\\/fgw9sdpq4>/i', $message)) {
$missing_terms .= " {$searchterm}";
}
}
if ($missing_terms) {
$strmissingsearchterms = get_string('missingsearchterms', 'forum');
$post->message = '<p class="highlight2">' . $strmissingsearchterms . ' ' . $missing_terms . '</p>' . $post->message;
}
// Prepare a link to the post in context, to be displayed after the forum post.
$fulllink = "<a href=\"discuss.php?d={$post->discussion}#p{$post->id}\">" . get_string("postincontext", "forum") . "</a>";
// Now pring the post.
forum_print_post($post, $course->id, false, false, false, false, $fulllink, $strippedsearch, -99, false);
}
print_paging_bar($totalcount, $page, $perpage, "search.php?search=" . urlencode(stripslashes($search)) . "&id={$course->id}&perpage={$perpage}&");
print_footer($course);
/**
* @todo Document this function
*/
function forum_print_big_search_form($course)
{
global $CFG, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto;
print_simple_box(get_string('searchforumintro', 'forum'), 'center', '', '', 'searchbox', 'intro');
print_simple_box_start("center");
echo "<script type=\"text/javascript\">\n";
echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n";
echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
echo "</script>\n";
示例11: forum_print_posts_nested
function forum_print_posts_nested($course, &$cm, $forum, $discussion, $parent, $reply, $forumtracked, $posts, $parentid = 0, $count = 1, $flag = 0)
{
global $USER, $CFG, $DB;
$link = false;
$modcontext = context_module::instance($cm->id);
if (!empty($posts[$parent->id]->children)) {
$posts = $posts[$parent->id]->children;
foreach ($posts as $post) {
if ((show_discussion($parentid, $forum) and $post->userid != $USER->id and !$flag) && !has_capability('mod/forum:editanypost', $modcontext)) {
continue;
} else {
$flag = 1;
}
echo '<div class="indent">';
if (!isloggedin()) {
$ownpost = false;
} else {
$ownpost = $USER->id == $post->userid;
}
$post->subject = format_string($post->subject);
$postread = !empty($post->postread);
if ($forum->type == 'collaborate' and $post->parent == $parentid) {
$regionid = 'forum-questionview' . $count;
print_collapsible_region_start('', $regionid, get_string('questionview', 'forum'));
forum_print_post($post, $discussion, $forum, $cm, $course, $ownpost, $reply, false, '', '', $postread, true, $forumtracked, false, $parentid);
} else {
forum_print_post($post, $discussion, $forum, $cm, $course, $ownpost, $reply, false, '', '', $postread, true, $forumtracked, false, $parentid);
}
if ($forum->type == 'collaborate') {
$n = $DB->count_records('forum_posts', array('parent' => $post->id));
if ($n == 0) {
print_collapsible_region_end();
}
}
forum_print_posts_nested($course, $cm, $forum, $discussion, $post, $reply, $forumtracked, $posts, $parentid, $count + 1, $flag);
$flag = 0;
echo "</div>\n";
$count = $count + 1;
}
}
}
示例12: array
}
$fullsubjects = array();
if ($course->id == SITEID && has_capability('moodle/site:config', $syscontext)) {
$postcoursename = $DB->get_field('course', 'shortname', array('id' => $forum->course));
$courseurl = new moodle_url('/course/view.php', array('id' => $forum->course));
$fullsubjects[] = html_writer::link($courseurl, $postcoursename);
}
$fullsubjects[] = html_writer::link($forumurl, format_string($forum->name, true));
if ($forum->type != 'single') {
$fullsubjects[] .= html_writer::link($discussionurl, format_string($discussion->name, true));
if ($post->parent != 0) {
$parenturl = new moodle_url('/mod/forum/discuss.php', array('d' => $post->discussion, 'parent' => $post->id));
$fullsubjects[] .= html_writer::link($parenturl, format_string($post->subject, true));
}
}
$post->subject = join(' -> ', $fullsubjects);
$discussionurl->set_anchor('p' . $post->id);
$fulllink = html_writer::link($discussionurl, get_string("postincontext", "forum"));
forum_print_post($post, $discussion, $forum, $forum->cm, $course, false, false, false, $fulllink);
echo "<br />";
}
echo $OUTPUT->paging_bar($totalcount, $page, $perpage, $baseurl);
} else {
if ($mode == 'posts') {
echo $OUTPUT->heading(get_string('noposts', 'forum'));
} else {
echo $OUTPUT->heading(get_string('nodiscussionsstartedby', 'forum'));
}
}
echo '</div>';
echo $OUTPUT->footer();