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

PHP forum_get_user_digest_options函数代码示例

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

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



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

示例1: get_string

$strdiscussions = get_string('discussions', 'forum');
$strsubscribed = get_string('subscribed', 'forum');
$strunreadposts = get_string('unreadposts', 'forum');
$strtracking = get_string('tracking', 'forum');
$strmarkallread = get_string('markallread', 'forum');
$strtrackforum = get_string('trackforum', 'forum');
$strnotrackforum = get_string('notrackforum', 'forum');
$strsubscribe = get_string('subscribe', 'forum');
$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);
开发者ID:gwsd2015,项目名称:LogiClass,代码行数:31,代码来源:index.php


示例2: forum_set_user_maildigest

/**
 * Set the per-forum maildigest option for the specified user.
 *
 * @param stdClass $forum The forum to set the option for.
 * @param int $maildigest The maildigest option.
 * @param stdClass $user The user object. This defaults to the global $USER object.
 * @throws invalid_digest_setting thrown if an invalid maildigest option is provided.
 */
function forum_set_user_maildigest($forum, $maildigest, $user = null)
{
    global $DB, $USER;
    if (is_number($forum)) {
        $forum = $DB->get_record('forum', array('id' => $forum));
    }
    if ($user === null) {
        $user = $USER;
    }
    $course = $DB->get_record('course', array('id' => $forum->course), '*', MUST_EXIST);
    $cm = get_coursemodule_from_instance('forum', $forum->id, $course->id, false, MUST_EXIST);
    $context = context_module::instance($cm->id);
    // User must be allowed to see this forum.
    require_capability('mod/forum:viewdiscussion', $context, $user->id);
    // Validate the maildigest setting.
    $digestoptions = forum_get_user_digest_options($user);
    if (!isset($digestoptions[$maildigest])) {
        throw new moodle_exception('invaliddigestsetting', 'mod_forum');
    }
    // Attempt to retrieve any existing forum digest record.
    $subscription = $DB->get_record('forum_digests', array('userid' => $user->id, 'forum' => $forum->id));
    // Create or Update the existing maildigest setting.
    if ($subscription) {
        if ($maildigest == -1) {
            $DB->delete_records('forum_digests', array('forum' => $forum->id, 'userid' => $user->id));
        } else {
            if ($maildigest !== $subscription->maildigest) {
                // Only update the maildigest setting if it's changed.
                $subscription->maildigest = $maildigest;
                $DB->update_record('forum_digests', $subscription);
            }
        }
    } else {
        if ($maildigest != -1) {
            // Only insert the maildigest setting if it's non-default.
            $subscription = new stdClass();
            $subscription->forum = $forum->id;
            $subscription->userid = $user->id;
            $subscription->maildigest = $maildigest;
            $subscription->id = $DB->insert_record('forum_digests', $subscription);
        }
    }
}
开发者ID:abhilash1994,项目名称:moodle,代码行数:51,代码来源:lib.php


示例3: render_digest_options

 /**
  * Create the inplace_editable used to select forum digest options.
  *
  * @param   stdClass    $forum  The forum to create the editable for.
  * @param   int         $value  The current value for this user
  * @return  inplace_editable
  */
 public function render_digest_options($forum, $value)
 {
     $options = forum_get_user_digest_options();
     $editable = new \core\output\inplace_editable('mod_forum', 'digestoptions', $forum->id, true, $options[$value], $value);
     $editable->set_type_select($options);
     return $editable;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:renderer.php


示例4: test_get_user_digest_options_sorting

 public function test_get_user_digest_options_sorting()
 {
     global $USER, $DB;
     $this->resetAfterTest(true);
     // Set up a basic user enrolled in a course.
     $helper = $this->helper_setup_user_in_course();
     $user = $helper->user;
     $course1 = $helper->courses->course1;
     $forum1 = $helper->forums->forum1;
     // Set to the user.
     self::setUser($helper->user);
     // Retrieve the list of applicable options.
     $options = forum_get_user_digest_options();
     // The default option must always be at the top of the list.
     $lastoption = -2;
     foreach ($options as $value => $description) {
         $this->assertGreaterThan($lastoption, $value);
         $lastoption = $value;
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:20,代码来源:maildigest_test.php


示例5: test_mod_forum_get_user_digest_options_sorting

 public function test_mod_forum_get_user_digest_options_sorting()
 {
     global $USER, $DB;
     $this->resetAfterTest(true);
     // Create a user.
     $user = self::getDataGenerator()->create_user();
     // Set to the user.
     self::setUser($user);
     // Retrieve the list of applicable options.
     $options = forum_get_user_digest_options();
     // The default option must always be at the top of the list.
     $lastoption = -2;
     foreach ($options as $value => $description) {
         $this->assertGreaterThan($lastoption, $value);
         $lastoption = $value;
     }
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:17,代码来源:maildigest_test.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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