本文整理汇总了PHP中forum_get_discussions_unread函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_get_discussions_unread函数的具体用法?PHP forum_get_discussions_unread怎么用?PHP forum_get_discussions_unread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_get_discussions_unread函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: forum_print_latest_discussions
//.........这里部分代码省略.........
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 {
$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>';
echo '<th class="header author" colspan="2" scope="col">'.get_string('startedby', 'forum').'</th>';
if ($groupmode > 0) {
echo '<th class="header group" scope="col">'.get_string('group').'</th>';
}
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>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:67,代码来源:lib.php
示例2: get_forum_discussions
/**
* Returns a list of forum discussions as well as a summary of the discussion
* in a provided list of forums.
*
* @param array $forumids the forum ids
* @param int $limitfrom limit from SQL data
* @param int $limitnum limit number SQL data
*
* @return array the forum discussion details
* @since Moodle 2.5
*/
public static function get_forum_discussions($forumids, $limitfrom = 0, $limitnum = 0)
{
global $CFG, $DB, $USER;
require_once $CFG->dirroot . "/mod/forum/lib.php";
// Validate the parameter.
$params = self::validate_parameters(self::get_forum_discussions_parameters(), array('forumids' => $forumids, 'limitfrom' => $limitfrom, 'limitnum' => $limitnum));
$forumids = $params['forumids'];
$limitfrom = $params['limitfrom'];
$limitnum = $params['limitnum'];
// Array to store the forum discussions to return.
$arrdiscussions = array();
// Keep track of the users we have looked up in the DB.
$arrusers = array();
// Loop through them.
foreach ($forumids as $id) {
// Get the forum object.
$forum = $DB->get_record('forum', array('id' => $id), '*', MUST_EXIST);
$course = get_course($forum->course);
$modinfo = get_fast_modinfo($course);
$forums = $modinfo->get_instances_of('forum');
$cm = $forums[$forum->id];
// Get the module context.
$modcontext = context_module::instance($cm->id);
// Validate the context.
self::validate_context($modcontext);
require_capability('mod/forum:viewdiscussion', $modcontext);
// Get the discussions for this forum.
$params = array();
$groupselect = "";
$groupmode = groups_get_activity_groupmode($cm, $course);
if ($groupmode and $groupmode != VISIBLEGROUPS and !has_capability('moodle/site:accessallgroups', $modcontext)) {
// Get all the discussions from all the groups this user belongs to.
$usergroups = groups_get_user_groups($course->id);
if (!empty($usergroups['0'])) {
list($sql, $params) = $DB->get_in_or_equal($usergroups['0']);
$groupselect = "AND (groupid {$sql} OR groupid = -1)";
}
}
array_unshift($params, $id);
$select = "forum = ? {$groupselect}";
if ($discussions = $DB->get_records_select('forum_discussions', $select, $params, 'timemodified DESC', '*', $limitfrom, $limitnum)) {
// Check if they can view full names.
$canviewfullname = has_capability('moodle/site:viewfullnames', $modcontext);
// Get the unreads array, this takes a forum id and returns data for all discussions.
$unreads = array();
if ($cantrack = forum_tp_can_track_forums($forum)) {
if ($forumtracked = forum_tp_is_tracked($forum)) {
$unreads = forum_get_discussions_unread($cm);
}
}
// The forum function returns the replies for all the discussions in a given forum.
$replies = forum_count_discussion_replies($id);
foreach ($discussions as $discussion) {
// This function checks capabilities, timed discussions, groups and qanda forums posting.
if (!forum_user_can_see_discussion($forum, $discussion, $modcontext)) {
continue;
}
$usernamefields = user_picture::fields();
// If we don't have the users details then perform DB call.
if (empty($arrusers[$discussion->userid])) {
$arrusers[$discussion->userid] = $DB->get_record('user', array('id' => $discussion->userid), $usernamefields, MUST_EXIST);
}
// Get the subject.
$subject = $DB->get_field('forum_posts', 'subject', array('id' => $discussion->firstpost), MUST_EXIST);
// Create object to return.
$return = new stdClass();
$return->id = (int) $discussion->id;
$return->course = $discussion->course;
$return->forum = $discussion->forum;
$return->name = $discussion->name;
$return->userid = $discussion->userid;
$return->groupid = $discussion->groupid;
$return->assessed = $discussion->assessed;
$return->timemodified = (int) $discussion->timemodified;
$return->usermodified = $discussion->usermodified;
$return->timestart = $discussion->timestart;
$return->timeend = $discussion->timeend;
$return->firstpost = (int) $discussion->firstpost;
$return->firstuserfullname = fullname($arrusers[$discussion->userid], $canviewfullname);
$return->firstuserimagealt = $arrusers[$discussion->userid]->imagealt;
$return->firstuserpicture = $arrusers[$discussion->userid]->picture;
$return->firstuseremail = $arrusers[$discussion->userid]->email;
$return->subject = $subject;
$return->numunread = '';
if ($cantrack && $forumtracked) {
if (isset($unreads[$discussion->id])) {
$return->numunread = (int) $unreads[$discussion->id];
}
}
//.........这里部分代码省略.........
开发者ID:educacionbe,项目名称:cursos,代码行数:101,代码来源:externallib.php
示例3: get_forum_discussions
/**
* Returns a list of forum discussions as well as a summary of the discussion
* in a provided list of forums.
*
* @param array $forumids the forum ids
* @return array the forum discussion details
* @since Moodle 2.5
*/
public static function get_forum_discussions($forumids) {
global $CFG, $DB, $USER;
require_once($CFG->dirroot . "/mod/forum/lib.php");
// Validate the parameter.
$params = self::validate_parameters(self::get_forum_discussions_parameters(), array('forumids' => $forumids));
$forumids = $params['forumids'];
// Array to store the forum discussions to return.
$arrdiscussions = array();
// Keep track of the course ids we have performed a require_course_login check on to avoid repeating.
$arrcourseschecked = array();
// Store the modinfo for the forums in an individual courses.
$arrcoursesforuminfo = array();
// Keep track of the users we have looked up in the DB.
$arrusers = array();
// Loop through them.
foreach ($forumids as $id) {
// Get the forum object.
$forum = $DB->get_record('forum', array('id' => $id), '*', MUST_EXIST);
// Check that that user can view this course if check not performed yet.
if (!in_array($forum->course, $arrcourseschecked)) {
// Check the user can function in this context.
self::validate_context(context_course::instance($forum->course));
// Add to the array.
$arrcourseschecked[] = $forum->course;
}
// Get the modinfo for the course if we haven't already.
if (!isset($arrcoursesforuminfo[$forum->course])) {
$modinfo = get_fast_modinfo($forum->course);
$arrcoursesforuminfo[$forum->course] = $modinfo->get_instances_of('forum');
}
// Check if this forum does not exist in the modinfo array, should always be false unless DB is borked.
if (empty($arrcoursesforuminfo[$forum->course][$forum->id])) {
throw new moodle_exception('invalidmodule', 'error');
}
// We now have the course module.
$cm = $arrcoursesforuminfo[$forum->course][$forum->id];
// If the forum is not visible throw an exception.
if (!$cm->uservisible) {
throw new moodle_exception('nopermissiontoshow', 'error');
}
// Get the module context.
$modcontext = context_module::instance($cm->id);
// Check they have the view forum capability.
require_capability('mod/forum:viewdiscussion', $modcontext);
// Check if they can view full names.
$canviewfullname = has_capability('moodle/site:viewfullnames', $modcontext);
// Get the unreads array, this takes a forum id and returns data for all discussions.
$unreads = array();
if ($cantrack = forum_tp_can_track_forums($forum)) {
if ($forumtracked = forum_tp_is_tracked($forum)) {
$unreads = forum_get_discussions_unread($cm);
}
}
// The forum function returns the replies for all the discussions in a given forum.
$replies = forum_count_discussion_replies($id);
// Get the discussions for this forum.
if ($discussions = $DB->get_records('forum_discussions', array('forum' => $id))) {
foreach ($discussions as $discussion) {
// If the forum is of type qanda and the user has not posted in the discussion
// we need to ensure that they have the required capability.
if ($forum->type == 'qanda' && !forum_user_has_posted($discussion->forum, $discussion->id, $USER->id)) {
require_capability('mod/forum:viewqandawithoutposting', $modcontext);
}
// If we don't have the users details then perform DB call.
if (empty($arrusers[$discussion->userid])) {
$arrusers[$discussion->userid] = $DB->get_record('user', array('id' => $discussion->userid),
'firstname, lastname, email, picture, imagealt', MUST_EXIST);
}
// Get the subject.
$subject = $DB->get_field('forum_posts', 'subject', array('id' => $discussion->firstpost), MUST_EXIST);
// Create object to return.
$return = new stdClass();
$return->id = (int) $discussion->id;
$return->course = $discussion->course;
$return->forum = $discussion->forum;
$return->name = $discussion->name;
$return->userid = $discussion->userid;
$return->groupid = $discussion->groupid;
$return->assessed = $discussion->assessed;
$return->timemodified = (int) $discussion->timemodified;
$return->usermodified = $discussion->usermodified;
$return->timestart = $discussion->timestart;
$return->timeend = $discussion->timeend;
$return->firstpost = (int) $discussion->firstpost;
$return->firstuserfullname = fullname($arrusers[$discussion->userid], $canviewfullname);
$return->firstuserimagealt = $arrusers[$discussion->userid]->imagealt;
$return->firstuserpicture = $arrusers[$discussion->userid]->picture;
$return->firstuseremail = $arrusers[$discussion->userid]->email;
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:externallib.php
示例4: get_forum_discussions_paginated
/**
* Returns a list of forum discussions optionally sorted and paginated.
*
* @param int $forumid the forum instance id
* @param string $sortby sort by this element (id, timemodified, timestart or timeend)
* @param string $sortdirection sort direction: ASC or DESC
* @param int $page page number
* @param int $perpage items per page
*
* @return array the forum discussion details including warnings
* @since Moodle 2.8
*/
public static function get_forum_discussions_paginated($forumid, $sortby = 'timemodified', $sortdirection = 'DESC', $page = -1, $perpage = 0)
{
global $CFG, $DB, $USER;
require_once $CFG->dirroot . "/mod/forum/lib.php";
$warnings = array();
$discussions = array();
$params = self::validate_parameters(self::get_forum_discussions_paginated_parameters(), array('forumid' => $forumid, 'sortby' => $sortby, 'sortdirection' => $sortdirection, 'page' => $page, 'perpage' => $perpage));
// Compact/extract functions are not recommended.
$forumid = $params['forumid'];
$sortby = $params['sortby'];
$sortdirection = $params['sortdirection'];
$page = $params['page'];
$perpage = $params['perpage'];
$sortallowedvalues = array('id', 'timemodified', 'timestart', 'timeend');
if (!in_array($sortby, $sortallowedvalues)) {
throw new invalid_parameter_exception('Invalid value for sortby parameter (value: ' . $sortby . '),' . 'allowed values are: ' . implode(',', $sortallowedvalues));
}
$sortdirection = strtoupper($sortdirection);
$directionallowedvalues = array('ASC', 'DESC');
if (!in_array($sortdirection, $directionallowedvalues)) {
throw new invalid_parameter_exception('Invalid value for sortdirection parameter (value: ' . $sortdirection . '),' . 'allowed values are: ' . implode(',', $directionallowedvalues));
}
$forum = $DB->get_record('forum', array('id' => $forumid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $forum->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id, false, MUST_EXIST);
// Validate the module context. It checks everything that affects the module visibility (including groupings, etc..).
$modcontext = context_module::instance($cm->id);
self::validate_context($modcontext);
// Check they have the view forum capability.
require_capability('mod/forum:viewdiscussion', $modcontext, null, true, 'noviewdiscussionspermission', 'forum');
$sort = 'd.' . $sortby . ' ' . $sortdirection;
$alldiscussions = forum_get_discussions($cm, $sort, true, -1, -1, true, $page, $perpage);
if ($alldiscussions) {
$canviewfullname = has_capability('moodle/site:viewfullnames', $modcontext);
// Get the unreads array, this takes a forum id and returns data for all discussions.
$unreads = array();
if ($cantrack = forum_tp_can_track_forums($forum)) {
if ($forumtracked = forum_tp_is_tracked($forum)) {
$unreads = forum_get_discussions_unread($cm);
}
}
// The forum function returns the replies for all the discussions in a given forum.
$replies = forum_count_discussion_replies($forumid, $sort, -1, $page, $perpage);
foreach ($alldiscussions as $discussion) {
// This function checks for qanda forums.
// Note that the forum_get_discussions returns as id the post id, not the discussion id so we need to do this.
$discussionrec = clone $discussion;
$discussionrec->id = $discussion->discussion;
if (!forum_user_can_see_discussion($forum, $discussionrec, $modcontext)) {
$warning = array();
// Function forum_get_discussions returns forum_posts ids not forum_discussions ones.
$warning['item'] = 'post';
$warning['itemid'] = $discussion->id;
$warning['warningcode'] = '1';
$warning['message'] = 'You can\'t see this discussion';
$warnings[] = $warning;
continue;
}
$discussion->numunread = 0;
if ($cantrack && $forumtracked) {
if (isset($unreads[$discussion->discussion])) {
$discussion->numunread = (int) $unreads[$discussion->discussion];
}
}
$discussion->numreplies = 0;
if (!empty($replies[$discussion->discussion])) {
$discussion->numreplies = (int) $replies[$discussion->discussion]->replies;
}
// Load user objects from the results of the query.
$user = new stdclass();
$user->id = $discussion->userid;
$user = username_load_fields_from_object($user, $discussion);
$discussion->userfullname = fullname($user, $canviewfullname);
// We can have post written by users that are deleted. In this case, those users don't have a valid context.
$usercontext = context_user::instance($user->id, IGNORE_MISSING);
if ($usercontext) {
$discussion->userpictureurl = moodle_url::make_webservice_pluginfile_url($usercontext->id, 'user', 'icon', null, '/', 'f1')->out(false);
} else {
$discussion->userpictureurl = '';
}
$usermodified = new stdclass();
$usermodified->id = $discussion->usermodified;
$usermodified = username_load_fields_from_object($usermodified, $discussion, 'um');
$discussion->usermodifiedfullname = fullname($usermodified, $canviewfullname);
// We can have post written by users that are deleted. In this case, those users don't have a valid context.
$usercontext = context_user::instance($usermodified->id, IGNORE_MISSING);
if ($usercontext) {
$discussion->usermodifiedpictureurl = moodle_url::make_webservice_pluginfile_url($usercontext->id, 'user', 'icon', null, '/', 'f1')->out(false);
//.........这里部分代码省略.........
开发者ID:educakanchay,项目名称:campus,代码行数:101,代码来源:externallib.php
示例5: get_forum_discussions_paginated
/**
* Returns a list of forum discussions optionally sorted and paginated.
*
* @param int $forumid the forum instance id
* @param string $sortby sort by this element (id, timemodified, timestart or timeend)
* @param string $sortdirection sort direction: ASC or DESC
* @param int $page page number
* @param int $perpage items per page
*
* @return array the forum discussion details including warnings
* @since Moodle 2.8
*/
public static function get_forum_discussions_paginated($forumid, $sortby = 'timemodified', $sortdirection = 'DESC', $page = -1, $perpage = 0)
{
global $CFG, $DB, $USER, $PAGE;
require_once $CFG->dirroot . "/mod/forum/lib.php";
$warnings = array();
$discussions = array();
$params = self::validate_parameters(self::get_forum_discussions_paginated_parameters(), array('forumid' => $forumid, 'sortby' => $sortby, 'sortdirection' => $sortdirection, 'page' => $page, 'perpage' => $perpage));
// Compact/extract functions are not recommended.
$forumid = $params['forumid'];
$sortby = $params['sortby'];
$sortdirection = $params['sortdirection'];
$page = $params['page'];
$perpage = $params['perpage'];
$sortallowedvalues = array('id', 'timemodified', 'timestart', 'timeend');
if (!in_array($sortby, $sortallowedvalues)) {
throw new invalid_parameter_exception('Invalid value for sortby parameter (value: ' . $sortby . '),' . 'allowed values are: ' . implode(',', $sortallowedvalues));
}
$sortdirection = strtoupper($sortdirection);
$directionallowedvalues = array('ASC', 'DESC');
if (!in_array($sortdirection, $directionallowedvalues)) {
throw new invalid_parameter_exception('Invalid value for sortdirection parameter (value: ' . $sortdirection . '),' . 'allowed values are: ' . implode(',', $directionallowedvalues));
}
$forum = $DB->get_record('forum', array('id' => $forumid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $forum->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id, false, MUST_EXIST);
// Validate the module context. It checks everything that affects the module visibility (including groupings, etc..).
$modcontext = context_module::instance($cm->id);
self::validate_context($modcontext);
// Check they have the view forum capability.
require_capability('mod/forum:viewdiscussion', $modcontext, null, true, 'noviewdiscussionspermission', 'forum');
$sort = 'd.pinned DESC, d.' . $sortby . ' ' . $sortdirection;
$alldiscussions = forum_get_discussions($cm, $sort, true, -1, -1, true, $page, $perpage, FORUM_POSTS_ALL_USER_GROUPS);
if ($alldiscussions) {
$canviewfullname = has_capability('moodle/site:viewfullnames', $modcontext);
// Get the unreads array, this takes a forum id and returns data for all discussions.
$unreads = array();
if ($cantrack = forum_tp_can_track_forums($forum)) {
if ($forumtracked = forum_tp_is_tracked($forum)) {
$unreads = forum_get_discussions_unread($cm);
}
}
// The forum function returns the replies for all the discussions in a given forum.
$replies = forum_count_discussion_replies($forumid, $sort, -1, $page, $perpage);
foreach ($alldiscussions as $discussion) {
// This function checks for qanda forums.
// Note that the forum_get_discussions returns as id the post id, not the discussion id so we need to do this.
$discussionrec = clone $discussion;
$discussionrec->id = $discussion->discussion;
if (!forum_user_can_see_discussion($forum, $discussionrec, $modcontext)) {
$warning = array();
// Function forum_get_discussions returns forum_posts ids not forum_discussions ones.
$warning['item'] = 'post';
$warning['itemid'] = $discussion->id;
$warning['warningcode'] = '1';
$warning['message'] = 'You can\'t see this discussion';
$warnings[] = $warning;
continue;
}
$discussion->numunread = 0;
if ($cantrack && $forumtracked) {
if (isset($unreads[$discussion->discussion])) {
$discussion->numunread = (int) $unreads[$discussion->discussion];
}
}
$discussion->numreplies = 0;
if (!empty($replies[$discussion->discussion])) {
$discussion->numreplies = (int) $replies[$discussion->discussion]->replies;
}
$discussion->name = external_format_string($discussion->name, $modcontext->id);
$discussion->subject = external_format_string($discussion->subject, $modcontext->id);
// Rewrite embedded images URLs.
list($discussion->message, $discussion->messageformat) = external_format_text($discussion->message, $discussion->messageformat, $modcontext->id, 'mod_forum', 'post', $discussion->id);
// List attachments.
if (!empty($discussion->attachment)) {
$discussion->attachments = external_util::get_area_files($modcontext->id, 'mod_forum', 'attachment', $discussion->id);
}
$messageinlinefiles = external_util::get_area_files($modcontext->id, 'mod_forum', 'post', $discussion->id);
if (!empty($messageinlinefiles)) {
$discussion->messageinlinefiles = $messageinlinefiles;
}
$discussion->locked = forum_discussion_is_locked($forum, $discussion);
$discussion->canreply = forum_user_can_post($forum, $discussion, $USER, $cm, $course, $modcontext);
if (forum_is_author_hidden($discussion, $forum)) {
$discussion->userid = null;
$discussion->userfullname = null;
$discussion->userpictureurl = null;
$discussion->usermodified = null;
$discussion->usermodifiedfullname = null;
//.........这里部分代码省略.........
开发者ID:lucaboesch,项目名称:moodle,代码行数:101,代码来源:externallib.php
示例6: forum_print_latest_discussions
//.........这里部分代码省略.........
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>';
echo '<th class="header author" colspan="2" scope="col">' . get_string('startedby', 'forum') . '</th>';
if ($groupmode > 0) {
echo '<th class="header group" scope="col">' . get_string('group') . '</th>';
}
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="' . $CFG->pixpath . '/t/clear.gif" class="iconsmall" alt="' . get_string('markallread', 'forum') . '" /></a>';
}
echo '</th>';
}
}
echo '<th class="header lastpost" scope="col">' . get_string('lastpost', 'forum') . '</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
}
foreach ($discussions as $discussion) {
if (!empty($replies[$discussion->discussion])) {
$discussion->replies = $replies[$discussion->discussion]->replies;
$discussion->lastpostid = $replies[$discussion->discussion]->lastpostid;
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:67,代码来源:lib.php
注:本文中的forum_get_discussions_unread函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论