本文整理汇总了PHP中forum_tp_get_untracked_forums函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_tp_get_untracked_forums函数的具体用法?PHP forum_tp_get_untracked_forums怎么用?PHP forum_tp_get_untracked_forums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_tp_get_untracked_forums函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_forum_tp_get_untracked_forums
/**
* Test the logic in the test_forum_tp_get_untracked_forums() function.
*/
public function test_forum_tp_get_untracked_forums()
{
global $CFG;
$this->resetAfterTest();
$useron = $this->getDataGenerator()->create_user(array('trackforums' => 1));
$useroff = $this->getDataGenerator()->create_user(array('trackforums' => 0));
$course = $this->getDataGenerator()->create_course();
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OFF);
// Off.
$forumoff = $this->getDataGenerator()->create_module('forum', $options);
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_FORCED);
// On.
$forumforce = $this->getDataGenerator()->create_module('forum', $options);
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OPTIONAL);
// Optional.
$forumoptional = $this->getDataGenerator()->create_module('forum', $options);
// Allow force.
$CFG->forum_allowforcedreadtracking = 1;
// On user with force on.
$result = forum_tp_get_untracked_forums($useron->id, $course->id);
$this->assertEquals(1, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
// Off user with force on.
$result = forum_tp_get_untracked_forums($useroff->id, $course->id);
$this->assertEquals(2, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
$this->assertEquals(true, isset($result[$forumoptional->id]));
// Don't allow force.
$CFG->forum_allowforcedreadtracking = 0;
// On user with force off.
$result = forum_tp_get_untracked_forums($useron->id, $course->id);
$this->assertEquals(1, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
// Off user with force off.
$result = forum_tp_get_untracked_forums($useroff->id, $course->id);
$this->assertEquals(3, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
$this->assertEquals(true, isset($result[$forumoptional->id]));
$this->assertEquals(true, isset($result[$forumforce->id]));
// Stop tracking so we can test again.
forum_tp_stop_tracking($forumforce->id, $useron->id);
forum_tp_stop_tracking($forumoptional->id, $useron->id);
forum_tp_stop_tracking($forumforce->id, $useroff->id);
forum_tp_stop_tracking($forumoptional->id, $useroff->id);
// Allow force.
$CFG->forum_allowforcedreadtracking = 1;
// On user with force on.
$result = forum_tp_get_untracked_forums($useron->id, $course->id);
$this->assertEquals(2, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
$this->assertEquals(true, isset($result[$forumoptional->id]));
// Off user with force on.
$result = forum_tp_get_untracked_forums($useroff->id, $course->id);
$this->assertEquals(2, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
$this->assertEquals(true, isset($result[$forumoptional->id]));
// Don't allow force.
$CFG->forum_allowforcedreadtracking = 0;
// On user with force off.
$result = forum_tp_get_untracked_forums($useron->id, $course->id);
$this->assertEquals(3, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
$this->assertEquals(true, isset($result[$forumoptional->id]));
$this->assertEquals(true, isset($result[$forumforce->id]));
// Off user with force off.
$result = forum_tp_get_untracked_forums($useroff->id, $course->id);
$this->assertEquals(3, count($result));
$this->assertEquals(true, isset($result[$forumoff->id]));
$this->assertEquals(true, isset($result[$forumoptional->id]));
$this->assertEquals(true, isset($result[$forumforce->id]));
}
开发者ID:rushi963,项目名称:moodle,代码行数:74,代码来源:lib_test.php
示例2: get_string
$strunsubscribe = get_string('unsubscribe', 'forum');
$stryes = get_string('yes');
$strno = get_string('no');
$strrss = get_string('rss');
$stremaildigest = get_string('emaildigest');
$searchform = forum_search_form($course);
// Retrieve the list of forum digest options for later.
$digestoptions = forum_get_user_digest_options();
$digestoptions_selector = new single_select(new moodle_url('/mod/forum/maildigest.php', array('backtoindex' => 1)), 'maildigest', $digestoptions, null, '');
$digestoptions_selector->method = 'post';
// Start of the table for General Forums
$generaltable = new html_table();
$generaltable->head = array($strforum, $strdescription, $strdiscussions);
$generaltable->align = array('left', 'left', 'center');
if ($usetracking = forum_tp_can_track_forums()) {
$untracked = forum_tp_get_untracked_forums($USER->id, $course->id);
$generaltable->head[] = $strunreadposts;
$generaltable->align[] = 'center';
$generaltable->head[] = $strtracking;
$generaltable->align[] = 'center';
}
$subscribed_forums = forum_get_subscribed_forums($course);
$can_subscribe = is_enrolled($coursecontext);
if ($can_subscribe) {
$generaltable->head[] = $strsubscribed;
$generaltable->align[] = 'center';
$generaltable->head[] = $stremaildigest . ' ' . $OUTPUT->help_icon('emaildigesttype', 'mod_forum');
$generaltable->align[] = 'center';
}
if ($show_rss = ($can_subscribe || $course->id == SITEID) && isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) && $CFG->enablerssfeeds && $CFG->forum_enablerssfeeds) {
$generaltable->head[] = $strrss;
开发者ID:gwsd2015,项目名称:LogiClass,代码行数:31,代码来源:index.php
注:本文中的forum_tp_get_untracked_forums函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论