• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP forum_tp_add_read_record函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中forum_tp_add_read_record函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_tp_add_read_record函数的具体用法?PHP forum_tp_add_read_record怎么用?PHP forum_tp_add_read_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了forum_tp_add_read_record函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: forum_tp_mark_post_read

/**
 * If its an old post, do nothing. If the record exists, the maintenance will clear it up later.
 *
 * @return bool
 */
function forum_tp_mark_post_read($userid, $post, $forumid) {
    if (!forum_tp_is_post_old($post)) {
        return forum_tp_add_read_record($userid, $post->id);
    } else {
        return true;
    }
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:12,代码来源:lib.php


示例2: print_error

    if ($displaymode == FORUM_MODE_FLATOLDEST or $displaymode == FORUM_MODE_FLATNEWEST) {
        $displaymode = FORUM_MODE_NESTED;
    }
} else {
    $parent = $discussion->firstpost;
}
if (!($post = forum_get_post_full($parent))) {
    print_error("notexists", 'forum', "{$CFG->wwwroot}/mod/forum/view.php?f={$forum->id}");
}
if (!forum_user_can_see_post($forum, $discussion, $post, null, $cm)) {
    print_error('noviewdiscussionspermission', 'forum', "{$CFG->wwwroot}/mod/forum/view.php?id={$forum->id}");
}
if ($mark == 'read' or $mark == 'unread') {
    if ($CFG->forum_usermarksread && forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
        if ($mark == 'read') {
            forum_tp_add_read_record($USER->id, $postid);
        } else {
            // unread
            forum_tp_delete_read_records($USER->id, $postid);
        }
    }
}
$searchform = forum_search_form($course);
$forumnode = $PAGE->navigation->find($cm->id, navigation_node::TYPE_ACTIVITY);
if (empty($forumnode)) {
    $forumnode = $PAGE->navbar;
} else {
    $forumnode->make_active();
}
$node = $forumnode->add(format_string($discussion->name), new moodle_url('/mod/forum/discuss.php', array('d' => $discussion->id)));
$node->display = false;
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:discuss.php


示例3: test_observers

 /**
  * Test mod_forum_observer methods.
  */
 public function test_observers()
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/mod/forum/lib.php';
     $forumgen = $this->getDataGenerator()->get_plugin_generator('mod_forum');
     $course = $this->getDataGenerator()->create_course();
     $trackedrecord = array('course' => $course->id, 'type' => 'general', 'forcesubscribe' => FORUM_INITIALSUBSCRIBE);
     $untrackedrecord = array('course' => $course->id, 'type' => 'general');
     $trackedforum = $this->getDataGenerator()->create_module('forum', $trackedrecord);
     $untrackedforum = $this->getDataGenerator()->create_module('forum', $untrackedrecord);
     // Used functions don't require these settings; adding
     // them just in case there are APIs changes in future.
     $user = $this->getDataGenerator()->create_user(array('maildigest' => 1, 'trackforums' => 1));
     $manplugin = enrol_get_plugin('manual');
     $manualenrol = $DB->get_record('enrol', array('courseid' => $course->id, 'enrol' => 'manual'));
     $student = $DB->get_record('role', array('shortname' => 'student'));
     // The role_assign observer does it's job adding the forum_subscriptions record.
     $manplugin->enrol_user($manualenrol, $user->id, $student->id);
     // They are not required, but in a real environment they are supposed to be required;
     // adding them just in case there are APIs changes in future.
     set_config('forum_trackingtype', 1);
     set_config('forum_trackreadposts', 1);
     $record = array();
     $record['course'] = $course->id;
     $record['forum'] = $trackedforum->id;
     $record['userid'] = $user->id;
     $discussion = $forumgen->create_discussion($record);
     $record = array();
     $record['discussion'] = $discussion->id;
     $record['userid'] = $user->id;
     $post = $forumgen->create_post($record);
     forum_tp_add_read_record($user->id, $post->id);
     forum_set_user_maildigest($trackedforum, 2, $user);
     forum_tp_stop_tracking($untrackedforum->id, $user->id);
     $this->assertEquals(1, $DB->count_records('forum_subscriptions'));
     $this->assertEquals(1, $DB->count_records('forum_digests'));
     $this->assertEquals(1, $DB->count_records('forum_track_prefs'));
     $this->assertEquals(1, $DB->count_records('forum_read'));
     // The course_module_created observer does it's job adding a subscription.
     $forumrecord = array('course' => $course->id, 'type' => 'general', 'forcesubscribe' => FORUM_INITIALSUBSCRIBE);
     $extraforum = $this->getDataGenerator()->create_module('forum', $forumrecord);
     $this->assertEquals(2, $DB->count_records('forum_subscriptions'));
     $manplugin->unenrol_user($manualenrol, $user->id);
     $this->assertEquals(0, $DB->count_records('forum_digests'));
     $this->assertEquals(0, $DB->count_records('forum_subscriptions'));
     $this->assertEquals(0, $DB->count_records('forum_track_prefs'));
     $this->assertEquals(0, $DB->count_records('forum_read'));
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:51,代码来源:events_test.php


示例4: format_string

    }
    $navtail = '';
} else {
    $parent = $discussion->firstpost;
    $navtail = '-> ' . format_string($discussion->name);
}
if (!forum_user_can_view_post($parent, $course, $cm, $forum, $discussion)) {
    error('You do not have permissions to view this post', "{$CFG->wwwroot}/mod/forum/view.php?f={$forum->id}");
}
if (!($post = forum_get_post_full($parent))) {
    error("Discussion no longer exists", "{$CFG->wwwroot}/mod/forum/view.php?f={$forum->id}");
}
$post->modcontext = $modcontext;
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum) && $CFG->forum_usermarksread) {
    if ($mark == 'read') {
        forum_tp_add_read_record($USER->id, $postid, $discussion->id, $forum->id);
    } else {
        if ($mark == 'unread') {
            forum_tp_delete_read_records($USER->id, $postid);
        }
    }
}
if (empty($navtail)) {
    $navtail = "-> <a href=\"discuss.php?d={$discussion->id}\">" . format_string($discussion->name, true) . "</a> -> " . format_string($post->subject);
}
if ($forum->type == 'single') {
    $navforum = '';
} else {
    $navforum = "<a href=\"../forum/view.php?f={$forum->id}\">" . format_string($forum->name, true) . "</a> ";
}
$navmiddle = "<a href=\"../forum/index.php?id={$course->id}\">" . get_string("forums", "forum") . '</a> -> ' . $navforum;
开发者ID:njorth,项目名称:marginalia,代码行数:31,代码来源:discuss.php



注:本文中的forum_tp_add_read_record函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP forum_tp_can_track_forums函数代码示例发布时间:2022-05-15
下一篇:
PHP forum_time函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap