本文整理汇总了PHP中forum_get_discussions_count函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_get_discussions_count函数的具体用法?PHP forum_get_discussions_count怎么用?PHP forum_get_discussions_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_get_discussions_count函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_print_latest_discussions
//.........这里部分代码省略.........
} else if (isguestuser() or !isloggedin() or $forum->type == 'news') {
// no button and no info
} else if ($groupmode and has_capability('mod/forum:startdiscussion', $context)) {
// inform users why they can not post new discussion
if ($currentgroup) {
echo $OUTPUT->notification(get_string('cannotadddiscussion', 'forum'));
} else {
echo $OUTPUT->notification(get_string('cannotadddiscussionall', 'forum'));
}
}
// Get all the recent discussions we're allowed to see
$getuserlastmodified = ($displayformat == 'header');
if (! $discussions = forum_get_discussions($cm, $sort, $fullpost, null, $maxdiscussions, $getuserlastmodified, $page, $perpage) ) {
echo '<div class="forumnodiscuss">';
if ($forum->type == 'news') {
echo '('.get_string('nonews', 'forum').')';
} else if ($forum->type == 'qanda') {
echo '('.get_string('noquestions','forum').')';
} else {
echo '('.get_string('nodiscussions', 'forum').')';
}
echo "</div>\n";
return;
}
// If we want paging
if ($page != -1) {
///Get the number of discussions found
$numdiscussions = forum_get_discussions_count($cm);
///Show the paging bar
echo $OUTPUT->paging_bar($numdiscussions, $page, $perpage, "view.php?f=$forum->id");
if ($numdiscussions > 1000) {
// saves some memory on sites with very large forums
$replies = forum_count_discussion_replies($forum->id, $sort, $maxdiscussions, $page, $perpage);
} else {
$replies = forum_count_discussion_replies($forum->id);
}
} else {
$replies = forum_count_discussion_replies($forum->id);
if ($maxdiscussions > 0 and $maxdiscussions <= count($discussions)) {
$olddiscussionlink = true;
}
}
$canviewparticipants = has_capability('moodle/course:viewparticipants',$context);
$strdatestring = get_string('strftimerecentfull');
// Check if the forum is tracked.
if ($cantrack = forum_tp_can_track_forums($forum)) {
$forumtracked = forum_tp_is_tracked($forum);
} else {
$forumtracked = false;
}
if ($forumtracked) {
$unreads = forum_get_discussions_unread($cm);
} else {
示例2: forum_print_latest_discussions
//.........这里部分代码省略.........
} else {
if (isguestuser() or !isloggedin() or $forum->type == 'news') {
// no button and no info
} else {
if ($groupmode and has_capability('mod/forum:startdiscussion', $context)) {
// inform users why they can not post new discussion
if ($currentgroup) {
notify(get_string('cannotadddiscussion', 'forum'));
} else {
notify(get_string('cannotadddiscussionall', 'forum'));
}
}
}
}
// Get all the recent discussions we're allowed to see
$getuserlastmodified = $displayformat == 'header';
if (!($discussions = forum_get_discussions($cm, $sort, $fullpost, null, $maxdiscussions, $getuserlastmodified, $page, $perpage))) {
echo '<div class="forumnodiscuss">';
if ($forum->type == 'news') {
echo '(' . get_string('nonews', 'forum') . ')';
} else {
if ($forum->type == 'qanda') {
echo '(' . get_string('noquestions', 'forum') . ')';
} else {
echo '(' . get_string('nodiscussions', 'forum') . ')';
}
}
echo "</div>\n";
return;
}
// If we want paging
if ($page != -1) {
///Get the number of discussions found
$numdiscussions = forum_get_discussions_count($cm);
///Show the paging bar
print_paging_bar($numdiscussions, $page, $perpage, "view.php?f={$forum->id}&");
if ($numdiscussions > 1000) {
// saves some memory on sites with very large forums
$replies = forum_count_discussion_replies($forum->id, $sort, $maxdiscussions, $page, $perpage);
} else {
$replies = forum_count_discussion_replies($forum->id);
}
} else {
$replies = forum_count_discussion_replies($forum->id);
if ($maxdiscussions > 0 and $maxdiscussions <= count($discussions)) {
$olddiscussionlink = true;
}
}
$canviewparticipants = has_capability('moodle/course:viewparticipants', $context);
$strdatestring = get_string('strftimerecentfull');
// Check if the forum is tracked.
if ($cantrack = forum_tp_can_track_forums($forum)) {
$forumtracked = forum_tp_is_tracked($forum);
} else {
$forumtracked = false;
}
if ($forumtracked) {
$unreads = forum_get_discussions_unread($cm);
} else {
$unreads = array();
}
if ($displayformat == 'header') {
echo '<table cellspacing="0" class="forumheaderlist">';
echo '<thead>';
echo '<tr>';
echo '<th class="header topic" scope="col">' . get_string('discussion', 'forum') . '</th>';