当前位置: 首页>>代码示例>>PHP>>正文


PHP forum::mark_read_automatically方法代码示例

本文整理汇总了PHP中forum::mark_read_automatically方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::mark_read_automatically方法的具体用法?PHP forum::mark_read_automatically怎么用?PHP forum::mark_read_automatically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forum的用法示例。


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

示例1: display

 public function display($forum)
 {
     // Work out current status
     $manualmark = !forum::mark_read_automatically();
     $current = get_string($manualmark ? 'manualmark_manual' : 'manualmark_auto', 'forumng');
     // Make a help button
     $change = get_string('manualmark_change', 'forumng');
     $helpbutton = helpbutton('manualmark', $change, 'forumng', true, false, '', true);
     // Get the button form
     $params = $forum->get_link_params_array();
     return parent::get_button($forum, $change, 'feature/manualmark/change.php', true, $params, $helpbutton, 'forumng-manualmark', $current . ' ', 'forumng-button-to-link');
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:manualmark_forum_feature.php

示例2: print_discussion_page

 /**
  * Displays the discussion page.
  * @param forum_discussion $discussion Discussion
  */
 public function print_discussion_page($discussion)
 {
     $previousread = (int) $discussion->get_time_read();
     // 'Read date' option (used when viewing all posts so that they keep
     // their read/unread colouring)
     $timeread = optional_param('timeread', 0, PARAM_INT);
     if ($timeread) {
         $discussion->pretend_time_read($timeread);
         $previousread = $timeread;
     }
     // 'Expand all' option (always chosen for non-JS browsers)
     $expandall = optional_param('expand', 0, PARAM_INT) || forum_utils::is_bad_browser();
     // 'Expand all' option (always chosen for non-JS browsers)
     $collapseall = optional_param('collapse', 0, PARAM_INT);
     // Magic expand tracker (for use in JS only, never set server-side).
     // This tracks expanded posts, and makes the Back button 'work' in
     // the sense that it will expand these posts again.
     print '<form method="post" action="."><div>' . '<input type="hidden" id="expanded_posts" name="expanded_posts" ' . 'value="" /></div></form>';
     // Get content for all posts in the discussion
     $options = array();
     if ($expandall) {
         $options[forum_post::OPTION_CHILDREN_EXPANDED] = true;
     }
     if ($collapseall) {
         $options[forum_post::OPTION_CHILDREN_COLLAPSED] = true;
     }
     $content = $this->display_discussion($discussion, $options);
     // Some post display options use the read time to construct links
     // (usually for non-JS version) so that unread state is maintained.
     $options[forum_post::OPTION_READ_TIME] = $previousread;
     // Display expand all option if there are any 'Expand' links in content
     $fakedate = '&amp;timeread=' . $previousread;
     print '<div id="forumng-expandall">';
     $showexpandall = preg_match('~<a [^>]*href="discuss\\.php\\?d=[0-9]+[^"]*&amp;expand=1#p[0-9]+">~', $content);
     $showcollapseall = preg_match('~<div class="forumng-post forumng-full.*<div class="forumng-post forumng-full~s', $content);
     if ($showexpandall) {
         print '<a href="' . $discussion->get_url(forum::PARAM_HTML) . '&amp;expand=1' . $fakedate . '">' . get_string('expandall', 'forumng') . '</a>';
         if ($showcollapseall) {
             print ' &#x2022; ';
         }
     }
     if ($showcollapseall) {
         print '<a href="' . $discussion->get_url(forum::PARAM_HTML) . '&amp;collapse=1' . $fakedate . '">' . get_string('collapseall', 'forumng') . '</a> ';
     }
     print '</div>';
     // Display content
     print $content;
     // Print reply/edit forms for AJAX
     print $this->display_ajax_forms($discussion->get_forum());
     // Link back to forum
     print $discussion->display_link_back_to_forum();
     // Display discussion features (row of buttons)
     print $discussion->display_discussion_features();
     // Display the subscription options to this disucssion if available
     print $discussion->display_subscribe_options();
     // Atom/RSS links
     print $discussion->display_feed_links();
     // Set read data [shouldn't this logic be somewhere else as it is not
     // part of display?]
     if (forum::mark_read_automatically()) {
         $discussion->mark_read();
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:67,代码来源:general_forum_type.php

示例3: should_display

 public function should_display($discussion)
 {
     return !forum::mark_read_automatically() && $discussion->get_forum()->can_mark_read() && $discussion->get_num_unread_posts();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:4,代码来源:markdiscussionread_forum_feature.php

示例4: required_param

<?php

require_once '../../../../config.php';
require_once '../../forum.php';
// This script toggles the user's 'automatically mark read' preference.
$id = required_param('id', PARAM_INT);
$cloneid = optional_param('clone', 0, PARAM_INT);
try {
    $forum = forum::get_from_cmid($id, $cloneid);
    $groupid = forum::get_activity_group($forum->get_course_module(), false);
    $forum->require_view($groupid);
    $manualmark = !forum::mark_read_automatically();
    if ($manualmark) {
        unset_user_preference('forumng_manualmark');
    } else {
        set_user_preference('forumng_manualmark', 1);
    }
    redirect($forum->get_url(forum::PARAM_PLAIN));
} catch (Exception $e) {
    forum_utils::handle_exception($e);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:21,代码来源:change.php


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