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

PHP forum_discussion_view函数代码示例

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

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



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

示例1: view_forum_discussion

 /**
  * Simulate the forum/discuss.php web interface page: trigger events
  *
  * @param int $discussionid the discussion id
  * @return array of warnings and status result
  * @since Moodle 2.9
  * @throws moodle_exception
  */
 public static function view_forum_discussion($discussionid)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . "/mod/forum/lib.php";
     $params = self::validate_parameters(self::view_forum_discussion_parameters(), array('discussionid' => $discussionid));
     $warnings = array();
     $discussion = $DB->get_record('forum_discussions', array('id' => $params['discussionid']), '*', MUST_EXIST);
     $forum = $DB->get_record('forum', array('id' => $discussion->forum), '*', MUST_EXIST);
     list($course, $cm) = get_course_and_cm_from_instance($forum, 'forum');
     // 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);
     require_capability('mod/forum:viewdiscussion', $modcontext, null, true, 'noviewdiscussionspermission', 'forum');
     // Call the forum/lib API.
     forum_discussion_view($modcontext, $forum, $discussion);
     $result = array();
     $result['status'] = true;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:educakanchay,项目名称:campus,代码行数:28,代码来源:externallib.php


示例2: test_forum_discussion_view

 /**
  * Test forum_discussion_view.
  */
 public function test_forum_discussion_view()
 {
     global $CFG, $USER;
     $this->resetAfterTest();
     // Setup test data.
     $course = $this->getDataGenerator()->create_course();
     $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id));
     $discussion = $this->create_single_discussion_with_replies($forum, $USER, 2);
     $context = context_module::instance($forum->cmid);
     $cm = get_coursemodule_from_instance('forum', $forum->id);
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     $this->setAdminUser();
     forum_discussion_view($context, $forum, $discussion);
     $events = $sink->get_events();
     $this->assertCount(1, $events);
     $event = array_pop($events);
     // Checking that the event contains the expected values.
     $this->assertInstanceOf('\\mod_forum\\event\\discussion_viewed', $event);
     $this->assertEquals($context, $event->get_context());
     $expected = array($course->id, 'forum', 'view discussion', "discuss.php?d={$discussion->id}", $discussion->id, $forum->cmid);
     $this->assertEventLegacyLogData($expected, $event);
     $this->assertEventContextNotUsed($event);
     $this->assertNotEmpty($event->get_name());
 }
开发者ID:rushi963,项目名称:moodle,代码行数:28,代码来源:lib_test.php


示例3: array

        }
    }
    $params = array('context' => $destinationctx, 'objectid' => $discussion->id, 'other' => array('fromforumid' => $forum->id, 'toforumid' => $forumto->id));
    $event = \mod_forum\event\discussion_moved::create($params);
    $event->add_record_snapshot('forum_discussions', $discussion);
    $event->add_record_snapshot('forum', $forum);
    $event->add_record_snapshot('forum', $forumto);
    $event->trigger();
    // Delete the RSS files for the 2 forums to force regeneration of the feeds
    require_once $CFG->dirroot . '/mod/forum/rsslib.php';
    forum_rss_delete_file($forum);
    forum_rss_delete_file($forumto);
    redirect($return . '&moved=-1&sesskey=' . sesskey());
}
// Trigger discussion viewed event.
forum_discussion_view($modcontext, $forum, $discussion);
unset($SESSION->fromdiscussion);
if ($mode) {
    set_user_preference('forum_displaymode', $mode);
}
$displaymode = get_user_preferences('forum_displaymode', $CFG->forum_displaymode);
if ($parent) {
    // If flat AND parent, then force nested display this time
    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}");
开发者ID:mongo0se,项目名称:moodle,代码行数:31,代码来源:discuss.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP forum_discussions_user_has_posted_in函数代码示例发布时间:2022-05-15
下一篇:
PHP forum_discussion_update_last_post函数代码示例发布时间: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