當前位置: 首頁>>代碼示例>>PHP>>正文


PHP subscriptions::is_forcesubscribed方法代碼示例

本文整理匯總了PHP中mod_forum\subscriptions::is_forcesubscribed方法的典型用法代碼示例。如果您正苦於以下問題:PHP subscriptions::is_forcesubscribed方法的具體用法?PHP subscriptions::is_forcesubscribed怎麽用?PHP subscriptions::is_forcesubscribed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mod_forum\subscriptions的用法示例。


在下文中一共展示了subscriptions::is_forcesubscribed方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: forum_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $forumnode The node to add module settings to
 */
function forum_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $forumnode)
{
    global $USER, $PAGE, $CFG, $DB, $OUTPUT;
    $forumobject = $DB->get_record("forum", array("id" => $PAGE->cm->instance));
    if (empty($PAGE->cm->context)) {
        $PAGE->cm->context = context_module::instance($PAGE->cm->instance);
    }
    // for some actions you need to be enrolled, beiing admin is not enough sometimes here
    $enrolled = is_enrolled($PAGE->cm->context, $USER, '', false);
    $activeenrolled = is_enrolled($PAGE->cm->context, $USER, '', true);
    $canmanage = has_capability('mod/forum:managesubscriptions', $PAGE->cm->context);
    $subscriptionmode = \mod_forum\subscriptions::get_subscription_mode($forumobject);
    $cansubscribe = $activeenrolled && !\mod_forum\subscriptions::is_forcesubscribed($forumobject) && (!\mod_forum\subscriptions::subscription_disabled($forumobject) || $canmanage);
    if ($canmanage) {
        $mode = $forumnode->add(get_string('subscriptionmode', 'forum'), null, navigation_node::TYPE_CONTAINER);
        $allowchoice = $mode->add(get_string('subscriptionoptional', 'forum'), new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'mode' => FORUM_CHOOSESUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        $forceforever = $mode->add(get_string("subscriptionforced", "forum"), new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'mode' => FORUM_FORCESUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        $forceinitially = $mode->add(get_string("subscriptionauto", "forum"), new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'mode' => FORUM_INITIALSUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        $disallowchoice = $mode->add(get_string('subscriptiondisabled', 'forum'), new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'mode' => FORUM_DISALLOWSUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        switch ($subscriptionmode) {
            case FORUM_CHOOSESUBSCRIBE:
                // 0
                $allowchoice->action = null;
                $allowchoice->add_class('activesetting');
                break;
            case FORUM_FORCESUBSCRIBE:
                // 1
                $forceforever->action = null;
                $forceforever->add_class('activesetting');
                break;
            case FORUM_INITIALSUBSCRIBE:
                // 2
                $forceinitially->action = null;
                $forceinitially->add_class('activesetting');
                break;
            case FORUM_DISALLOWSUBSCRIBE:
                // 3
                $disallowchoice->action = null;
                $disallowchoice->add_class('activesetting');
                break;
        }
    } else {
        if ($activeenrolled) {
            switch ($subscriptionmode) {
                case FORUM_CHOOSESUBSCRIBE:
                    // 0
                    $notenode = $forumnode->add(get_string('subscriptionoptional', 'forum'));
                    break;
                case FORUM_FORCESUBSCRIBE:
                    // 1
                    $notenode = $forumnode->add(get_string('subscriptionforced', 'forum'));
                    break;
                case FORUM_INITIALSUBSCRIBE:
                    // 2
                    $notenode = $forumnode->add(get_string('subscriptionauto', 'forum'));
                    break;
                case FORUM_DISALLOWSUBSCRIBE:
                    // 3
                    $notenode = $forumnode->add(get_string('subscriptiondisabled', 'forum'));
                    break;
            }
        }
    }
    if ($cansubscribe) {
        if (\mod_forum\subscriptions::is_subscribed($USER->id, $forumobject)) {
            $linktext = get_string('unsubscribe', 'forum');
        } else {
            $linktext = get_string('subscribe', 'forum');
        }
        $url = new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'sesskey' => sesskey()));
        $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
    }
    if (has_capability('mod/forum:viewsubscribers', $PAGE->cm->context)) {
        $url = new moodle_url('/mod/forum/subscribers.php', array('id' => $forumobject->id));
        $forumnode->add(get_string('showsubscribers', 'forum'), $url, navigation_node::TYPE_SETTING);
    }
    if ($enrolled && forum_tp_can_track_forums($forumobject)) {
        // keep tracking info for users with suspended enrolments
        if ($forumobject->trackingtype == FORUM_TRACKING_OPTIONAL || !$CFG->forum_allowforcedreadtracking && $forumobject->trackingtype == FORUM_TRACKING_FORCED) {
            if (forum_tp_is_tracked($forumobject)) {
                $linktext = get_string('notrackforum', 'forum');
            } else {
                $linktext = get_string('trackforum', 'forum');
            }
            $url = new moodle_url('/mod/forum/settracking.php', array('id' => $forumobject->id));
            $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
        }
    }
    if (!isloggedin() && $PAGE->course->id == SITEID) {
        $userid = guest_user()->id;
    } else {
        $userid = $USER->id;
    }
    $hascourseaccess = $PAGE->course->id == SITEID || can_access_course($PAGE->course, $userid);
//.........這裏部分代碼省略.........
開發者ID:abhilash1994,項目名稱:moodle,代碼行數:101,代碼來源:lib.php

示例2: is_subscribable

 /**
  * Helper to determine whether the specified forum can be subscribed to.
  *
  * @param \stdClass $forum The record of the forum to test
  * @return bool
  */
 public static function is_subscribable($forum)
 {
     return !\mod_forum\subscriptions::is_forcesubscribed($forum) && !\mod_forum\subscriptions::subscription_disabled($forum);
 }
開發者ID:alanaipe2015,項目名稱:moodle,代碼行數:10,代碼來源:subscriptions.php

示例3: get_string

} else {
    if ($forum->type == 'qanda') {
        $heading = get_string('yournewquestion', 'forum');
    } else {
        $heading = get_string('yournewtopic', 'forum');
    }
}
$postid = empty($post->id) ? null : $post->id;
$draftid_editor = file_get_submitted_draft_itemid('message');
$currenttext = file_prepare_draft_area($draftid_editor, $modcontext->id, 'mod_forum', 'post', $postid, mod_forum_post_form::editor_options($modcontext, $postid), $post->message);
$manageactivities = has_capability('moodle/course:manageactivities', $coursecontext);
if (\mod_forum\subscriptions::subscription_disabled($forum) && !$manageactivities) {
    // User does not have permission to subscribe to this discussion at all.
    $discussionsubscribe = false;
} else {
    if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
        // User does not have permission to unsubscribe from this discussion at all.
        $discussionsubscribe = true;
    } else {
        if (isset($discussion) && \mod_forum\subscriptions::is_subscribed($USER->id, $forum, $discussion->id, $cm)) {
            // User is subscribed to the discussion - continue the subscription.
            $discussionsubscribe = true;
        } else {
            if (!isset($discussion) && \mod_forum\subscriptions::is_subscribed($USER->id, $forum, null, $cm)) {
                // Starting a new discussion, and the user is subscribed to the forum - subscribe to the discussion.
                $discussionsubscribe = true;
            } else {
                // User is not subscribed to either forum or discussion. Follow user preference.
                $discussionsubscribe = $USER->autosubscribe;
            }
        }
開發者ID:sriysk,項目名稱:moodle-integration,代碼行數:31,代碼來源:post.php

示例4: print_error

 require_once $CFG->dirroot . '/mod/forum/lib.php';
 if (!($newsforum = forum_get_course_forum($SITE->id, 'news'))) {
     print_error('cannotfindorcreateforum', 'forum');
 }
 // Fetch news forum context for proper filtering to happen.
 $newsforumcm = get_coursemodule_from_instance('forum', $newsforum->id, $SITE->id, false, MUST_EXIST);
 $newsforumcontext = context_module::instance($newsforumcm->id, MUST_EXIST);
 $forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext));
 echo html_writer::tag('a', get_string('skipa', 'access', core_text::strtolower(strip_tags($forumname))), array('href' => '#skipsitenews', 'class' => 'skip-block'));
 // Wraps site news forum in div container.
 echo html_writer::start_tag('div', array('id' => 'site-news-forum'));
 if (isloggedin()) {
     $SESSION->fromdiscussion = $CFG->wwwroot;
     $subtext = '';
     if (\mod_forum\subscriptions::is_subscribed($USER->id, $newsforum)) {
         if (!\mod_forum\subscriptions::is_forcesubscribed($newsforum)) {
             $subtext = get_string('unsubscribe', 'forum');
         }
     } else {
         $subtext = get_string('subscribe', 'forum');
     }
     echo $OUTPUT->heading($forumname);
     $suburl = new moodle_url('/mod/forum/subscribe.php', array('id' => $newsforum->id, 'sesskey' => sesskey()));
     echo html_writer::tag('div', html_writer::link($suburl, $subtext), array('class' => 'subscribelink'));
 } else {
     echo $OUTPUT->heading($forumname);
 }
 forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');
 // End site news forum div container.
 echo html_writer::end_tag('div');
 echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipsitenews'));
開發者ID:phuonguit2015,項目名稱:moodle,代碼行數:31,代碼來源:index.php

示例5: test_subscription_modes

 public function test_subscription_modes()
 {
     global $DB;
     $this->resetAfterTest(true);
     // Create a course, with a forum.
     $course = $this->getDataGenerator()->create_course();
     $options = array('course' => $course->id);
     $forum = $this->getDataGenerator()->create_module('forum', $options);
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_FORCESUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_FORCESUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::is_forcesubscribed($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::subscription_disabled($forum));
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_DISALLOWSUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_DISALLOWSUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::subscription_disabled($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_forcesubscribed($forum));
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_INITIALSUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_INITIALSUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::subscription_disabled($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_forcesubscribed($forum));
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_CHOOSESUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_CHOOSESUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::subscription_disabled($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_forcesubscribed($forum));
 }
開發者ID:Jinelle,項目名稱:moodle,代碼行數:33,代碼來源:subscriptions_test.php

示例6: definition

 /**
  * Form definition
  *
  * @return void
  */
 function definition()
 {
     global $CFG, $OUTPUT;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $coursecontext = $this->_customdata['coursecontext'];
     $modcontext = $this->_customdata['modcontext'];
     $forum = $this->_customdata['forum'];
     $post = $this->_customdata['post'];
     $subscribe = $this->_customdata['subscribe'];
     $edit = $this->_customdata['edit'];
     $thresholdwarning = $this->_customdata['thresholdwarning'];
     $mform->addElement('header', 'general', '');
     //fill in the data depending on page params later using set_data
     // If there is a warning message and we are not editing a post we need to handle the warning.
     if (!empty($thresholdwarning) && !$edit) {
         // Here we want to display a warning if they can still post but have reached the warning threshold.
         if ($thresholdwarning->canpost) {
             $message = get_string($thresholdwarning->errorcode, $thresholdwarning->module, $thresholdwarning->additional);
             $mform->addElement('html', $OUTPUT->notification($message));
         }
     }
     $mform->addElement('text', 'subject', get_string('subject', 'forum'), 'size="48"');
     $mform->setType('subject', PARAM_TEXT);
     $mform->addRule('subject', get_string('required'), 'required', null, 'client');
     $mform->addRule('subject', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $mform->addElement('editor', 'message', get_string('message', 'forum'), null, self::editor_options($modcontext, empty($post->id) ? null : $post->id));
     $mform->setType('message', PARAM_RAW);
     $mform->addRule('message', get_string('required'), 'required', null, 'client');
     $manageactivities = has_capability('moodle/course:manageactivities', $coursecontext);
     if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
         $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('everyoneissubscribed', 'forum'));
         $mform->addElement('hidden', 'subscribe');
         $mform->setType('subscribe', PARAM_INT);
         $mform->addHelpButton('subscribemessage', 'forcesubscribed', 'forum');
     } else {
         if (\mod_forum\subscriptions::subscription_disabled($forum) && !$manageactivities) {
             $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('disallowsubscribe', 'forum'));
             $mform->addElement('hidden', 'discussionsubscribe');
             $mform->setType('discussionsubscribe', PARAM_INT);
             $mform->addHelpButton('subscribemessage', 'disallowsubscription', 'forum');
         } else {
             $options = array();
             $options[0] = get_string('discussionsubscribestop', 'forum');
             $options[1] = get_string('discussionsubscribestart', 'forum');
             $mform->addElement('select', 'discussionsubscribe', get_string('discussionsubscription', 'forum'), $options);
             $mform->addHelpButton('discussionsubscribe', 'discussionsubscription', 'forum');
         }
     }
     if (!empty($forum->maxattachments) && $forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext)) {
         //  1 = No attachments at all
         $mform->addElement('filemanager', 'attachments', get_string('attachment', 'forum'), null, self::attachment_options($forum));
         $mform->addHelpButton('attachments', 'attachment', 'forum');
     }
     if (empty($post->id) && $manageactivities) {
         $mform->addElement('checkbox', 'mailnow', get_string('mailnow', 'forum'));
     }
     if (!empty($CFG->forum_enabletimedposts) && !$post->parent && has_capability('mod/forum:viewhiddentimedposts', $coursecontext)) {
         // hack alert
         $mform->addElement('header', 'displayperiod', get_string('displayperiod', 'forum'));
         $mform->addElement('date_selector', 'timestart', get_string('displaystart', 'forum'), array('optional' => true));
         $mform->addHelpButton('timestart', 'displaystart', 'forum');
         $mform->addElement('date_selector', 'timeend', get_string('displayend', 'forum'), array('optional' => true));
         $mform->addHelpButton('timeend', 'displayend', 'forum');
     } else {
         $mform->addElement('hidden', 'timestart');
         $mform->setType('timestart', PARAM_INT);
         $mform->addElement('hidden', 'timeend');
         $mform->setType('timeend', PARAM_INT);
         $mform->setConstants(array('timestart' => 0, 'timeend' => 0));
     }
     if ($groupmode = groups_get_activity_groupmode($cm, $course)) {
         // hack alert
         $groupdata = groups_get_activity_allowed_groups($cm);
         $groupcount = count($groupdata);
         $groupinfo = array();
         $modulecontext = context_module::instance($cm->id);
         // Check whether the user has access to all groups in this forum from the accessallgroups cap.
         if ($groupmode == VISIBLEGROUPS || has_capability('moodle/site:accessallgroups', $modulecontext)) {
             // Only allow posting to all groups if the user has access to all groups.
             $groupinfo = array('0' => get_string('allparticipants'));
             $groupcount++;
         }
         $contextcheck = has_capability('mod/forum:movediscussions', $modulecontext) && empty($post->parent) && $groupcount > 1;
         if ($contextcheck) {
             foreach ($groupdata as $grouptemp) {
                 $groupinfo[$grouptemp->id] = $grouptemp->name;
             }
             $mform->addElement('select', 'groupinfo', get_string('group'), $groupinfo);
             $mform->setDefault('groupinfo', $post->groupid);
             $mform->setType('groupinfo', PARAM_INT);
         } else {
             if (empty($post->groupid)) {
                 $groupname = get_string('allparticipants');
//.........這裏部分代碼省略.........
開發者ID:janaece,項目名稱:globalclassroom4_clean,代碼行數:101,代碼來源:post_form.php

示例7: definition

 /**
  * Form definition
  *
  * @return void
  */
 function definition()
 {
     global $CFG, $OUTPUT;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $coursecontext = $this->_customdata['coursecontext'];
     $modcontext = $this->_customdata['modcontext'];
     $forum = $this->_customdata['forum'];
     $post = $this->_customdata['post'];
     $subscribe = $this->_customdata['subscribe'];
     $edit = $this->_customdata['edit'];
     $thresholdwarning = $this->_customdata['thresholdwarning'];
     $mform->addElement('header', 'general', '');
     //fill in the data depending on page params later using set_data
     // If there is a warning message and we are not editing a post we need to handle the warning.
     if (!empty($thresholdwarning) && !$edit) {
         // Here we want to display a warning if they can still post but have reached the warning threshold.
         if ($thresholdwarning->canpost) {
             $message = get_string($thresholdwarning->errorcode, $thresholdwarning->module, $thresholdwarning->additional);
             $mform->addElement('html', $OUTPUT->notification($message));
         }
     }
     $mform->addElement('text', 'subject', get_string('subject', 'forum'), 'size="48"');
     $mform->setType('subject', PARAM_TEXT);
     $mform->addRule('subject', get_string('required'), 'required', null, 'client');
     $mform->addRule('subject', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $mform->addElement('editor', 'message', get_string('message', 'forum'), null, self::editor_options($modcontext, empty($post->id) ? null : $post->id));
     $mform->setType('message', PARAM_RAW);
     $mform->addRule('message', get_string('required'), 'required', null, 'client');
     $manageactivities = has_capability('moodle/course:manageactivities', $coursecontext);
     if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
         $mform->addElement('checkbox', 'discussionsubscribe', get_string('discussionsubscription', 'forum'));
         $mform->freeze('discussionsubscribe');
         $mform->setDefaults('discussionsubscribe', 0);
         $mform->addHelpButton('discussionsubscribe', 'forcesubscribed', 'forum');
     } else {
         if (\mod_forum\subscriptions::subscription_disabled($forum) && !$manageactivities) {
             $mform->addElement('checkbox', 'discussionsubscribe', get_string('discussionsubscription', 'forum'));
             $mform->freeze('discussionsubscribe');
             $mform->setDefaults('discussionsubscribe', 0);
             $mform->addHelpButton('discussionsubscribe', 'disallowsubscription', 'forum');
         } else {
             $mform->addElement('checkbox', 'discussionsubscribe', get_string('discussionsubscription', 'forum'));
             $mform->addHelpButton('discussionsubscribe', 'discussionsubscription', 'forum');
         }
     }
     if (!empty($forum->maxattachments) && $forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext)) {
         //  1 = No attachments at all
         $mform->addElement('filemanager', 'attachments', get_string('attachment', 'forum'), null, self::attachment_options($forum));
         $mform->addHelpButton('attachments', 'attachment', 'forum');
     }
     if (empty($post->id) && $manageactivities) {
         $mform->addElement('checkbox', 'mailnow', get_string('mailnow', 'forum'));
     }
     if (!empty($CFG->forum_enabletimedposts) && !$post->parent && has_capability('mod/forum:viewhiddentimedposts', $coursecontext)) {
         // hack alert
         $mform->addElement('header', 'displayperiod', get_string('displayperiod', 'forum'));
         $mform->addElement('date_time_selector', 'timestart', get_string('displaystart', 'forum'), array('optional' => true));
         $mform->addHelpButton('timestart', 'displaystart', 'forum');
         $mform->addElement('date_time_selector', 'timeend', get_string('displayend', 'forum'), array('optional' => true));
         $mform->addHelpButton('timeend', 'displayend', 'forum');
     } else {
         $mform->addElement('hidden', 'timestart');
         $mform->setType('timestart', PARAM_INT);
         $mform->addElement('hidden', 'timeend');
         $mform->setType('timeend', PARAM_INT);
         $mform->setConstants(array('timestart' => 0, 'timeend' => 0));
     }
     if ($groupmode = groups_get_activity_groupmode($cm, $course)) {
         $groupdata = groups_get_activity_allowed_groups($cm);
         $groupinfo = array();
         foreach ($groupdata as $groupid => $group) {
             // Check whether this user can post in this group.
             // We must make this check because all groups are returned for a visible grouped activity.
             if (forum_user_can_post_discussion($forum, $groupid, null, $cm, $modcontext)) {
                 // Build the data for the groupinfo select.
                 $groupinfo[$groupid] = $group->name;
             } else {
                 unset($groupdata[$groupid]);
             }
         }
         $groupcount = count($groupinfo);
         // Check whether a user can post to all of their own groups.
         // Posts to all of my groups are copied to each group that the user is a member of. Certain conditions must be met.
         // 1) It only makes sense to allow this when a user is in more than one group.
         // Note: This check must come before we consider adding accessallgroups, because that is not a real group.
         $canposttoowngroups = empty($post->edit) && $groupcount > 1;
         // 2) Important: You can *only* post to multiple groups for a top level post. Never any reply.
         $canposttoowngroups = $canposttoowngroups && empty($post->parent);
         // 3) You also need the canposttoowngroups capability.
         $canposttoowngroups = $canposttoowngroups && has_capability('mod/forum:canposttomygroups', $modcontext);
         if ($canposttoowngroups) {
             // This user is in multiple groups, and can post to all of their own groups.
             // Note: This is not the same as accessallgroups. This option will copy a post to all groups that a
//.........這裏部分代碼省略.........
開發者ID:alanaipe2015,項目名稱:moodle,代碼行數:101,代碼來源:post_form.php

示例8: forum_is_forcesubscribed

/**
 * Determine whether the forum is force subscribed.
 *
 * @param object $forum
 * @return bool
 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_forcesubscribed() instead
 */
function forum_is_forcesubscribed($forum)
{
    debugging("forum_is_forcesubscribed() has been deprecated, please use \\mod_forum\\subscriptions::is_forcesubscribed() instead.", DEBUG_DEVELOPER);
    global $DB;
    if (!isset($forum->forcesubscribe)) {
        $forum = $DB->get_field('forum', 'forcesubscribe', array('id' => $forum));
    }
    return \mod_forum\subscriptions::is_forcesubscribed($forum);
}
開發者ID:pzhu2004,項目名稱:moodle,代碼行數:16,代碼來源:deprecatedlib.php

示例9: is_subscribable

 /**
  * Helper to determine whether the specified forum can be subscribed to.
  *
  * @param \stdClass $forum The record of the forum to test
  * @return bool
  */
 public static function is_subscribable($forum)
 {
     return isloggedin() && !isguestuser() && !\mod_forum\subscriptions::is_forcesubscribed($forum) && !\mod_forum\subscriptions::subscription_disabled($forum);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:10,代碼來源:subscriptions.php

示例10: test_subscription_modes

 public function test_subscription_modes()
 {
     global $DB;
     $this->resetAfterTest(true);
     // Create a course, with a forum.
     $course = $this->getDataGenerator()->create_course();
     $options = array('course' => $course->id);
     $forum = $this->getDataGenerator()->create_module('forum', $options);
     // Create a user enrolled in the course as a student.
     list($user) = $this->helper_create_users($course, 1);
     // Must be logged in as the current user.
     $this->setUser($user);
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_FORCESUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_FORCESUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::is_forcesubscribed($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::subscription_disabled($forum));
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_DISALLOWSUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_DISALLOWSUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::subscription_disabled($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_forcesubscribed($forum));
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_INITIALSUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_INITIALSUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::subscription_disabled($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_forcesubscribed($forum));
     \mod_forum\subscriptions::set_subscription_mode($forum->id, FORUM_CHOOSESUBSCRIBE);
     $forum = $DB->get_record('forum', array('id' => $forum->id));
     $this->assertEquals(FORUM_CHOOSESUBSCRIBE, \mod_forum\subscriptions::get_subscription_mode($forum));
     $this->assertTrue(\mod_forum\subscriptions::is_subscribable($forum));
     $this->assertFalse(\mod_forum\subscriptions::subscription_disabled($forum));
     $this->assertFalse(\mod_forum\subscriptions::is_forcesubscribed($forum));
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:37,代碼來源:subscriptions_test.php


注:本文中的mod_forum\subscriptions::is_forcesubscribed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。